r-lib/ragg

enhanced 'dev.capabilities()' support

Closed this issue · 3 comments

Currently {ragg} does not provide full information to the enhanced dev.capabilities() feature introduced in R 4.2:

ragg::agg_png(tempfile())
print(dev.capabilities())
dev.off()
$semiTransparency
[1] TRUE

$transparentBackground
[1] "fully"

$rasterImage
[1] NA

$capture
[1] FALSE

$locator
[1] FALSE

$events
character(0)

$patterns
[1] NA

$clippingPaths
[1] NA

$masks
[1] NA

$compositing
[1] FALSE

$transformations
[1] FALSE

$paths
[1] FALSE

Note unlike {svglite} this lack of support doesn't currently cause me any headaches since

device <- names(grDevices::dev.cur())
(device %in% c("agg_jpeg", "agg_ppm", "agg_png", "agg_tiff")) && 
        (packageVersion("ragg") >= '1.2.0')

should reliably tell me what I want to know but if every graphics device that added support for masking, gradients, etc. also supported the enhanced dev.capabilities() support it would be much easier for developers to properly guess whether the active graphic device has such support instead of using hacks like the above.

Thanks for raising this - I was sure it was deduced automatically

it appears the capabilities callback was added in the latest update. Will add this once I get around to add the latest features

Thanks Thomas for fixing this ^_^