ragg icon indicating copy to clipboard operation
ragg copied to clipboard

enhanced 'dev.capabilities()' support

Open trevorld opened this issue 2 years ago • 2 comments

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

  • https://developer.r-project.org/Blog/public/2021/12/14/updating-graphics-devices-for-r-4.2.0/
  • https://cran.r-project.org/doc/manuals/r-devel/R-ints.html#Device-capabilities
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.

trevorld avatar Mar 21 '22 18:03 trevorld

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

thomasp85 avatar Aug 02 '22 08:08 thomasp85

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

thomasp85 avatar Aug 02 '22 09:08 thomasp85

Thanks Thomas for fixing this ^_^

teunbrand avatar Oct 06 '23 13:10 teunbrand