diff --git a/dev/articles/ragg_performance.html b/dev/articles/ragg_performance.html index fa25aa7..5df684c 100644 --- a/dev/articles/ragg_performance.html +++ b/dev/articles/ragg_performance.html @@ -705,7 +705,7 @@
The PNG (Portable Network Graphic) format is one of the most ubiquitous -today, due to its versatiliity +
The PNG (Portable Network Graphic) format is one of the most ubiquitous
+today, due to its versatiliity
and widespread support. It supports transparency as well as both 8 and 16 bit
colour. The device uses default compression and filtering and will not use a
-colour palette as this is less useful for antialiased data. This means that
+colour palette as this is less useful for antialiased data. This means that
it might be possible to compress the resulting image even more if size is of
-concern (though the defaults are often very good). In contrast to
-[grDevices::png()] the date and time will not be written to the file, meaning
-that similar plot code will produce identical files (a good feature if used
+concern (though the defaults are often very good). In contrast to
+grDevices::png()
the date and time will not be written to the file, meaning
+that similar plot code will produce identical files (a good feature if used
with version control). It will, however, write in the dimensions of the image
-based on the `res` argument.
res
argument.
The name of the file. Follows the same semantics as the file -naming in [grDevices::png()], meaning that you can provide a [sprintf()] +
The name of the file. Follows the same semantics as the file
+naming in grDevices::png()
, meaning that you can provide a sprintf()
compliant string format to name multiple plots (such as the default value)
The TIFF (Tagged Image File Format) format is a very versatile raster image storage format that supports 8 and 16bit colour mode, true transparency, as -well as a range of other features not relevant to drawing from R (e.g. +well as a range of other features not relevant to drawing from R (e.g. support for different colour spaces). The storage mode of the image data is not fixed and different compression modes are possible, in contrast to PNGs one-approach-fits-all. The default (uncompressed) will result in much larger @@ -108,8 +108,8 @@
The name of the file. Follows the same semantics as the file -naming in [grDevices::png()], meaning that you can provide a [sprintf()] +
The name of the file. Follows the same semantics as the file
+naming in grDevices::png()
, meaning that you can provide a sprintf()
compliant string format to name multiple plots (such as the default value)
`'jpeg'` compression is only available if ragg is compiled with a -version of `libtiff` where jpeg support has been turned on.
+'jpeg'
compression is only available if ragg is compiled with a
+version of libtiff
where jpeg support has been turned on.
TIFF have support for true transparency, meaning that the pixel colour is -stored in pre-multiplied form. This is in contrast to pixels being stored in +
TIFF have support for true transparency, meaning that the pixel colour is +stored in pre-multiplied form. This is in contrast to pixels being stored in plain format, where the alpha values more function as a mask. The utility of this is not always that important, but it is one of the benefits of TIFF over PNG so it should be noted.
diff --git a/dev/search.json b/dev/search.json index 1e7439e..70b3d64 100644 --- a/dev/search.json +++ b/dev/search.json @@ -1 +1 @@ -[{"path":[]},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement codeofconduct@posit.co. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://ragg.r-lib.org/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 ragg authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"opening-and-closing","dir":"Articles","previous_headings":"","what":"Opening and closing","title":"Ragg Performance","text":"subsequent benchmarks omit opening closing device instead focus rendering performance. important, potentially time-consuming, part opening closing device allocation buffer write raster information , serialising buffer file. also performance differences e.g. png tiff come . ragg grDevices use underlying libraries write png files (libpng) expected much difference. can seen, clear cut seems. ragg cairo_png equivalent performance, Cairo twice fast. Xlib hand even slower. Looking produced files can see ragg cairo_png produce files around 2 KB, whereas cairo produces files around 300 B XLib around 6 KB. differences can thus ascribed disk write speed anything, probably due different compression filtering settings used. ragg uses default heuristics libpng, guess cairo_png uses well. white rectangle (produced plot.new()) amenable lot compression possible cairo tuned . likely advantage disappear complex plots difficult test without inflating rendering speed.","code":"file <- tempfile(fileext = '.png') res <- bench::mark( ragg = {agg_png(file); plot.new(); dev.off()}, cairo = {png(file, type = 'cairo'); plot.new(); dev.off()}, cairo_png = {png(file, type = 'cairo-png'); plot.new(); dev.off()}, Xlib = if (has_xlib) {png(file, type = 'Xlib'); plot.new(); dev.off()} else NULL, check = FALSE ) if (!has_xlib) { res <- res[-4, ] attr(res$expression, 'description') <- attr(res$expression, 'description')[-4] } plot(res, type = 'ridge') + ggtitle('Open and close performance')"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"rendering","dir":"Articles","previous_headings":"Opening and closing","what":"Rendering","title":"Ragg Performance","text":"graphic device provides range methods R’s graphic engine use receives plotting instructions user. performant methods , performant graphic device whole. range anti-aliasing options grDevices increases , ragg settings always draw subpixel antialiasing. attempt benchmark device methods constructing direct possible calls . Remember, void_dev() provides baseline.","code":"render_bench <- function(dev_f, ...) { dots <- rlang::enexprs(...) force(dev_f) on.exit(dev.off()) plot.new() rlang::eval_tidy(expr(bench::mark(!!!dots, min_iterations = 10))) } all_render_bench <- function(expr, xlib = TRUE) { file <- tempfile() expr <- rlang::enexpr(expr) res <- list( render_bench(agg_png(file), ragg = !!expr), render_bench(png(file, type = \"cairo\", antialias = 'none'), cairo_none = !!expr), render_bench(png(file, type = \"cairo\", antialias = 'gray'), cairo_gray = !!expr), render_bench(png(file, type = \"cairo\", antialias = 'subpixel'), cairo_subpixel = !!expr), if (has_xlib && xlib) render_bench(png(file, type = \"Xlib\"), xlib = !!expr) else NULL ) expr <- unlist(lapply(res, `[[`, 'expression'), recursive = FALSE) res <- do.call(rbind, res) res$expression <- expr class(res$expression) <- c('bench_expr', 'expression') attr(res$expression, 'description') <- names(res$expression) res$Anti_aliased <- c(TRUE, FALSE, TRUE, TRUE, FALSE)[seq_len(nrow(res))] res } plot_bench <- function(x, title, baseline) { plot(x, type = 'ridge', aes(fill = Anti_aliased)) + facet_null() + geom_vline(xintercept = baseline['elapsed'], linetype = 2, colour = 'grey') + annotate('text', x = baseline['elapsed'], y = -Inf, label = ' baseline', vjust = 0, hjust = 0, colour = 'grey') + scale_fill_brewer(labels = c('No', 'Yes'), type = 'qual') + labs(title = title, fill = 'Anti-aliased', x = NULL, y = NULL) + theme_minimal() + theme(panel.grid.major.y = element_blank(), legend.position = 'bottom') + scale_x_continuous(labels = function(x) {format(bench:::as_bench_time(x))}) }"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"circles","dir":"Articles","previous_headings":"Opening and closing","what":"Circles","title":"Ragg Performance","text":"Circles can drawn e.g. grid.circle() often used drawing scatter plots default point type. thus high importance circle drawing performant possible, may get called thousands times creation plot. antialiased devices clear ragg performant. performance gain pronounced unfilled circles due fact cairo doesn’t antialias fill, stroke text. Xlib far performant device, also one rendering lowest quality far (see Rendering quality vignette).","code":"x <- runif(1000) y <- runif(1000) pch <- 1 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Unfilled circle performance', b) pch <- 19 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Filled circle performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"lines","dir":"Articles","previous_headings":"Opening and closing","what":"Lines","title":"Ragg Performance","text":"Lines another fundamental part. can used draw single line segments directly also workhorse different symbol types, e.g. pch = 4, use . , see clear performance difference devices using antialiasing . ragg fastest one using anti-aliasing.","code":"pch <- 4 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Line segment performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"polylines","dir":"Articles","previous_headings":"Opening and closing","what":"Polylines","title":"Ragg Performance","text":"Polylines connected line segments. expect picture lines given operations quite similar. also test different line patterns assess whether differences efficency patterns generated. results quite surprising. general pattern continues, anti-aliasing cairo much slower setups. patterned test, see Xlib slow generating patterned lines completely negates otherwise solid rendering speed leadership (, cost quality).","code":"void_dev() plot.new() b <- system.time(lines(x, y)) invisible(dev.off()) res <- all_render_bench(lines(x, y)) plot_bench(res, 'Connected line performance', b) void_dev() plot.new() b <- system.time(lines(x, y, lty = 4)) invisible(dev.off()) res <- all_render_bench(lines(x, y, lty = 4)) plot_bench(res, 'Patterned connected line performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"rectangles","dir":"Articles","previous_headings":"Opening and closing","what":"Rectangles","title":"Ragg Performance","text":"Rectangle another graphic primitive method. , used plotting certain types points, ’ll test : see new pattern filled rectangles, ragg suddenly slow one. reason cairo apply anti-aliasing fills drawing non anti-aliased filled rectangle extremely simple.","code":"pch <- 0 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Unfilled rectangle performance', b) pch <- 15 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Filled rectangle performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"polygons","dir":"Articles","previous_headings":"Opening and closing","what":"Polygons","title":"Ragg Performance","text":"Polygons general case ’ve seen circles rectangles. certain optimisations may possible e.g. rectanges, polygon method device needs handle cases. used points e.g. triangles, also test performance bigger, complex polygons. findings reflect seen . ragg faster comes drawing lines, loses advantage fill one performing anti-aliasing fill.","code":"pch <- 2 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Simple polygon performance', b) void_dev() plot.new() b <- system.time(polygon(x, y)) invisible(dev.off()) res <- all_render_bench(polygon(x, y)) plot_bench(res, 'Unfilled complex polygon performance', b) void_dev() plot.new() b <- system.time(polygon(x, y, border = 'gray', col = 'black')) invisible(dev.off()) res <- all_render_bench(polygon(x, y, border = 'gray', col = 'black')) plot_bench(res, 'Filled complex polygon performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"paths","dir":"Articles","previous_headings":"Opening and closing","what":"Paths","title":"Ragg Performance","text":"Paths supercharged versions polygons support holes whatnot. one features added later lifetime R graphic engine devices can thus elect support . , however, including cairo, Xlib. ragg, path rendering implemented way polygon rendering (polygon method special case path method), devices implement something know. path performance mirrors shape rendering. ragg faster comes drawing stroke, speed advantage almost lost shape filled well cairo anti-alias fill. Xlib present path rendering unsupported.","code":"section <- rep(1:10, each = 100) x_path <- unlist(lapply(split(x, section), function(x) c(x, NA))) y_path <- unlist(lapply(split(y, section), function(x) c(x, NA))) x_path <- x_path[-length(x_path)] y_path <- y_path[-length(y_path)] void_dev() plot.new() b <- system.time(polypath(x_path, y_path, rule = 'evenodd')) invisible(dev.off()) res <- all_render_bench(polypath(x_path, y_path, rule = 'evenodd'), xlib = FALSE) plot_bench(res, 'Unfilled path performance', b) void_dev() plot.new() b <- system.time(polypath(x_path, y_path, rule = 'evenodd', border = 'gray', col = 'black')) invisible(dev.off()) res <- all_render_bench(polypath(x_path, y_path, rule = 'evenodd', border = 'gray', col = 'black'), xlib = FALSE) plot_bench(res, 'Filled path performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"raster","dir":"Articles","previous_headings":"Opening and closing","what":"Raster","title":"Ragg Performance","text":"ability draw raster images also one later capabilities added graphic engine. , don’t support , devices look . Raster images can rotated, can interpolated scaling. interpolation happens device specific, ’s lot room quality differences look . Plotting rasters wicked fast appears. non-rotated rasters ragg tiny bit slower cairo, maybe due anti-aliasing edges. loss gained comes rotation, indicating performant affine transformation implementation. Xlib significantly slower , reasons beyond .","code":"raster <- matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE)) plot_bench(res, 'Non-interpolated, non-rotated raster performance', b) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE, angle = 27)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE, angle = 27)) plot_bench(res, 'Non-interpolated, rotated raster performance', b) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE)) plot_bench(res, 'Interpolated, non-rotated raster performance', b) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE, angle = 27)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE, angle = 27)) plot_bench(res, 'Interpolated, rotated raster performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"text","dir":"Articles","previous_headings":"Opening and closing","what":"Text","title":"Ragg Performance","text":"Text data visualisation crucial, one hardest parts implementing graphic device. reflected e.g. inability native devices find system fonts, thus rely e.g. extrafont showtext packages . Anyway, look performance document. Xlib surprises significantly slower font handling anti-aliased peers. ragg slightly faster cairo much. general, text rendering governed much quickly code looks glyphs font database rendering speed.","code":"pch <- \"#\" void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Single character performance', b) void_dev() plot.new() b <- system.time(text(x, y, label = 'abcdefghijk')) invisible(dev.off()) res <- all_render_bench(text(x, y, label = 'abcdefghijk')) plot_bench(res, 'Text string performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"complex-example","dir":"Articles","previous_headings":"Opening and closing","what":"Complex example","title":"Ragg Performance","text":"primitives can difficult summarize. general, appears ragg small consistent lead performance among anti-aliased devices safe areas. last benchmark tie together complete graphic made using ggplot2 (don’t worry quality graphic — simply piling layers stuff): prebuild plot mainly rendering measured see complex graphics speed benefit non anti-aliased Xlib device disappears (probably due slow text rendering). Ragg clearly fastest anti-aliased device, noted example deliberately included stroked filled shapes. plotting filled shapes, speed advantage might decrease disappear. Something else haven’t discussed , may affect speed complex graphic clipping speed (drawing elements outside clipping region).","code":"p <- ggplot(diamonds, aes(carat, price)) + geom_hex() + geom_point(shape = 1, size = 0.05, colour = 'white') + geom_smooth() + facet_wrap(~clarity) + labs(title = '5 things you didn\\'t knew about the diamonds dataset', subtitle = 'You won\\'t believe number 4', caption = 'Source: The ggplot2 package') p p <- ggplotGrob(p) void_dev() b <- system.time(plot(p)) invisible(dev.off()) res <- all_render_bench(plot(p)) plot_bench(res, 'Complex composite performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Ragg Performance","text":"One point gather anti-aliasing cost specific situations, even complex tasks. Xlib non anti-aliased cairo almost consistently fastest rendering primitives, though show surprising problems tasks. want anti-aliasing (generally ), ragg consistently fastest options, general speed gain around ~33% compared cairo. places speed gain less, mainly cairo chooses use anti-aliasing fill. decision anti-alias fill questionable opinion. stroke also drawn indeed immaterial whether underlying fill anti-aliased, , unless stroke transparent. stroke drawn result obviously ugly. argued device inspect whether solid stroke going drawn make choice based , line width comes effect well. thin stroke able hide jagged non anti-aliased fill completely result unacceptable visual artefacts. , ragg designed simply always use anti-aliasing. worst, makes performant cairo counterpart, best faster higher quality output.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"advanced-features","dir":"Articles","previous_headings":"","what":"Advanced features","title":"Ragg Performance","text":"graphic engine lately seen lot exciting development, support advanced rendering features gradients, pattern fills, arbitrary clipping paths etc. Support depending device mainly supported Cairo PDF base installation. ragg strive keep new features though may lag behind bit development takes time. new features available grid can’t avoid bit overhead measuring performance .","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"clipping-paths","dir":"Articles","previous_headings":"Advanced features","what":"Clipping paths","title":"Ragg Performance","text":"Clipping paths allows define arbitrary clipping region based complex grob may define. Passing grob clip argument viewport use grob clipping region. can see ragg fares much better cairo comes rendering arbitrary clipping paths. can’t comment cairo implementation works, ragg able perform clipping rasterisation level rather performing boolean operations geometries makes efficient basically surmounts rasterising clipping path areas main graphic getting rendered.","code":"library(grid) clip <- pointsGrob(runif(500), runif(500), default.units = 'npc') segments <- segmentsGrob(runif(100), runif(100), runif(100), runif(100), vp = viewport(clip = clip)) void_dev() plot.new() b <- system.time(grid.draw(segments)) invisible(dev.off()) res <- all_render_bench(grid.draw(segments)) plot_bench(res, 'Complex clip path performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"masks","dir":"Articles","previous_headings":"Advanced features","what":"Masks","title":"Ragg Performance","text":"Masks allow define alpha level layer based information another layer. , can perform things clipping paths , underlying idea different. also requires render whole new canvas creating mask overhead present clipping paths depending resolution device. see , least resolutions tests performed , alpha masks much faster clipping paths ragg cairo - ragg still quite bit faster, cairo’s mask performance faster ragg’s clipping path performance.","code":"mask <- pointsGrob(runif(2000), runif(2000), default.units = 'npc', pch = 16, gp = gpar(col = '#00000077')) segments <- segmentsGrob(runif(100), runif(100), runif(100), runif(100), vp = viewport(mask = mask)) void_dev() plot.new() b <- system.time(grid.draw(segments)) invisible(dev.off()) res <- all_render_bench(grid.draw(segments)) plot_bench(res, 'Complex mask performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"gradients","dir":"Articles","previous_headings":"Advanced features","what":"Gradients","title":"Ragg Performance","text":"Gradients allow produce smooth transition range colours, either along line radial manner. Gradients performing par ragg cairo. Beware gradients defined vectorised manner elements grob share gradient. means drawing 2000 circles separate gradients much slower drawing shared gradient create draw grob .","code":"circles <- circleGrob(runif(2000), runif(2000), r = unit(0.5, 'char'), gp = gpar(fill = linearGradient(c('black', 'transparent', 'blue')))) void_dev() plot.new() b <- system.time(grid.draw(circles)) invisible(dev.off()) res <- all_render_bench(grid.draw(circles)) plot_bench(res, 'Gradient performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"patterns","dir":"Articles","previous_headings":"Advanced features","what":"Patterns","title":"Ragg Performance","text":"Patterns another fill type alongside gradients. can take grob rendered separate canvas used fill different extend modes (repeat, reflect, pad, etc.) see clear performance upper-hand ragg. caveats apply gradients patterns, unfortunately, using multiple different patterns considerable overhead multiple grobs need created.","code":"segments <- segmentsGrob(runif(1000), runif(1000), runif(1000), runif(1000), gp = gpar(col = sample(palette(), 1000, TRUE))) pat <- pattern(segments, width = 0.1, height = 0.1, extend = 'reflect') circles <- circleGrob(runif(1000), runif(1000), r = unit(1, 'char'), gp = gpar(fill = pat)) void_dev() plot.new() b <- system.time(grid.draw(circles)) invisible(dev.off()) res <- all_render_bench(grid.draw(circles)) plot_bench(res, 'Pattern performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"session-info","dir":"Articles","previous_headings":"","what":"Session info","title":"Ragg Performance","text":"","code":"sessioninfo::session_info() #> ─ Session info ───────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os Ubuntu 22.04.4 LTS #> system x86_64, linux-gnu #> ui X11 #> language en #> collate C.UTF-8 #> ctype C.UTF-8 #> tz UTC #> date 2024-04-30 #> pandoc 3.1.11 @ /opt/hostedtoolcache/pandoc/3.1.11/x64/ (via rmarkdown) #> #> ─ Packages ───────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> bench 1.1.3 2023-05-04 [1] RSPM #> bslib 0.7.0 2024-03-29 [1] RSPM #> cachem 1.0.8 2023-05-01 [1] RSPM #> cli 3.6.2 2023-12-11 [1] RSPM #> colorspace 2.1-0 2023-01-23 [1] RSPM #> desc 1.4.3 2023-12-10 [1] RSPM #> devoid * 0.1.2 2023-04-25 [1] RSPM #> digest 0.6.35 2024-03-11 [1] RSPM #> dplyr 1.1.4 2023-11-17 [1] RSPM #> evaluate 0.23 2023-11-01 [1] RSPM #> fansi 1.0.6 2023-12-08 [1] RSPM #> farver 2.1.1 2022-07-06 [1] RSPM #> fastmap 1.1.1 2023-02-24 [1] RSPM #> fs 1.6.4 2024-04-25 [1] RSPM #> generics 0.1.3 2022-07-05 [1] RSPM #> ggplot2 * 3.5.1 2024-04-23 [1] RSPM #> ggridges 0.5.6 2024-01-23 [1] RSPM #> glue 1.7.0 2024-01-09 [1] RSPM #> gtable 0.3.5 2024-04-22 [1] RSPM #> hexbin 1.28.3 2023-03-21 [1] RSPM #> highr 0.10 2022-12-22 [1] RSPM #> htmltools 0.5.8.1 2024-04-04 [1] RSPM #> jquerylib 0.1.4 2021-04-26 [1] RSPM #> jsonlite 1.8.8 2023-12-04 [1] RSPM #> knitr 1.46 2024-04-06 [1] RSPM #> labeling 0.4.3 2023-08-29 [1] RSPM #> lattice 0.22-6 2024-03-20 [3] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] RSPM #> magrittr 2.0.3 2022-03-30 [1] RSPM #> Matrix 1.7-0 2024-03-22 [3] CRAN (R 4.4.0) #> memoise 2.0.1 2021-11-26 [1] RSPM #> mgcv 1.9-1 2023-12-21 [3] CRAN (R 4.4.0) #> munsell 0.5.1 2024-04-01 [1] RSPM #> nlme 3.1-164 2023-11-27 [3] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] RSPM #> pkgconfig 2.0.3 2019-09-22 [1] RSPM #> pkgdown 2.0.9 2024-04-18 [1] RSPM #> profmem 0.6.0 2020-12-13 [1] RSPM #> purrr 1.0.2 2023-08-10 [1] RSPM #> R6 2.5.1 2021-08-19 [1] RSPM #> ragg * 1.3.0.9000 2024-04-30 [1] local #> RColorBrewer 1.1-3 2022-04-03 [1] RSPM #> rlang 1.1.3 2024-01-10 [1] RSPM #> rmarkdown 2.26 2024-03-05 [1] RSPM #> sass 0.4.9 2024-03-15 [1] RSPM #> scales 1.3.0 2023-11-28 [1] RSPM #> sessioninfo 1.2.2 2021-12-06 [1] RSPM #> systemfonts 1.0.6 2024-03-07 [1] RSPM #> textshaping 0.3.7 2023-10-09 [1] RSPM #> tibble 3.2.1 2023-03-20 [1] RSPM #> tidyr 1.3.1 2024-01-24 [1] RSPM #> tidyselect 1.2.1 2024-03-11 [1] RSPM #> utf8 1.2.4 2023-10-22 [1] RSPM #> vctrs 0.6.5 2023-12-01 [1] RSPM #> withr 3.0.0 2024-01-16 [1] RSPM #> xfun 0.43 2024-03-25 [1] RSPM #> yaml 2.3.8 2023-12-11 [1] RSPM #> #> [1] /home/runner/work/_temp/Library #> [2] /opt/R/4.4.0/lib/R/site-library #> [3] /opt/R/4.4.0/lib/R/library #> #> ────────────────────────────────────────────────────────────────────────"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"scope","dir":"Articles","previous_headings":"","what":"Scope","title":"Ragg Quality","text":"mainly two areas high importance discussing graphic device quality: Shape rendering (fill stroke) text rendering. highly dependent quality anti-aliasing . Apart also look alpha blending raster interpolation.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"shape-rendering","dir":"Articles","previous_headings":"","what":"Shape rendering","title":"Ragg Quality","text":"examples relevant rendering different types shapes, lines polygons. Lines obviously don’t fill, stroke rendering relevance . chose use circle provides nice sampling uneven edges.","code":"circle_quality <- function(device, name, file, ...) { device(file, width = 600, height = 300, ...) grid.circle( x = c(0.25, 0.75), r = 0.4, gp = gpar(col = c('black', NA), fill = c(NA, 'black'), lwd = 2) ) grid.text(y = 0.1, label = name, gp = gpar(cex = 2)) invisible(dev.off()) } ragg_circle <- knitr::fig_path('.png') circle_quality(agg_png, 'ragg', ragg_circle) knitr::include_graphics(ragg_circle) cairo_none_circle <- knitr::fig_path('.png') circle_quality(png, 'cairo no AA', cairo_none_circle, type = 'cairo', antialias = 'none') knitr::include_graphics(cairo_none_circle) cairo_gray_circle <- knitr::fig_path('.png') circle_quality(png, 'cairo gray AA', cairo_gray_circle, type = 'cairo', antialias = 'gray') knitr::include_graphics(cairo_gray_circle) cairo_subpixel_circle <- knitr::fig_path('.png') circle_quality(png, 'cairo subpixel AA', cairo_subpixel_circle, type = 'cairo', antialias = 'subpixel') knitr::include_graphics(cairo_subpixel_circle)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations","dir":"Articles","previous_headings":"Shape rendering","what":"Observations","title":"Ragg Quality","text":"ragg device provides anti-aliasing fill, results obvious quality differences. reason cairo presumably avoid artefacts shapes touching anti-aliasing can result thin edge two shapes instead contiguous colour. real issue, personally don’t agree allowed degrade overall quality device, hence reason following approach ragg. Xlib (available system), provides completely non anti-aliased output cairo antialias = 'none'. surprising Xlib appears better stroke rendering cairo without anti-aliasing. , difference 'gray' 'subpixel' antialiasing visible naked eye, 2x zoom.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"text","dir":"Articles","previous_headings":"","what":"Text","title":"Ragg Quality","text":"Text difficult thing handle graphic device, terms finding system fonts, terms rendering. Often rendering offloaded another library (e.g. freetype), provide bitmap representation blend device. approach often good horizontal vertical text, struggle rotations. test text rendering different sizes 27° counter-clockwise rotation. use system provided serif font provides complex task sans-serif one.","code":"text_quality <- function(device, name, file, rotation = 0, ...) { text <- 'The quick blue R jumped over the lazy snake' vp <- viewport(angle = rotation) device(file, width = 600, height = 300, ...) pushViewport(vp) grid.text(text, x = 0.1, y = 0.2, just = 'left', gp = gpar(fontfamily = 'serif', cex = 0.5)) grid.text(text, x = 0.1, y = 0.4, just = 'left', gp = gpar(fontfamily = 'serif', cex = 1)) grid.text(text, x = 0.1, y = 0.6, just = 'left', gp = gpar(fontfamily = 'serif', cex = 1.5)) grid.text(text, x = 0.1, y = 0.8, just = 'left', gp = gpar(fontfamily = 'serif', cex = 2)) popViewport() grid.text(x = 0.9, y = 0.1, label = name, just = 'right', gp = gpar(cex = 2)) invisible(dev.off()) } ragg_text <- knitr::fig_path('.png') text_quality(agg_png, 'ragg', ragg_text) knitr::include_graphics(ragg_text) ragg_text_rot <- knitr::fig_path('.png') text_quality(agg_png, 'ragg', ragg_text_rot, rotation = 27) knitr::include_graphics(ragg_text_rot) cairo_none_text <- knitr::fig_path('.png') text_quality(png, 'cairo no AA', cairo_none_text, type = 'cairo', antialias = 'none') knitr::include_graphics(cairo_none_text) cairo_none_text_rot <- knitr::fig_path('.png') text_quality(png, 'cairo no AA', cairo_none_text_rot, rotation = 27, type = 'cairo', antialias = 'none') knitr::include_graphics(cairo_none_text_rot) cairo_gray_text <- knitr::fig_path('.png') text_quality(png, 'cairo gray AA', cairo_gray_text, type = 'cairo', antialias = 'gray') knitr::include_graphics(cairo_gray_text) cairo_gray_text_rot <- knitr::fig_path('.png') text_quality(png, 'cairo gray AA', cairo_gray_text_rot, rotation = 27, type = 'cairo', antialias = 'gray') knitr::include_graphics(cairo_gray_text_rot) cairo_subpixel_text <- knitr::fig_path('.png') text_quality(png, 'cairo subpixel AA', cairo_subpixel_text, type = 'cairo', antialias = 'subpixel') knitr::include_graphics(cairo_subpixel_text) cairo_subpixel_text_rot <- knitr::fig_path('.png') text_quality(png, 'cairo subpixel AA', cairo_subpixel_text_rot, rotation = 27, type = 'cairo', antialias = 'subpixel') knitr::include_graphics(cairo_subpixel_text_rot)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations-1","dir":"Articles","previous_headings":"Text","what":"Observations","title":"Ragg Quality","text":"Font handling hard… Setting font 'serif' means different things different devices specific results devices able find font. ragg exclusively uses system fonts whatever OS defines base serif type pick . Cairo goes internal R database pick slightly different font. Xlib… well can’t comment , appears pick something completely different X11 system. Regarding quality, don’t think mean mention Xlib, let’s look ragg cairo. Ignoring fact used two different fonts, can see differences interesting stuff. First, cairo don’t care anti-alias setting renders fonts. guess always ask 8-bit pixelmap font engine (probably freetype) use . ensures high quality fonts matter settings. text appears quite heavy, (unless feature font) indicates cairo gamma-correct pixelmap blending image. Correct gamma correction font quite important, case quite sad. Another thing notice cairo uses pixelmaps even rotated text. results jagged baseline uneven kerning plotting rotated text. ragg uses pixelmaps plotting axis-aligned text. rotated text convert glyphs polygons render using built-rasterizer ensuring even baseline kerning. means plotting rotated text slightly less performant, cost looking good — can live trade-.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"alpha-blending","dir":"Articles","previous_headings":"","what":"Alpha blending","title":"Ragg Quality","text":"transparent colours combined necessarily equal among devices. biggest divide whether use premultiplied colours . premultiplied colours red, green, blue intensity weighted alpha directly, instead alpha simply additional value. Using premultiplied colours way get correct alpha blending. Xlib device doesn’t support transparent colours exempt comparison even systems . , alpha blending related anti-aliasing, simply compare ragg single cairo setup.","code":"blend_quality <- function(device, name, file, ...) { device(file, width = 600, height = 300, ...) grid.rect(x = 0.35, y = 0.4, width = 0.5, height = 0.5, gp = gpar(fill = '#FF0000')) grid.rect(x = 0.65, y = 0.6, width = 0.5, height = 0.5, gp = gpar(fill = '#00FF001A')) grid.text(x = 0.9, y = 0.1, label = name, just = 'right', gp = gpar(cex = 2)) invisible(dev.off()) } ragg_blend <- knitr::fig_path('.png') blend_quality(agg_png, 'ragg', ragg_blend) knitr::include_graphics(ragg_blend) cairo_blend <- knitr::fig_path('.png') blend_quality(png, 'cairo', cairo_blend, type = 'cairo') knitr::include_graphics(cairo_blend)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations-2","dir":"Articles","previous_headings":"Alpha blending","what":"Observations","title":"Ragg Quality","text":"Nothing much say — devices handle alpha blending correctly (see understand test ).","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"raster","dir":"Articles","previous_headings":"","what":"Raster","title":"Ragg Quality","text":"main way raster plotting can get influence device image gets interpolated scaling, briefly compared .","code":"raster_quality <- function(device, name, file, ...) { reds <- matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5) device(file, width = 600, height = 300, ...) grid.raster(reds, vp = viewport(0.25, 0.25, 0.5, 0.5, angle = 27)) grid.raster(reds, interpolate = FALSE, vp = viewport(0.75, 0.75, 0.5, 0.5, angle = 27)) grid.text(x = 0.9, y = 0.1, label = name, just = 'right', gp = gpar(cex = 2)) invisible(dev.off()) } ragg_raster <- knitr::fig_path('.png') raster_quality(agg_png, 'ragg', ragg_raster) knitr::include_graphics(ragg_raster) cairo_raster <- knitr::fig_path('.png') raster_quality(png, 'cairo', cairo_raster, type = 'cairo') knitr::include_graphics(cairo_raster)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations-3","dir":"Articles","previous_headings":"Raster","what":"Observations","title":"Ragg Quality","text":"blending nothing much see . devices perform equally correctly.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Ragg Quality","text":"comes raster quality, real contenders ragg anti-aliased cairo, lack anti-aliasing clear detrimental effect output quality. appears real difference quality cairo’s two anti-aliasing modes, question basically boils cairo vs ragg. part two rendering systems provide comparable output, two areas ragg takes lead, quality-wise: rendering fill, rendering rotated text. areas interest ragg obvious choice.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"session-info","dir":"Articles","previous_headings":"","what":"Session info","title":"Ragg Quality","text":"","code":"sessioninfo::session_info() #> ─ Session info ───────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os Ubuntu 22.04.4 LTS #> system x86_64, linux-gnu #> ui X11 #> language en #> collate C.UTF-8 #> ctype C.UTF-8 #> tz UTC #> date 2024-04-30 #> pandoc 3.1.11 @ /opt/hostedtoolcache/pandoc/3.1.11/x64/ (via rmarkdown) #> #> ─ Packages ───────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> bslib 0.7.0 2024-03-29 [1] RSPM #> cachem 1.0.8 2023-05-01 [1] RSPM #> cli 3.6.2 2023-12-11 [1] RSPM #> desc 1.4.3 2023-12-10 [1] RSPM #> digest 0.6.35 2024-03-11 [1] RSPM #> evaluate 0.23 2023-11-01 [1] RSPM #> fastmap 1.1.1 2023-02-24 [1] RSPM #> fs 1.6.4 2024-04-25 [1] RSPM #> highr 0.10 2022-12-22 [1] RSPM #> htmltools 0.5.8.1 2024-04-04 [1] RSPM #> jquerylib 0.1.4 2021-04-26 [1] RSPM #> jsonlite 1.8.8 2023-12-04 [1] RSPM #> knitr 1.46 2024-04-06 [1] RSPM #> lifecycle 1.0.4 2023-11-07 [1] RSPM #> magick * 2.8.3 2024-02-18 [1] RSPM #> magrittr 2.0.3 2022-03-30 [1] RSPM #> memoise 2.0.1 2021-11-26 [1] RSPM #> pkgdown 2.0.9 2024-04-18 [1] RSPM #> purrr 1.0.2 2023-08-10 [1] RSPM #> R6 2.5.1 2021-08-19 [1] RSPM #> ragg * 1.3.0.9000 2024-04-30 [1] local #> Rcpp 1.0.12 2024-01-09 [1] RSPM #> rlang 1.1.3 2024-01-10 [1] RSPM #> rmarkdown 2.26 2024-03-05 [1] RSPM #> sass 0.4.9 2024-03-15 [1] RSPM #> sessioninfo 1.2.2 2021-12-06 [1] RSPM #> systemfonts 1.0.6 2024-03-07 [1] RSPM #> textshaping 0.3.7 2023-10-09 [1] RSPM #> vctrs 0.6.5 2023-12-01 [1] RSPM #> xfun 0.43 2024-03-25 [1] RSPM #> yaml 2.3.8 2023-12-11 [1] RSPM #> #> [1] /home/runner/work/_temp/Library #> [2] /opt/R/4.4.0/lib/R/site-library #> [3] /opt/R/4.4.0/lib/R/library #> #> ────────────────────────────────────────────────────────────────────────"},{"path":"https://ragg.r-lib.org/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Thomas Lin Pedersen. Maintainer, author. Maxim Shemanarev. Author, copyright holder. Author AGG Tony Juricic. Contributor, copyright holder. Contributor AGG Milan Marusinec. Contributor, copyright holder. Contributor AGG Spencer Garrett. Contributor. Contributor AGG . Copyright holder, funder.","code":""},{"path":"https://ragg.r-lib.org/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Pedersen T, Shemanarev M (2024). ragg: Graphic Devices Based AGG. R package version 1.3.0.9000, https://github.com/r-lib/ragg, https://ragg.r-lib.org.","code":"@Manual{, title = {ragg: Graphic Devices Based on AGG}, author = {Thomas Lin Pedersen and Maxim Shemanarev}, year = {2024}, note = {R package version 1.3.0.9000, https://github.com/r-lib/ragg}, url = {https://ragg.r-lib.org}, }"},{"path":"https://ragg.r-lib.org/dev/index.html","id":"ragg-","dir":"","previous_headings":"","what":"Graphic Devices Based on AGG","title":"Graphic Devices Based on AGG","text":"package provides graphic devices R based AGG library developed late Maxim Shemanarev. AGG provides higher performance higher quality standard raster devices provided grDevices. comparison default devices, see performance quality vignettes.","code":""},{"path":"https://ragg.r-lib.org/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Graphic Devices Based on AGG","text":"package can installed CRAN install.packages('ragg') , development version desired, directly github:","code":"# install.packages('pak') pak::pak('r-lib/ragg')"},{"path":"https://ragg.r-lib.org/dev/index.html","id":"use","dir":"","previous_headings":"","what":"Use","title":"Graphic Devices Based on AGG","text":"ragg provides drop-replacements png, jpeg, tiff graphic devices provided default grDevices packages can produce png, jpeg tiff files. Notable features, sets apart build-devices, includes: Faster (40% faster anti-aliased cairo device) Direct access system fonts Advanced text rendering, including support right--left text, emojis, font fallback High quality anti-aliasing High quality rotated text Support 16-bit output System independent rendering (output Mac, Windows, Linux identical) can use like device. main functions agg_png(), agg_jpeg() agg_tiff(), arguments closely match png(), jpeg() tiff() functions, switching easy. , provides agg_capture() device lets access device buffer directly R session.","code":"library(ragg) library(ggplot2) file <- knitr::fig_path('.png') on_linux <- tolower(Sys.info()[['sysname']]) == 'linux' fancy_font <- if (on_linux) 'URW Chancery L' else 'Papyrus' agg_png(file, width = 1000, height = 500, res = 144) ggplot(mtcars) + geom_point(aes(mpg, disp, colour = hp)) + labs(title = 'System fonts — Oh My! 😱') + theme(text = element_text(family = fancy_font)) invisible(dev.off()) knitr::include_graphics(file) cap <- agg_capture(width = 1000, height = 500, res = 144) plot(1:10, 1:10) scatter <- cap() invisible(dev.off()) # Remove margins from raster plotting par(mai = c(0, 0, 0, 0)) plot(as.raster(scatter))"},{"path":"https://ragg.r-lib.org/dev/index.html","id":"use-ragg-with-knitr","dir":"","previous_headings":"Use","what":"Use ragg with knitr","title":"Graphic Devices Based on AGG","text":"knitr supports png output ragg setting dev = \"ragg_png\" chunk settings globally knitr::opts_chunk$set(dev = \"ragg_png\").","code":""},{"path":"https://ragg.r-lib.org/dev/index.html","id":"use-ragg-in-rstudio","dir":"","previous_headings":"Use","what":"Use ragg in RStudio","title":"Graphic Devices Based on AGG","text":"ragg can used graphic back-end RStudio device (RStudio >= 1.4) choosing AGG backend graphics pane general options (see screenshot) Setting ragg backend RStudio","code":""},{"path":"https://ragg.r-lib.org/dev/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Graphic Devices Based on AGG","text":"Please note ‘ragg’ project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a buffer that can be accessed directly — agg_capture","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"Usually point using graphic device create file show graphic screen. times need image data processing R, instead writing file reading back R `agg_capture()` device lets get image data directly buffer. contrast devices device returns function, called return current state buffer.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"","code":"agg_capture( width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"width, height dimensions device units unit `width` `height` measured , either pixels (`'px'`), inches (`''`), millimeters (`'mm'`), centimeter (`'cm'`). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase `scaling` argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. bg `background` compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"function called returns current state buffer. return value function depends `native` argument. `FALSE` (default) return value `matrix` colour values `TRUE` return value `nativeRaster` object.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"","code":"cap <- agg_capture() plot(1:10, 1:10) # Get the plot as a matrix raster <- cap() # Get the plot as a nativeRaster raster_n <- cap(native = TRUE) dev.off() #> agg_png #> 2 # Look at the output plot(as.raster(raster))"},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a JPEG file — agg_jpeg","title":"Draw to a JPEG file — agg_jpeg","text":"JPEG file format lossy compressed file format developed particular digital photography. format particularly well-suited line drawings text type normally associated statistical plots compression algorithm creates noticable artefacts. , however, great saving image data, e.g. heightmaps etc. Thus, standard plots, better use [agg_png()], plots includes high degree raster image rendering device result smaller plots little quality degradation.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a JPEG file — agg_jpeg","text":"","code":"agg_jpeg( filename = \"Rplot%03d.jpeg\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, quality = 75, smoothing = FALSE, method = \"slow\", bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a JPEG file — agg_jpeg","text":"filename name file. Follows semantics file naming [grDevices::png()], meaning can provide [sprintf()] compliant string format name multiple plots (default value) width, height dimensions device units unit `width` `height` measured , either pixels (`'px'`), inches (`''`), millimeters (`'mm'`), centimeter (`'cm'`). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase `scaling` argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. quality integer `0` `100` defining quality/size tradeoff. Setting `100` result compression. smoothing smoothing factor apply compression, `0` (smoothing) `100` (full smoothing). Can also `FALSE` (smoothing) `TRUE` (full smoothing). method compression algorithm use. Either `'slow'`, `'fast'`, `'float'`. Default `'slow'` works best cases. `'fast'` used quality `97` may result worse performance high quality settings. `'float'` legacy options calculate compression using floating point precission instead integers. offers quality benefit often much slower. bg `background` compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Draw to a JPEG file — agg_jpeg","text":"Smoothing applied ragg compiled jpeg library supports smoothing.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a JPEG file — agg_jpeg","text":"","code":"file <- tempfile(fileext = '.jpeg') agg_jpeg(file, quality = 50) plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a PNG file — agg_png","title":"Draw to a PNG file — agg_png","text":"PNG (Portable Network Graphic) format one ubiquitous today, due versatiliity widespread support. supports transparency well 8 16 bit colour. device uses default compression filtering use colour palette less useful antialiased data. means might possible compress resulting image even size concern (though defaults often good). contrast [grDevices::png()] date time written file, meaning similar plot code produce identical files (good feature used version control). , however, write dimensions image based `res` argument.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a PNG file — agg_png","text":"","code":"agg_png( filename = \"Rplot%03d.png\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, bitsize = 8, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a PNG file — agg_png","text":"filename name file. Follows semantics file naming [grDevices::png()], meaning can provide [sprintf()] compliant string format name multiple plots (default value) width, height dimensions device units unit `width` `height` measured , either pixels (`'px'`), inches (`''`), millimeters (`'mm'`), centimeter (`'cm'`). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase `scaling` argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. bitsize device record colour 8 16bit bg `background` compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a PNG file — agg_png","text":"","code":"file <- tempfile(fileext = '.png') agg_png(file) plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a PPM file — agg_ppm","title":"Draw to a PPM file — agg_ppm","text":"PPM (Portable Pixel Map) format defines one simplest storage formats available image data. basically raw 8bit RGB stream bytes information start. goes without saying, file format horribly inefficient used want play around simple file format, need file-based image stream.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a PPM file — agg_ppm","text":"","code":"agg_ppm( filename = \"Rplot%03d.ppm\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a PPM file — agg_ppm","text":"filename name file. Follows semantics file naming [grDevices::png()], meaning can provide [sprintf()] compliant string format name multiple plots (default value) width, height dimensions device units unit `width` `height` measured , either pixels (`'px'`), inches (`''`), millimeters (`'mm'`), centimeter (`'cm'`). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase `scaling` argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. bg `background` compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a PPM file — agg_ppm","text":"","code":"file <- tempfile(fileext = '.ppm') agg_ppm(file) plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/agg_supertransparent.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","title":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","text":"graphic engine R supports 8bit colours. part fine, 8bit gives fidelity needed graphing needs. However, may become limitation need plot thousands translucent shapes top . 8bit afford minimum 1/255 alpha, may end accumulating fully opaque point. device allows create 16bit device modifies alpha level incomming colours fixed multiplier, thus allowing much translucent colours. device modify transparent colour, pass opaque colour left unchanged.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_supertransparent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","text":"","code":"agg_supertransparent( filename = \"Rplot%03d.png\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, alpha_mod = 1, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_supertransparent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","text":"filename name file. Follows semantics file naming [grDevices::png()], meaning can provide [sprintf()] compliant string format name multiple plots (default value) width, height dimensions device units unit `width` `height` measured , either pixels (`'px'`), inches (`''`), millimeters (`'mm'`), centimeter (`'cm'`). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase `scaling` argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. alpha_mod numeric 0 1 multiplied alpha channel transparent colours bg `background` compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a TIFF file — agg_tiff","title":"Draw to a TIFF file — agg_tiff","text":"TIFF (Tagged Image File Format) format versatile raster image storage format supports 8 16bit colour mode, true transparency, well range features relevant drawing R (e.g. support different colour spaces). storage mode image data fixed different compression modes possible, contrast PNGs one-approach-fits-. default (uncompressed) result much larger files PNG, general PNG better format many graphic types produced R. Still, TIFF purposes sometimes file format explicetly requested.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a TIFF file — agg_tiff","text":"","code":"agg_tiff( filename = \"Rplot%03d.tiff\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, compression = \"none\", bitsize = 8, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a TIFF file — agg_tiff","text":"filename name file. Follows semantics file naming [grDevices::png()], meaning can provide [sprintf()] compliant string format name multiple plots (default value) width, height dimensions device units unit `width` `height` measured , either pixels (`'px'`), inches (`''`), millimeters (`'mm'`), centimeter (`'cm'`). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase `scaling` argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. compression compression type use image data. standard options [grDevices::tiff()] function available name. bitsize device record colour 8 16bit bg `background` compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Draw to a TIFF file — agg_tiff","text":"`'jpeg'` compression available ragg compiled version `libtiff` jpeg support turned .","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"transparency","dir":"Reference","previous_headings":"","what":"Transparency","title":"Draw to a TIFF file — agg_tiff","text":"TIFF support true transparency, meaning pixel colour stored pre-multiplied form. contrast pixels stored plain format, alpha values function mask. utility always important, one benefits TIFF PNG noted.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a TIFF file — agg_tiff","text":"","code":"file <- tempfile(fileext = '.tiff') # Use jpeg compression agg_tiff(file, compression = 'lzw+p') plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/ragg-package.html","id":null,"dir":"Reference","previous_headings":"","what":"ragg: Graphic Devices Based on AGG — ragg-package","title":"ragg: Graphic Devices Based on AGG — ragg-package","text":"Anti-Grain Geometry (AGG) high-quality high-performance 2D drawing library. 'ragg' package provides set graphic devices based AGG use alternative raster devices provided 'grDevices' package.","code":""},{"path":[]},{"path":"https://ragg.r-lib.org/dev/reference/ragg-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ragg: Graphic Devices Based on AGG — ragg-package","text":"Maintainer: Thomas Lin Pedersen thomas.pedersen@posit.co (ORCID) Authors: Maxim Shemanarev (Author AGG) [copyright holder] contributors: Tony Juricic tonygeek@yahoo.com (Contributor AGG) [contributor, copyright holder] Milan Marusinec milan@marusinec.sk (Contributor AGG) [contributor, copyright holder] Spencer Garrett (Contributor AGG) [contributor] Posit, PBC [copyright holder, funder]","code":""},{"path":"https://ragg.r-lib.org/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. systemfonts font_feature, register_font, register_variant textshaping get_font_features","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-development-version","dir":"Changelog","previous_headings":"","what":"ragg (development version)","title":"ragg (development version)","text":"Make sure linejoin/linemitre setting honored drawing rectangles (#162) Fix bug resetting clipping group pattern rendering Fix scaling raster glyphs drawGlyph","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-130","dir":"Changelog","previous_headings":"","what":"ragg 1.3.0","title":"ragg 1.3.0","text":"CRAN release: 2024-03-13 Added supported new graphics enigine features: Groups, paths, luminance masks, glyphs Add switch (defaults ) snapping rectangles pixel grid drawn fill (stroke) Fixed bug causing repeated warnings using font 0 size (#130) Silence bug clang-ASAN incorrectly reported sanitiser issues","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-127","dir":"Changelog","previous_headings":"","what":"ragg 1.2.7","title":"ragg 1.2.7","text":"CRAN release: 2023-12-11 Fix stack imbalance bug","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-126","dir":"Changelog","previous_headings":"","what":"ragg 1.2.6","title":"ragg 1.2.6","text":"CRAN release: 2023-10-10 Fix symbol rendering bug windows (#132) Add support dev.capabilities() (#105) Prepare Arm Windows","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-125","dir":"Changelog","previous_headings":"","what":"ragg 1.2.5","title":"ragg 1.2.5","text":"CRAN release: 2023-01-12 Fix bug rendering glyphs colour font also provide greyscale glyphs (#105) Move sprintf() snprintf() AGG source code comply Arm64 deprecation Better guard bad input (#116)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-124","dir":"Changelog","previous_headings":"","what":"ragg 1.2.4","title":"ragg 1.2.4","text":"CRAN release: 2022-10-24 Fixed regression turned line mitre support (#119)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-123","dir":"Changelog","previous_headings":"","what":"ragg 1.2.3","title":"ragg 1.2.3","text":"CRAN release: 2022-09-29 Second attempt rendering jpegs transparent background. Now, buffer filled solid white drawing happens. Fixed bug resulted newlines rendered missing glyphs Linux versions (#111)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-122","dir":"Changelog","previous_headings":"","what":"ragg 1.2.2","title":"ragg 1.2.2","text":"CRAN release: 2022-02-21 MacOS: configure script now uses local system dependencies provided CRAN via pkg-config. Autobrew libs used fallback non-cran servers .","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-121","dir":"Changelog","previous_headings":"","what":"ragg 1.2.1","title":"ragg 1.2.1","text":"CRAN release: 2021-12-06 Fix bug caused R crash writing tiff files transparent background (#97)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-120","dir":"Changelog","previous_headings":"","what":"ragg 1.2.0","title":"ragg 1.2.0","text":"CRAN release: 2021-10-30 Arbitrary clipping paths Alpha masks Linear radial gradients Tiling patterns Use white background passing fully transparent background colour devices doesn’t support alpha (notably jpeg) (#91) ragg now defers symbol font resolving systemfonts makes possible register alternative symbol fonts using register_font() (#90) Filenames UTF-8 now treated correctly Windows (#87) Fix size selection non-scalable fonts requested size bigger available","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-113","dir":"Changelog","previous_headings":"","what":"ragg 1.1.3","title":"ragg 1.1.3","text":"CRAN release: 2021-06-09 Use int32_t instead int32 old code Prepare UCRT Better error message failing allocate memory buffer (#82) Increase storage size limits paths (#80)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-112","dir":"Changelog","previous_headings":"","what":"ragg 1.1.2","title":"ragg 1.1.2","text":"CRAN release: 2021-03-17 Fix bug agg_capture() resulted premultiplied colour values returned","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-111","dir":"Changelog","previous_headings":"","what":"ragg 1.1.1","title":"ragg 1.1.1","text":"CRAN release: 2021-02-25 Fix bug glyph dimension lookup cause system crashes Fix bug font caching multiple ragg devices used simultaneously","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-110","dir":"Changelog","previous_headings":"","what":"ragg 1.1.0","title":"ragg 1.1.0","text":"CRAN release: 2021-02-15 Major version release signify much improved text support includes full support right--left scripts bidirectional text (mix RtL LtR scripts). adds full support OpenType features non-scalable fonts. Re-exporting register_font(), register_variant(), font_feature() systemfonts Re-exporting get_font_features() textshaping Use new textshaping API handle font fallback correctly Add support rendering colour fonts (#1)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-041","dir":"Changelog","previous_headings":"","what":"ragg 0.4.1","title":"ragg 0.4.1","text":"CRAN release: 2021-01-11 Skip text tests CRAN text plottet CRAN solaris machine Fixed bug resulting system crash certain systems, well clang-ASAN error. (#59)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-040","dir":"Changelog","previous_headings":"","what":"ragg 0.4.0","title":"ragg 0.4.0","text":"CRAN release: 2020-10-05 ragg now requires Harfbuzz Fribidi libraries available installing source due dependency textshaping package. Move text shaping new textshaping package. Fix agg_capture() big endian systems (#49, @QuLogic) Fix use symbol font Windows moving Segoe UI Symbol Unicode charmap (#51) Better compatibility knitr ggplot2::ggsave()","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-031","dir":"Changelog","previous_headings":"","what":"ragg 0.3.1","title":"ragg 0.3.1","text":"CRAN release: 2020-07-03 Roll back support new clipping options graphic engine buggy.","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-030","dir":"Changelog","previous_headings":"","what":"ragg 0.3.0","title":"ragg 0.3.0","text":"CRAN release: 2020-06-24 Fix bug plotting partially transparent raster (#44) Add scaling argument devices allowing change relative scaling output. Horizontal vertical text now snapped pixel grid order improve rendering quality. Internal changes prepare coming updates graphic engine","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-020","dir":"Changelog","previous_headings":"","what":"ragg 0.2.0","title":"ragg 0.2.0","text":"CRAN release: 2020-05-14 Fix compilation R <= 3.3 including Rdynload.h explicitly Fix performance regression plotting text (#33) Fix erroneous width calculations strings starting space windows (#32) Fix bug agg_capture() output became mangled device height != width Fix bug raster support raster data get premultiplied rendering (#38, @yixuan) Fix integer overflow issue AGG source code","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-015","dir":"Changelog","previous_headings":"","what":"ragg 0.1.5","title":"ragg 0.1.5","text":"CRAN release: 2020-03-04 Fix compilation macOS","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-014","dir":"Changelog","previous_headings":"","what":"ragg 0.1.4","title":"ragg 0.1.4","text":"CRAN release: 2020-02-25 Fix bug AGG’s font manager ignored font index stored retrieved cached faces","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-013","dir":"Changelog","previous_headings":"","what":"ragg 0.1.3","title":"ragg 0.1.3","text":"CRAN release: 2019-08-28 Fix bug preventing ragg displaying 50% transparent black Another attempt fixing compilation mac build machines","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-012","dir":"Changelog","previous_headings":"","what":"ragg 0.1.2","title":"ragg 0.1.2","text":"CRAN release: 2019-07-30 Fix compilation certain Linux systems preferring dynamic libraries static ones (#25, @jimhester).","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-011","dir":"Changelog","previous_headings":"","what":"ragg 0.1.1","title":"ragg 0.1.1","text":"CRAN release: 2019-07-29 Avoid bug call start device included many characters (#16) Fix integer overflow runtime errors agg source code (agg_scanline_storage_aa.h), changing storage long Remove benchmarking vignettes causing much trouble stripped systems… still available https://ragg.r-lib.org Better build setup properly build macOS systems","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-010","dir":"Changelog","previous_headings":"","what":"ragg 0.1.0","title":"ragg 0.1.0","text":"CRAN release: 2019-07-15 Basic setup package. png, tiff, ppm, buffer capture support Added NEWS.md file track changes package.","code":""}] +[{"path":[]},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement codeofconduct@posit.co. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://ragg.r-lib.org/dev/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://ragg.r-lib.org/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 ragg authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"opening-and-closing","dir":"Articles","previous_headings":"","what":"Opening and closing","title":"Ragg Performance","text":"subsequent benchmarks omit opening closing device instead focus rendering performance. important, potentially time-consuming, part opening closing device allocation buffer write raster information , serialising buffer file. also performance differences e.g. png tiff come . ragg grDevices use underlying libraries write png files (libpng) expected much difference. can seen, clear cut seems. ragg cairo_png equivalent performance, Cairo twice fast. Xlib hand even slower. Looking produced files can see ragg cairo_png produce files around 2 KB, whereas cairo produces files around 300 B XLib around 6 KB. differences can thus ascribed disk write speed anything, probably due different compression filtering settings used. ragg uses default heuristics libpng, guess cairo_png uses well. white rectangle (produced plot.new()) amenable lot compression possible cairo tuned . likely advantage disappear complex plots difficult test without inflating rendering speed.","code":"file <- tempfile(fileext = '.png') res <- bench::mark( ragg = {agg_png(file); plot.new(); dev.off()}, cairo = {png(file, type = 'cairo'); plot.new(); dev.off()}, cairo_png = {png(file, type = 'cairo-png'); plot.new(); dev.off()}, Xlib = if (has_xlib) {png(file, type = 'Xlib'); plot.new(); dev.off()} else NULL, check = FALSE ) if (!has_xlib) { res <- res[-4, ] attr(res$expression, 'description') <- attr(res$expression, 'description')[-4] } plot(res, type = 'ridge') + ggtitle('Open and close performance')"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"rendering","dir":"Articles","previous_headings":"Opening and closing","what":"Rendering","title":"Ragg Performance","text":"graphic device provides range methods R’s graphic engine use receives plotting instructions user. performant methods , performant graphic device whole. range anti-aliasing options grDevices increases , ragg settings always draw subpixel antialiasing. attempt benchmark device methods constructing direct possible calls . Remember, void_dev() provides baseline.","code":"render_bench <- function(dev_f, ...) { dots <- rlang::enexprs(...) force(dev_f) on.exit(dev.off()) plot.new() rlang::eval_tidy(expr(bench::mark(!!!dots, min_iterations = 10))) } all_render_bench <- function(expr, xlib = TRUE) { file <- tempfile() expr <- rlang::enexpr(expr) res <- list( render_bench(agg_png(file), ragg = !!expr), render_bench(png(file, type = \"cairo\", antialias = 'none'), cairo_none = !!expr), render_bench(png(file, type = \"cairo\", antialias = 'gray'), cairo_gray = !!expr), render_bench(png(file, type = \"cairo\", antialias = 'subpixel'), cairo_subpixel = !!expr), if (has_xlib && xlib) render_bench(png(file, type = \"Xlib\"), xlib = !!expr) else NULL ) expr <- unlist(lapply(res, `[[`, 'expression'), recursive = FALSE) res <- do.call(rbind, res) res$expression <- expr class(res$expression) <- c('bench_expr', 'expression') attr(res$expression, 'description') <- names(res$expression) res$Anti_aliased <- c(TRUE, FALSE, TRUE, TRUE, FALSE)[seq_len(nrow(res))] res } plot_bench <- function(x, title, baseline) { plot(x, type = 'ridge', aes(fill = Anti_aliased)) + facet_null() + geom_vline(xintercept = baseline['elapsed'], linetype = 2, colour = 'grey') + annotate('text', x = baseline['elapsed'], y = -Inf, label = ' baseline', vjust = 0, hjust = 0, colour = 'grey') + scale_fill_brewer(labels = c('No', 'Yes'), type = 'qual') + labs(title = title, fill = 'Anti-aliased', x = NULL, y = NULL) + theme_minimal() + theme(panel.grid.major.y = element_blank(), legend.position = 'bottom') + scale_x_continuous(labels = function(x) {format(bench:::as_bench_time(x))}) }"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"circles","dir":"Articles","previous_headings":"Opening and closing","what":"Circles","title":"Ragg Performance","text":"Circles can drawn e.g. grid.circle() often used drawing scatter plots default point type. thus high importance circle drawing performant possible, may get called thousands times creation plot. antialiased devices clear ragg performant. performance gain pronounced unfilled circles due fact cairo doesn’t antialias fill, stroke text. Xlib far performant device, also one rendering lowest quality far (see Rendering quality vignette).","code":"x <- runif(1000) y <- runif(1000) pch <- 1 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Unfilled circle performance', b) pch <- 19 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Filled circle performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"lines","dir":"Articles","previous_headings":"Opening and closing","what":"Lines","title":"Ragg Performance","text":"Lines another fundamental part. can used draw single line segments directly also workhorse different symbol types, e.g. pch = 4, use . , see clear performance difference devices using antialiasing . ragg fastest one using anti-aliasing.","code":"pch <- 4 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Line segment performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"polylines","dir":"Articles","previous_headings":"Opening and closing","what":"Polylines","title":"Ragg Performance","text":"Polylines connected line segments. expect picture lines given operations quite similar. also test different line patterns assess whether differences efficency patterns generated. results quite surprising. general pattern continues, anti-aliasing cairo much slower setups. patterned test, see Xlib slow generating patterned lines completely negates otherwise solid rendering speed leadership (, cost quality).","code":"void_dev() plot.new() b <- system.time(lines(x, y)) invisible(dev.off()) res <- all_render_bench(lines(x, y)) plot_bench(res, 'Connected line performance', b) void_dev() plot.new() b <- system.time(lines(x, y, lty = 4)) invisible(dev.off()) res <- all_render_bench(lines(x, y, lty = 4)) plot_bench(res, 'Patterned connected line performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"rectangles","dir":"Articles","previous_headings":"Opening and closing","what":"Rectangles","title":"Ragg Performance","text":"Rectangle another graphic primitive method. , used plotting certain types points, ’ll test : see new pattern filled rectangles, ragg suddenly slow one. reason cairo apply anti-aliasing fills drawing non anti-aliased filled rectangle extremely simple.","code":"pch <- 0 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Unfilled rectangle performance', b) pch <- 15 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Filled rectangle performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"polygons","dir":"Articles","previous_headings":"Opening and closing","what":"Polygons","title":"Ragg Performance","text":"Polygons general case ’ve seen circles rectangles. certain optimisations may possible e.g. rectanges, polygon method device needs handle cases. used points e.g. triangles, also test performance bigger, complex polygons. findings reflect seen . ragg faster comes drawing lines, loses advantage fill one performing anti-aliasing fill.","code":"pch <- 2 void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Simple polygon performance', b) void_dev() plot.new() b <- system.time(polygon(x, y)) invisible(dev.off()) res <- all_render_bench(polygon(x, y)) plot_bench(res, 'Unfilled complex polygon performance', b) void_dev() plot.new() b <- system.time(polygon(x, y, border = 'gray', col = 'black')) invisible(dev.off()) res <- all_render_bench(polygon(x, y, border = 'gray', col = 'black')) plot_bench(res, 'Filled complex polygon performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"paths","dir":"Articles","previous_headings":"Opening and closing","what":"Paths","title":"Ragg Performance","text":"Paths supercharged versions polygons support holes whatnot. one features added later lifetime R graphic engine devices can thus elect support . , however, including cairo, Xlib. ragg, path rendering implemented way polygon rendering (polygon method special case path method), devices implement something know. path performance mirrors shape rendering. ragg faster comes drawing stroke, speed advantage almost lost shape filled well cairo anti-alias fill. Xlib present path rendering unsupported.","code":"section <- rep(1:10, each = 100) x_path <- unlist(lapply(split(x, section), function(x) c(x, NA))) y_path <- unlist(lapply(split(y, section), function(x) c(x, NA))) x_path <- x_path[-length(x_path)] y_path <- y_path[-length(y_path)] void_dev() plot.new() b <- system.time(polypath(x_path, y_path, rule = 'evenodd')) invisible(dev.off()) res <- all_render_bench(polypath(x_path, y_path, rule = 'evenodd'), xlib = FALSE) plot_bench(res, 'Unfilled path performance', b) void_dev() plot.new() b <- system.time(polypath(x_path, y_path, rule = 'evenodd', border = 'gray', col = 'black')) invisible(dev.off()) res <- all_render_bench(polypath(x_path, y_path, rule = 'evenodd', border = 'gray', col = 'black'), xlib = FALSE) plot_bench(res, 'Filled path performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"raster","dir":"Articles","previous_headings":"Opening and closing","what":"Raster","title":"Ragg Performance","text":"ability draw raster images also one later capabilities added graphic engine. , don’t support , devices look . Raster images can rotated, can interpolated scaling. interpolation happens device specific, ’s lot room quality differences look . Plotting rasters wicked fast appears. non-rotated rasters ragg tiny bit slower cairo, maybe due anti-aliasing edges. loss gained comes rotation, indicating performant affine transformation implementation. Xlib significantly slower , reasons beyond .","code":"raster <- matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE)) plot_bench(res, 'Non-interpolated, non-rotated raster performance', b) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE, angle = 27)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = FALSE, angle = 27)) plot_bench(res, 'Non-interpolated, rotated raster performance', b) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE)) plot_bench(res, 'Interpolated, non-rotated raster performance', b) void_dev() plot.new() b <- system.time(rasterImage(raster, xleft = rep(0.25, 100), ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE, angle = 27)) invisible(dev.off()) res <- all_render_bench(rasterImage(raster, xleft = 0.25, ybottom = 0.25, xright = 0.75, ytop = 0.75, interpolate = TRUE, angle = 27)) plot_bench(res, 'Interpolated, rotated raster performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"text","dir":"Articles","previous_headings":"Opening and closing","what":"Text","title":"Ragg Performance","text":"Text data visualisation crucial, one hardest parts implementing graphic device. reflected e.g. inability native devices find system fonts, thus rely e.g. extrafont showtext packages . Anyway, look performance document. Xlib surprises significantly slower font handling anti-aliased peers. ragg slightly faster cairo much. general, text rendering governed much quickly code looks glyphs font database rendering speed.","code":"pch <- \"#\" void_dev() plot.new() b <- system.time(points(x, y, pch = pch)) invisible(dev.off()) res <- all_render_bench(points(x, y, pch = pch)) plot_bench(res, 'Single character performance', b) void_dev() plot.new() b <- system.time(text(x, y, label = 'abcdefghijk')) invisible(dev.off()) res <- all_render_bench(text(x, y, label = 'abcdefghijk')) plot_bench(res, 'Text string performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"complex-example","dir":"Articles","previous_headings":"Opening and closing","what":"Complex example","title":"Ragg Performance","text":"primitives can difficult summarize. general, appears ragg small consistent lead performance among anti-aliased devices safe areas. last benchmark tie together complete graphic made using ggplot2 (don’t worry quality graphic — simply piling layers stuff): prebuild plot mainly rendering measured see complex graphics speed benefit non anti-aliased Xlib device disappears (probably due slow text rendering). Ragg clearly fastest anti-aliased device, noted example deliberately included stroked filled shapes. plotting filled shapes, speed advantage might decrease disappear. Something else haven’t discussed , may affect speed complex graphic clipping speed (drawing elements outside clipping region).","code":"p <- ggplot(diamonds, aes(carat, price)) + geom_hex() + geom_point(shape = 1, size = 0.05, colour = 'white') + geom_smooth() + facet_wrap(~clarity) + labs(title = '5 things you didn\\'t knew about the diamonds dataset', subtitle = 'You won\\'t believe number 4', caption = 'Source: The ggplot2 package') p p <- ggplotGrob(p) void_dev() b <- system.time(plot(p)) invisible(dev.off()) res <- all_render_bench(plot(p)) plot_bench(res, 'Complex composite performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Ragg Performance","text":"One point gather anti-aliasing cost specific situations, even complex tasks. Xlib non anti-aliased cairo almost consistently fastest rendering primitives, though show surprising problems tasks. want anti-aliasing (generally ), ragg consistently fastest options, general speed gain around ~33% compared cairo. places speed gain less, mainly cairo chooses use anti-aliasing fill. decision anti-alias fill questionable opinion. stroke also drawn indeed immaterial whether underlying fill anti-aliased, , unless stroke transparent. stroke drawn result obviously ugly. argued device inspect whether solid stroke going drawn make choice based , line width comes effect well. thin stroke able hide jagged non anti-aliased fill completely result unacceptable visual artefacts. , ragg designed simply always use anti-aliasing. worst, makes performant cairo counterpart, best faster higher quality output.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"advanced-features","dir":"Articles","previous_headings":"","what":"Advanced features","title":"Ragg Performance","text":"graphic engine lately seen lot exciting development, support advanced rendering features gradients, pattern fills, arbitrary clipping paths etc. Support depending device mainly supported Cairo PDF base installation. ragg strive keep new features though may lag behind bit development takes time. new features available grid can’t avoid bit overhead measuring performance .","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"clipping-paths","dir":"Articles","previous_headings":"Advanced features","what":"Clipping paths","title":"Ragg Performance","text":"Clipping paths allows define arbitrary clipping region based complex grob may define. Passing grob clip argument viewport use grob clipping region. can see ragg fares much better cairo comes rendering arbitrary clipping paths. can’t comment cairo implementation works, ragg able perform clipping rasterisation level rather performing boolean operations geometries makes efficient basically surmounts rasterising clipping path areas main graphic getting rendered.","code":"library(grid) clip <- pointsGrob(runif(500), runif(500), default.units = 'npc') segments <- segmentsGrob(runif(100), runif(100), runif(100), runif(100), vp = viewport(clip = clip)) void_dev() plot.new() b <- system.time(grid.draw(segments)) invisible(dev.off()) res <- all_render_bench(grid.draw(segments)) plot_bench(res, 'Complex clip path performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"masks","dir":"Articles","previous_headings":"Advanced features","what":"Masks","title":"Ragg Performance","text":"Masks allow define alpha level layer based information another layer. , can perform things clipping paths , underlying idea different. also requires render whole new canvas creating mask overhead present clipping paths depending resolution device. see , least resolutions tests performed , alpha masks much faster clipping paths ragg cairo - ragg still quite bit faster, cairo’s mask performance faster ragg’s clipping path performance.","code":"mask <- pointsGrob(runif(2000), runif(2000), default.units = 'npc', pch = 16, gp = gpar(col = '#00000077')) segments <- segmentsGrob(runif(100), runif(100), runif(100), runif(100), vp = viewport(mask = mask)) void_dev() plot.new() b <- system.time(grid.draw(segments)) invisible(dev.off()) res <- all_render_bench(grid.draw(segments)) plot_bench(res, 'Complex mask performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"gradients","dir":"Articles","previous_headings":"Advanced features","what":"Gradients","title":"Ragg Performance","text":"Gradients allow produce smooth transition range colours, either along line radial manner. Gradients performing par ragg cairo. Beware gradients defined vectorised manner elements grob share gradient. means drawing 2000 circles separate gradients much slower drawing shared gradient create draw grob .","code":"circles <- circleGrob(runif(2000), runif(2000), r = unit(0.5, 'char'), gp = gpar(fill = linearGradient(c('black', 'transparent', 'blue')))) void_dev() plot.new() b <- system.time(grid.draw(circles)) invisible(dev.off()) res <- all_render_bench(grid.draw(circles)) plot_bench(res, 'Gradient performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"patterns","dir":"Articles","previous_headings":"Advanced features","what":"Patterns","title":"Ragg Performance","text":"Patterns another fill type alongside gradients. can take grob rendered separate canvas used fill different extend modes (repeat, reflect, pad, etc.) see clear performance upper-hand ragg. caveats apply gradients patterns, unfortunately, using multiple different patterns considerable overhead multiple grobs need created.","code":"segments <- segmentsGrob(runif(1000), runif(1000), runif(1000), runif(1000), gp = gpar(col = sample(palette(), 1000, TRUE))) pat <- pattern(segments, width = 0.1, height = 0.1, extend = 'reflect') circles <- circleGrob(runif(1000), runif(1000), r = unit(1, 'char'), gp = gpar(fill = pat)) void_dev() plot.new() b <- system.time(grid.draw(circles)) invisible(dev.off()) res <- all_render_bench(grid.draw(circles)) plot_bench(res, 'Pattern performance', b)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_performance.html","id":"session-info","dir":"Articles","previous_headings":"","what":"Session info","title":"Ragg Performance","text":"","code":"sessioninfo::session_info() #> ─ Session info ───────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os Ubuntu 22.04.4 LTS #> system x86_64, linux-gnu #> ui X11 #> language en #> collate C.UTF-8 #> ctype C.UTF-8 #> tz UTC #> date 2024-05-06 #> pandoc 3.1.11 @ /opt/hostedtoolcache/pandoc/3.1.11/x64/ (via rmarkdown) #> #> ─ Packages ───────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> bench 1.1.3 2023-05-04 [1] RSPM #> bslib 0.7.0 2024-03-29 [1] RSPM #> cachem 1.0.8 2023-05-01 [1] RSPM #> cli 3.6.2 2023-12-11 [1] RSPM #> colorspace 2.1-0 2023-01-23 [1] RSPM #> desc 1.4.3 2023-12-10 [1] RSPM #> devoid * 0.1.2 2023-04-25 [1] RSPM #> digest 0.6.35 2024-03-11 [1] RSPM #> dplyr 1.1.4 2023-11-17 [1] RSPM #> evaluate 0.23 2023-11-01 [1] RSPM #> fansi 1.0.6 2023-12-08 [1] RSPM #> farver 2.1.1 2022-07-06 [1] RSPM #> fastmap 1.1.1 2023-02-24 [1] RSPM #> fs 1.6.4 2024-04-25 [1] RSPM #> generics 0.1.3 2022-07-05 [1] RSPM #> ggplot2 * 3.5.1 2024-04-23 [1] RSPM #> ggridges 0.5.6 2024-01-23 [1] RSPM #> glue 1.7.0 2024-01-09 [1] RSPM #> gtable 0.3.5 2024-04-22 [1] RSPM #> hexbin 1.28.3 2023-03-21 [1] RSPM #> highr 0.10 2022-12-22 [1] RSPM #> htmltools 0.5.8.1 2024-04-04 [1] RSPM #> jquerylib 0.1.4 2021-04-26 [1] RSPM #> jsonlite 1.8.8 2023-12-04 [1] RSPM #> knitr 1.46 2024-04-06 [1] RSPM #> labeling 0.4.3 2023-08-29 [1] RSPM #> lattice 0.22-6 2024-03-20 [3] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] RSPM #> magrittr 2.0.3 2022-03-30 [1] RSPM #> Matrix 1.7-0 2024-03-22 [3] CRAN (R 4.4.0) #> memoise 2.0.1 2021-11-26 [1] RSPM #> mgcv 1.9-1 2023-12-21 [3] CRAN (R 4.4.0) #> munsell 0.5.1 2024-04-01 [1] RSPM #> nlme 3.1-164 2023-11-27 [3] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] RSPM #> pkgconfig 2.0.3 2019-09-22 [1] RSPM #> pkgdown 2.0.9 2024-04-18 [1] RSPM #> profmem 0.6.0 2020-12-13 [1] RSPM #> purrr 1.0.2 2023-08-10 [1] RSPM #> R6 2.5.1 2021-08-19 [1] RSPM #> ragg * 1.3.0.9000 2024-05-06 [1] local #> RColorBrewer 1.1-3 2022-04-03 [1] RSPM #> rlang 1.1.3 2024-01-10 [1] RSPM #> rmarkdown 2.26 2024-03-05 [1] RSPM #> sass 0.4.9 2024-03-15 [1] RSPM #> scales 1.3.0 2023-11-28 [1] RSPM #> sessioninfo 1.2.2 2021-12-06 [1] any (@1.2.2) #> systemfonts 1.0.6 2024-03-07 [1] RSPM #> textshaping 0.3.7 2023-10-09 [1] RSPM #> tibble 3.2.1 2023-03-20 [1] RSPM #> tidyr 1.3.1 2024-01-24 [1] RSPM #> tidyselect 1.2.1 2024-03-11 [1] RSPM #> utf8 1.2.4 2023-10-22 [1] RSPM #> vctrs 0.6.5 2023-12-01 [1] RSPM #> withr 3.0.0 2024-01-16 [1] RSPM #> xfun 0.43 2024-03-25 [1] RSPM #> yaml 2.3.8 2023-12-11 [1] RSPM #> #> [1] /home/runner/work/_temp/Library #> [2] /opt/R/4.4.0/lib/R/site-library #> [3] /opt/R/4.4.0/lib/R/library #> #> ────────────────────────────────────────────────────────────────────────"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"scope","dir":"Articles","previous_headings":"","what":"Scope","title":"Ragg Quality","text":"mainly two areas high importance discussing graphic device quality: Shape rendering (fill stroke) text rendering. highly dependent quality anti-aliasing . Apart also look alpha blending raster interpolation.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"shape-rendering","dir":"Articles","previous_headings":"","what":"Shape rendering","title":"Ragg Quality","text":"examples relevant rendering different types shapes, lines polygons. Lines obviously don’t fill, stroke rendering relevance . chose use circle provides nice sampling uneven edges.","code":"circle_quality <- function(device, name, file, ...) { device(file, width = 600, height = 300, ...) grid.circle( x = c(0.25, 0.75), r = 0.4, gp = gpar(col = c('black', NA), fill = c(NA, 'black'), lwd = 2) ) grid.text(y = 0.1, label = name, gp = gpar(cex = 2)) invisible(dev.off()) } ragg_circle <- knitr::fig_path('.png') circle_quality(agg_png, 'ragg', ragg_circle) knitr::include_graphics(ragg_circle) cairo_none_circle <- knitr::fig_path('.png') circle_quality(png, 'cairo no AA', cairo_none_circle, type = 'cairo', antialias = 'none') knitr::include_graphics(cairo_none_circle) cairo_gray_circle <- knitr::fig_path('.png') circle_quality(png, 'cairo gray AA', cairo_gray_circle, type = 'cairo', antialias = 'gray') knitr::include_graphics(cairo_gray_circle) cairo_subpixel_circle <- knitr::fig_path('.png') circle_quality(png, 'cairo subpixel AA', cairo_subpixel_circle, type = 'cairo', antialias = 'subpixel') knitr::include_graphics(cairo_subpixel_circle)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations","dir":"Articles","previous_headings":"Shape rendering","what":"Observations","title":"Ragg Quality","text":"ragg device provides anti-aliasing fill, results obvious quality differences. reason cairo presumably avoid artefacts shapes touching anti-aliasing can result thin edge two shapes instead contiguous colour. real issue, personally don’t agree allowed degrade overall quality device, hence reason following approach ragg. Xlib (available system), provides completely non anti-aliased output cairo antialias = 'none'. surprising Xlib appears better stroke rendering cairo without anti-aliasing. , difference 'gray' 'subpixel' antialiasing visible naked eye, 2x zoom.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"text","dir":"Articles","previous_headings":"","what":"Text","title":"Ragg Quality","text":"Text difficult thing handle graphic device, terms finding system fonts, terms rendering. Often rendering offloaded another library (e.g. freetype), provide bitmap representation blend device. approach often good horizontal vertical text, struggle rotations. test text rendering different sizes 27° counter-clockwise rotation. use system provided serif font provides complex task sans-serif one.","code":"text_quality <- function(device, name, file, rotation = 0, ...) { text <- 'The quick blue R jumped over the lazy snake' vp <- viewport(angle = rotation) device(file, width = 600, height = 300, ...) pushViewport(vp) grid.text(text, x = 0.1, y = 0.2, just = 'left', gp = gpar(fontfamily = 'serif', cex = 0.5)) grid.text(text, x = 0.1, y = 0.4, just = 'left', gp = gpar(fontfamily = 'serif', cex = 1)) grid.text(text, x = 0.1, y = 0.6, just = 'left', gp = gpar(fontfamily = 'serif', cex = 1.5)) grid.text(text, x = 0.1, y = 0.8, just = 'left', gp = gpar(fontfamily = 'serif', cex = 2)) popViewport() grid.text(x = 0.9, y = 0.1, label = name, just = 'right', gp = gpar(cex = 2)) invisible(dev.off()) } ragg_text <- knitr::fig_path('.png') text_quality(agg_png, 'ragg', ragg_text) knitr::include_graphics(ragg_text) ragg_text_rot <- knitr::fig_path('.png') text_quality(agg_png, 'ragg', ragg_text_rot, rotation = 27) knitr::include_graphics(ragg_text_rot) cairo_none_text <- knitr::fig_path('.png') text_quality(png, 'cairo no AA', cairo_none_text, type = 'cairo', antialias = 'none') knitr::include_graphics(cairo_none_text) cairo_none_text_rot <- knitr::fig_path('.png') text_quality(png, 'cairo no AA', cairo_none_text_rot, rotation = 27, type = 'cairo', antialias = 'none') knitr::include_graphics(cairo_none_text_rot) cairo_gray_text <- knitr::fig_path('.png') text_quality(png, 'cairo gray AA', cairo_gray_text, type = 'cairo', antialias = 'gray') knitr::include_graphics(cairo_gray_text) cairo_gray_text_rot <- knitr::fig_path('.png') text_quality(png, 'cairo gray AA', cairo_gray_text_rot, rotation = 27, type = 'cairo', antialias = 'gray') knitr::include_graphics(cairo_gray_text_rot) cairo_subpixel_text <- knitr::fig_path('.png') text_quality(png, 'cairo subpixel AA', cairo_subpixel_text, type = 'cairo', antialias = 'subpixel') knitr::include_graphics(cairo_subpixel_text) cairo_subpixel_text_rot <- knitr::fig_path('.png') text_quality(png, 'cairo subpixel AA', cairo_subpixel_text_rot, rotation = 27, type = 'cairo', antialias = 'subpixel') knitr::include_graphics(cairo_subpixel_text_rot)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations-1","dir":"Articles","previous_headings":"Text","what":"Observations","title":"Ragg Quality","text":"Font handling hard… Setting font 'serif' means different things different devices specific results devices able find font. ragg exclusively uses system fonts whatever OS defines base serif type pick . Cairo goes internal R database pick slightly different font. Xlib… well can’t comment , appears pick something completely different X11 system. Regarding quality, don’t think mean mention Xlib, let’s look ragg cairo. Ignoring fact used two different fonts, can see differences interesting stuff. First, cairo don’t care anti-alias setting renders fonts. guess always ask 8-bit pixelmap font engine (probably freetype) use . ensures high quality fonts matter settings. text appears quite heavy, (unless feature font) indicates cairo gamma-correct pixelmap blending image. Correct gamma correction font quite important, case quite sad. Another thing notice cairo uses pixelmaps even rotated text. results jagged baseline uneven kerning plotting rotated text. ragg uses pixelmaps plotting axis-aligned text. rotated text convert glyphs polygons render using built-rasterizer ensuring even baseline kerning. means plotting rotated text slightly less performant, cost looking good — can live trade-.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"alpha-blending","dir":"Articles","previous_headings":"","what":"Alpha blending","title":"Ragg Quality","text":"transparent colours combined necessarily equal among devices. biggest divide whether use premultiplied colours . premultiplied colours red, green, blue intensity weighted alpha directly, instead alpha simply additional value. Using premultiplied colours way get correct alpha blending. Xlib device doesn’t support transparent colours exempt comparison even systems . , alpha blending related anti-aliasing, simply compare ragg single cairo setup.","code":"blend_quality <- function(device, name, file, ...) { device(file, width = 600, height = 300, ...) grid.rect(x = 0.35, y = 0.4, width = 0.5, height = 0.5, gp = gpar(fill = '#FF0000')) grid.rect(x = 0.65, y = 0.6, width = 0.5, height = 0.5, gp = gpar(fill = '#00FF001A')) grid.text(x = 0.9, y = 0.1, label = name, just = 'right', gp = gpar(cex = 2)) invisible(dev.off()) } ragg_blend <- knitr::fig_path('.png') blend_quality(agg_png, 'ragg', ragg_blend) knitr::include_graphics(ragg_blend) cairo_blend <- knitr::fig_path('.png') blend_quality(png, 'cairo', cairo_blend, type = 'cairo') knitr::include_graphics(cairo_blend)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations-2","dir":"Articles","previous_headings":"Alpha blending","what":"Observations","title":"Ragg Quality","text":"Nothing much say — devices handle alpha blending correctly (see understand test ).","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"raster","dir":"Articles","previous_headings":"","what":"Raster","title":"Ragg Quality","text":"main way raster plotting can get influence device image gets interpolated scaling, briefly compared .","code":"raster_quality <- function(device, name, file, ...) { reds <- matrix(hcl(0, 80, seq(50, 80, 10)), nrow = 4, ncol = 5) device(file, width = 600, height = 300, ...) grid.raster(reds, vp = viewport(0.25, 0.25, 0.5, 0.5, angle = 27)) grid.raster(reds, interpolate = FALSE, vp = viewport(0.75, 0.75, 0.5, 0.5, angle = 27)) grid.text(x = 0.9, y = 0.1, label = name, just = 'right', gp = gpar(cex = 2)) invisible(dev.off()) } ragg_raster <- knitr::fig_path('.png') raster_quality(agg_png, 'ragg', ragg_raster) knitr::include_graphics(ragg_raster) cairo_raster <- knitr::fig_path('.png') raster_quality(png, 'cairo', cairo_raster, type = 'cairo') knitr::include_graphics(cairo_raster)"},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"observations-3","dir":"Articles","previous_headings":"Raster","what":"Observations","title":"Ragg Quality","text":"blending nothing much see . devices perform equally correctly.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Ragg Quality","text":"comes raster quality, real contenders ragg anti-aliased cairo, lack anti-aliasing clear detrimental effect output quality. appears real difference quality cairo’s two anti-aliasing modes, question basically boils cairo vs ragg. part two rendering systems provide comparable output, two areas ragg takes lead, quality-wise: rendering fill, rendering rotated text. areas interest ragg obvious choice.","code":""},{"path":"https://ragg.r-lib.org/dev/articles/ragg_quality.html","id":"session-info","dir":"Articles","previous_headings":"","what":"Session info","title":"Ragg Quality","text":"","code":"sessioninfo::session_info() #> ─ Session info ───────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os Ubuntu 22.04.4 LTS #> system x86_64, linux-gnu #> ui X11 #> language en #> collate C.UTF-8 #> ctype C.UTF-8 #> tz UTC #> date 2024-05-06 #> pandoc 3.1.11 @ /opt/hostedtoolcache/pandoc/3.1.11/x64/ (via rmarkdown) #> #> ─ Packages ───────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> bslib 0.7.0 2024-03-29 [1] RSPM #> cachem 1.0.8 2023-05-01 [1] RSPM #> cli 3.6.2 2023-12-11 [1] RSPM #> desc 1.4.3 2023-12-10 [1] RSPM #> digest 0.6.35 2024-03-11 [1] RSPM #> evaluate 0.23 2023-11-01 [1] RSPM #> fastmap 1.1.1 2023-02-24 [1] RSPM #> fs 1.6.4 2024-04-25 [1] RSPM #> highr 0.10 2022-12-22 [1] RSPM #> htmltools 0.5.8.1 2024-04-04 [1] RSPM #> jquerylib 0.1.4 2021-04-26 [1] RSPM #> jsonlite 1.8.8 2023-12-04 [1] RSPM #> knitr 1.46 2024-04-06 [1] RSPM #> lifecycle 1.0.4 2023-11-07 [1] RSPM #> magick * 2.8.3 2024-02-18 [1] RSPM #> magrittr 2.0.3 2022-03-30 [1] RSPM #> memoise 2.0.1 2021-11-26 [1] RSPM #> pkgdown 2.0.9 2024-04-18 [1] RSPM #> purrr 1.0.2 2023-08-10 [1] RSPM #> R6 2.5.1 2021-08-19 [1] RSPM #> ragg * 1.3.0.9000 2024-05-06 [1] local #> Rcpp 1.0.12 2024-01-09 [1] RSPM #> rlang 1.1.3 2024-01-10 [1] RSPM #> rmarkdown 2.26 2024-03-05 [1] RSPM #> sass 0.4.9 2024-03-15 [1] RSPM #> sessioninfo 1.2.2 2021-12-06 [1] any (@1.2.2) #> systemfonts 1.0.6 2024-03-07 [1] RSPM #> textshaping 0.3.7 2023-10-09 [1] RSPM #> vctrs 0.6.5 2023-12-01 [1] RSPM #> xfun 0.43 2024-03-25 [1] RSPM #> yaml 2.3.8 2023-12-11 [1] RSPM #> #> [1] /home/runner/work/_temp/Library #> [2] /opt/R/4.4.0/lib/R/site-library #> [3] /opt/R/4.4.0/lib/R/library #> #> ────────────────────────────────────────────────────────────────────────"},{"path":"https://ragg.r-lib.org/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Thomas Lin Pedersen. Maintainer, author. Maxim Shemanarev. Author, copyright holder. Author AGG Tony Juricic. Contributor, copyright holder. Contributor AGG Milan Marusinec. Contributor, copyright holder. Contributor AGG Spencer Garrett. Contributor. Contributor AGG . Copyright holder, funder.","code":""},{"path":"https://ragg.r-lib.org/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Pedersen T, Shemanarev M (2024). ragg: Graphic Devices Based AGG. R package version 1.3.0.9000, https://github.com/r-lib/ragg, https://ragg.r-lib.org.","code":"@Manual{, title = {ragg: Graphic Devices Based on AGG}, author = {Thomas Lin Pedersen and Maxim Shemanarev}, year = {2024}, note = {R package version 1.3.0.9000, https://github.com/r-lib/ragg}, url = {https://ragg.r-lib.org}, }"},{"path":"https://ragg.r-lib.org/dev/index.html","id":"ragg-","dir":"","previous_headings":"","what":"Graphic Devices Based on AGG","title":"Graphic Devices Based on AGG","text":"package provides graphic devices R based AGG library developed late Maxim Shemanarev. AGG provides higher performance higher quality standard raster devices provided grDevices. comparison default devices, see performance quality vignettes.","code":""},{"path":"https://ragg.r-lib.org/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Graphic Devices Based on AGG","text":"package can installed CRAN install.packages('ragg') , development version desired, directly github:","code":"# install.packages('pak') pak::pak('r-lib/ragg')"},{"path":"https://ragg.r-lib.org/dev/index.html","id":"use","dir":"","previous_headings":"","what":"Use","title":"Graphic Devices Based on AGG","text":"ragg provides drop-replacements png, jpeg, tiff graphic devices provided default grDevices packages can produce png, jpeg tiff files. Notable features, sets apart build-devices, includes: Faster (40% faster anti-aliased cairo device) Direct access system fonts Advanced text rendering, including support right--left text, emojis, font fallback High quality anti-aliasing High quality rotated text Support 16-bit output System independent rendering (output Mac, Windows, Linux identical) can use like device. main functions agg_png(), agg_jpeg() agg_tiff(), arguments closely match png(), jpeg() tiff() functions, switching easy. , provides agg_capture() device lets access device buffer directly R session.","code":"library(ragg) library(ggplot2) file <- knitr::fig_path('.png') on_linux <- tolower(Sys.info()[['sysname']]) == 'linux' fancy_font <- if (on_linux) 'URW Chancery L' else 'Papyrus' agg_png(file, width = 1000, height = 500, res = 144) ggplot(mtcars) + geom_point(aes(mpg, disp, colour = hp)) + labs(title = 'System fonts — Oh My! 😱') + theme(text = element_text(family = fancy_font)) invisible(dev.off()) knitr::include_graphics(file) cap <- agg_capture(width = 1000, height = 500, res = 144) plot(1:10, 1:10) scatter <- cap() invisible(dev.off()) # Remove margins from raster plotting par(mai = c(0, 0, 0, 0)) plot(as.raster(scatter))"},{"path":"https://ragg.r-lib.org/dev/index.html","id":"use-ragg-with-knitr","dir":"","previous_headings":"Use","what":"Use ragg with knitr","title":"Graphic Devices Based on AGG","text":"knitr supports png output ragg setting dev = \"ragg_png\" chunk settings globally knitr::opts_chunk$set(dev = \"ragg_png\").","code":""},{"path":"https://ragg.r-lib.org/dev/index.html","id":"use-ragg-in-rstudio","dir":"","previous_headings":"Use","what":"Use ragg in RStudio","title":"Graphic Devices Based on AGG","text":"ragg can used graphic back-end RStudio device (RStudio >= 1.4) choosing AGG backend graphics pane general options (see screenshot) Setting ragg backend RStudio","code":""},{"path":"https://ragg.r-lib.org/dev/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Graphic Devices Based on AGG","text":"Please note ‘ragg’ project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a buffer that can be accessed directly — agg_capture","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"Usually point using graphic device create file show graphic screen. times need image data processing R, instead writing file reading back R agg_capture() device lets get image data directly buffer. contrast devices device returns function, called return current state buffer.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"","code":"agg_capture( width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"width, height dimensions device units unit width height measured , either pixels ('px'), inches (''), millimeters ('mm'), centimeter ('cm'). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase scaling argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. bg background compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"function called returns current state buffer. return value function depends native argument. FALSE (default) return value matrix colour values TRUE return value nativeRaster object.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_capture.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a buffer that can be accessed directly — agg_capture","text":"","code":"cap <- agg_capture() plot(1:10, 1:10) # Get the plot as a matrix raster <- cap() # Get the plot as a nativeRaster raster_n <- cap(native = TRUE) dev.off() #> agg_png #> 2 # Look at the output plot(as.raster(raster))"},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a JPEG file — agg_jpeg","title":"Draw to a JPEG file — agg_jpeg","text":"JPEG file format lossy compressed file format developed particular digital photography. format particularly well-suited line drawings text type normally associated statistical plots compression algorithm creates noticable artefacts. , however, great saving image data, e.g. heightmaps etc. Thus, standard plots, better use agg_png(), plots includes high degree raster image rendering device result smaller plots little quality degradation.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a JPEG file — agg_jpeg","text":"","code":"agg_jpeg( filename = \"Rplot%03d.jpeg\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, quality = 75, smoothing = FALSE, method = \"slow\", bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a JPEG file — agg_jpeg","text":"filename name file. Follows semantics file naming grDevices::png(), meaning can provide sprintf() compliant string format name multiple plots (default value) width, height dimensions device units unit width height measured , either pixels ('px'), inches (''), millimeters ('mm'), centimeter ('cm'). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase scaling argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. quality integer 0 100 defining quality/size tradeoff. Setting 100 result compression. smoothing smoothing factor apply compression, 0 (smoothing) 100 (full smoothing). Can also FALSE (smoothing) TRUE (full smoothing). method compression algorithm use. Either 'slow', 'fast', 'float'. Default 'slow' works best cases. 'fast' used quality 97 may result worse performance high quality settings. 'float' legacy options calculate compression using floating point precission instead integers. offers quality benefit often much slower. bg background compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Draw to a JPEG file — agg_jpeg","text":"Smoothing applied ragg compiled jpeg library supports smoothing.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_jpeg.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a JPEG file — agg_jpeg","text":"","code":"file <- tempfile(fileext = '.jpeg') agg_jpeg(file, quality = 50) plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a PNG file — agg_png","title":"Draw to a PNG file — agg_png","text":"PNG (Portable Network Graphic) format one ubiquitous today, due versatiliity widespread support. supports transparency well 8 16 bit colour. device uses default compression filtering use colour palette less useful antialiased data. means might possible compress resulting image even size concern (though defaults often good). contrast grDevices::png() date time written file, meaning similar plot code produce identical files (good feature used version control). , however, write dimensions image based res argument.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a PNG file — agg_png","text":"","code":"agg_png( filename = \"Rplot%03d.png\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, bitsize = 8, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a PNG file — agg_png","text":"filename name file. Follows semantics file naming grDevices::png(), meaning can provide sprintf() compliant string format name multiple plots (default value) width, height dimensions device units unit width height measured , either pixels ('px'), inches (''), millimeters ('mm'), centimeter ('cm'). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase scaling argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. bitsize device record colour 8 16bit bg background compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_png.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a PNG file — agg_png","text":"","code":"file <- tempfile(fileext = '.png') agg_png(file) plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a PPM file — agg_ppm","title":"Draw to a PPM file — agg_ppm","text":"PPM (Portable Pixel Map) format defines one simplest storage formats available image data. basically raw 8bit RGB stream bytes information start. goes without saying, file format horribly inefficient used want play around simple file format, need file-based image stream.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a PPM file — agg_ppm","text":"","code":"agg_ppm( filename = \"Rplot%03d.ppm\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a PPM file — agg_ppm","text":"filename name file. Follows semantics file naming grDevices::png(), meaning can provide sprintf() compliant string format name multiple plots (default value) width, height dimensions device units unit width height measured , either pixels ('px'), inches (''), millimeters ('mm'), centimeter ('cm'). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase scaling argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. bg background compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_ppm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a PPM file — agg_ppm","text":"","code":"file <- tempfile(fileext = '.ppm') agg_ppm(file) plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/agg_supertransparent.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","title":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","text":"graphic engine R supports 8bit colours. part fine, 8bit gives fidelity needed graphing needs. However, may become limitation need plot thousands translucent shapes top . 8bit afford minimum 1/255 alpha, may end accumulating fully opaque point. device allows create 16bit device modifies alpha level incomming colours fixed multiplier, thus allowing much translucent colours. device modify transparent colour, pass opaque colour left unchanged.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_supertransparent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","text":"","code":"agg_supertransparent( filename = \"Rplot%03d.png\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, alpha_mod = 1, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_supertransparent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a PNG file, modifying transparency on the fly — agg_supertransparent","text":"filename name file. Follows semantics file naming grDevices::png(), meaning can provide sprintf() compliant string format name multiple plots (default value) width, height dimensions device units unit width height measured , either pixels ('px'), inches (''), millimeters ('mm'), centimeter ('cm'). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase scaling argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. alpha_mod numeric 0 1 multiplied alpha channel transparent colours bg background compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw to a TIFF file — agg_tiff","title":"Draw to a TIFF file — agg_tiff","text":"TIFF (Tagged Image File Format) format versatile raster image storage format supports 8 16bit colour mode, true transparency, well range features relevant drawing R (e.g. support different colour spaces). storage mode image data fixed different compression modes possible, contrast PNGs one-approach-fits-. default (uncompressed) result much larger files PNG, general PNG better format many graphic types produced R. Still, TIFF purposes sometimes file format explicetly requested.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw to a TIFF file — agg_tiff","text":"","code":"agg_tiff( filename = \"Rplot%03d.tiff\", width = 480, height = 480, units = \"px\", pointsize = 12, background = \"white\", res = 72, scaling = 1, snap_rect = TRUE, compression = \"none\", bitsize = 8, bg )"},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw to a TIFF file — agg_tiff","text":"filename name file. Follows semantics file naming grDevices::png(), meaning can provide sprintf() compliant string format name multiple plots (default value) width, height dimensions device units unit width height measured , either pixels ('px'), inches (''), millimeters ('mm'), centimeter ('cm'). pointsize default pointsize device pt. general effect grid graphics (including ggplot2) text size always set explicitly . background background colour device res resolution device. setting govern device dimensions given inches, centimeters, millimeters converted pixels. , used scale text sizes linewidths scaling scaling factor apply rendered line width text size. Useful getting right dimensions resolution need. e.g. need render plot 4000x3000 pixels fit layout, find result appears small, can increase scaling argument make everything appear bigger resolution. snap_rect axis-aligned rectangles drawn fill snap pixel grid. prevent anti-aliasing artifacts two rectangles touching border. compression compression type use image data. standard options grDevices::tiff() function available name. bitsize device record colour 8 16bit bg background compatibility old graphic device APIs","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Draw to a TIFF file — agg_tiff","text":"'jpeg' compression available ragg compiled version libtiff jpeg support turned .","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"transparency","dir":"Reference","previous_headings":"","what":"Transparency","title":"Draw to a TIFF file — agg_tiff","text":"TIFF support true transparency, meaning pixel colour stored pre-multiplied form. contrast pixels stored plain format, alpha values function mask. utility always important, one benefits TIFF PNG noted.","code":""},{"path":"https://ragg.r-lib.org/dev/reference/agg_tiff.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw to a TIFF file — agg_tiff","text":"","code":"file <- tempfile(fileext = '.tiff') # Use jpeg compression agg_tiff(file, compression = 'lzw+p') plot(sin, -pi, 2*pi) dev.off() #> agg_png #> 2"},{"path":"https://ragg.r-lib.org/dev/reference/ragg-package.html","id":null,"dir":"Reference","previous_headings":"","what":"ragg: Graphic Devices Based on AGG — ragg-package","title":"ragg: Graphic Devices Based on AGG — ragg-package","text":"Anti-Grain Geometry (AGG) high-quality high-performance 2D drawing library. 'ragg' package provides set graphic devices based AGG use alternative raster devices provided 'grDevices' package.","code":""},{"path":[]},{"path":"https://ragg.r-lib.org/dev/reference/ragg-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ragg: Graphic Devices Based on AGG — ragg-package","text":"Maintainer: Thomas Lin Pedersen thomas.pedersen@posit.co (ORCID) Authors: Maxim Shemanarev (Author AGG) [copyright holder] contributors: Tony Juricic tonygeek@yahoo.com (Contributor AGG) [contributor, copyright holder] Milan Marusinec milan@marusinec.sk (Contributor AGG) [contributor, copyright holder] Spencer Garrett (Contributor AGG) [contributor] Posit, PBC [copyright holder, funder]","code":""},{"path":"https://ragg.r-lib.org/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. systemfonts font_feature, register_font, register_variant textshaping get_font_features","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-development-version","dir":"Changelog","previous_headings":"","what":"ragg (development version)","title":"ragg (development version)","text":"Make sure linejoin/linemitre setting honored drawing rectangles (#162) Fix bug resetting clipping group pattern rendering Fix scaling raster glyphs drawGlyph","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-130","dir":"Changelog","previous_headings":"","what":"ragg 1.3.0","title":"ragg 1.3.0","text":"CRAN release: 2024-03-13 Added supported new graphics enigine features: Groups, paths, luminance masks, glyphs Add switch (defaults ) snapping rectangles pixel grid drawn fill (stroke) Fixed bug causing repeated warnings using font 0 size (#130) Silence bug clang-ASAN incorrectly reported sanitiser issues","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-127","dir":"Changelog","previous_headings":"","what":"ragg 1.2.7","title":"ragg 1.2.7","text":"CRAN release: 2023-12-11 Fix stack imbalance bug","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-126","dir":"Changelog","previous_headings":"","what":"ragg 1.2.6","title":"ragg 1.2.6","text":"CRAN release: 2023-10-10 Fix symbol rendering bug windows (#132) Add support dev.capabilities() (#105) Prepare Arm Windows","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-125","dir":"Changelog","previous_headings":"","what":"ragg 1.2.5","title":"ragg 1.2.5","text":"CRAN release: 2023-01-12 Fix bug rendering glyphs colour font also provide greyscale glyphs (#105) Move sprintf() snprintf() AGG source code comply Arm64 deprecation Better guard bad input (#116)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-124","dir":"Changelog","previous_headings":"","what":"ragg 1.2.4","title":"ragg 1.2.4","text":"CRAN release: 2022-10-24 Fixed regression turned line mitre support (#119)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-123","dir":"Changelog","previous_headings":"","what":"ragg 1.2.3","title":"ragg 1.2.3","text":"CRAN release: 2022-09-29 Second attempt rendering jpegs transparent background. Now, buffer filled solid white drawing happens. Fixed bug resulted newlines rendered missing glyphs Linux versions (#111)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-122","dir":"Changelog","previous_headings":"","what":"ragg 1.2.2","title":"ragg 1.2.2","text":"CRAN release: 2022-02-21 MacOS: configure script now uses local system dependencies provided CRAN via pkg-config. Autobrew libs used fallback non-cran servers .","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-121","dir":"Changelog","previous_headings":"","what":"ragg 1.2.1","title":"ragg 1.2.1","text":"CRAN release: 2021-12-06 Fix bug caused R crash writing tiff files transparent background (#97)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-120","dir":"Changelog","previous_headings":"","what":"ragg 1.2.0","title":"ragg 1.2.0","text":"CRAN release: 2021-10-30 Arbitrary clipping paths Alpha masks Linear radial gradients Tiling patterns Use white background passing fully transparent background colour devices doesn’t support alpha (notably jpeg) (#91) ragg now defers symbol font resolving systemfonts makes possible register alternative symbol fonts using register_font() (#90) Filenames UTF-8 now treated correctly Windows (#87) Fix size selection non-scalable fonts requested size bigger available","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-113","dir":"Changelog","previous_headings":"","what":"ragg 1.1.3","title":"ragg 1.1.3","text":"CRAN release: 2021-06-09 Use int32_t instead int32 old code Prepare UCRT Better error message failing allocate memory buffer (#82) Increase storage size limits paths (#80)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-112","dir":"Changelog","previous_headings":"","what":"ragg 1.1.2","title":"ragg 1.1.2","text":"CRAN release: 2021-03-17 Fix bug agg_capture() resulted premultiplied colour values returned","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-111","dir":"Changelog","previous_headings":"","what":"ragg 1.1.1","title":"ragg 1.1.1","text":"CRAN release: 2021-02-25 Fix bug glyph dimension lookup cause system crashes Fix bug font caching multiple ragg devices used simultaneously","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-110","dir":"Changelog","previous_headings":"","what":"ragg 1.1.0","title":"ragg 1.1.0","text":"CRAN release: 2021-02-15 Major version release signify much improved text support includes full support right--left scripts bidirectional text (mix RtL LtR scripts). adds full support OpenType features non-scalable fonts. Re-exporting register_font(), register_variant(), font_feature() systemfonts Re-exporting get_font_features() textshaping Use new textshaping API handle font fallback correctly Add support rendering colour fonts (#1)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-041","dir":"Changelog","previous_headings":"","what":"ragg 0.4.1","title":"ragg 0.4.1","text":"CRAN release: 2021-01-11 Skip text tests CRAN text plottet CRAN solaris machine Fixed bug resulting system crash certain systems, well clang-ASAN error. (#59)","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-040","dir":"Changelog","previous_headings":"","what":"ragg 0.4.0","title":"ragg 0.4.0","text":"CRAN release: 2020-10-05 ragg now requires Harfbuzz Fribidi libraries available installing source due dependency textshaping package. Move text shaping new textshaping package. Fix agg_capture() big endian systems (#49, @QuLogic) Fix use symbol font Windows moving Segoe UI Symbol Unicode charmap (#51) Better compatibility knitr ggplot2::ggsave()","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-031","dir":"Changelog","previous_headings":"","what":"ragg 0.3.1","title":"ragg 0.3.1","text":"CRAN release: 2020-07-03 Roll back support new clipping options graphic engine buggy.","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-030","dir":"Changelog","previous_headings":"","what":"ragg 0.3.0","title":"ragg 0.3.0","text":"CRAN release: 2020-06-24 Fix bug plotting partially transparent raster (#44) Add scaling argument devices allowing change relative scaling output. Horizontal vertical text now snapped pixel grid order improve rendering quality. Internal changes prepare coming updates graphic engine","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-020","dir":"Changelog","previous_headings":"","what":"ragg 0.2.0","title":"ragg 0.2.0","text":"CRAN release: 2020-05-14 Fix compilation R <= 3.3 including Rdynload.h explicitly Fix performance regression plotting text (#33) Fix erroneous width calculations strings starting space windows (#32) Fix bug agg_capture() output became mangled device height != width Fix bug raster support raster data get premultiplied rendering (#38, @yixuan) Fix integer overflow issue AGG source code","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-015","dir":"Changelog","previous_headings":"","what":"ragg 0.1.5","title":"ragg 0.1.5","text":"CRAN release: 2020-03-04 Fix compilation macOS","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-014","dir":"Changelog","previous_headings":"","what":"ragg 0.1.4","title":"ragg 0.1.4","text":"CRAN release: 2020-02-25 Fix bug AGG’s font manager ignored font index stored retrieved cached faces","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-013","dir":"Changelog","previous_headings":"","what":"ragg 0.1.3","title":"ragg 0.1.3","text":"CRAN release: 2019-08-28 Fix bug preventing ragg displaying 50% transparent black Another attempt fixing compilation mac build machines","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-012","dir":"Changelog","previous_headings":"","what":"ragg 0.1.2","title":"ragg 0.1.2","text":"CRAN release: 2019-07-30 Fix compilation certain Linux systems preferring dynamic libraries static ones (#25, @jimhester).","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-011","dir":"Changelog","previous_headings":"","what":"ragg 0.1.1","title":"ragg 0.1.1","text":"CRAN release: 2019-07-29 Avoid bug call start device included many characters (#16) Fix integer overflow runtime errors agg source code (agg_scanline_storage_aa.h), changing storage long Remove benchmarking vignettes causing much trouble stripped systems… still available https://ragg.r-lib.org Better build setup properly build macOS systems","code":""},{"path":"https://ragg.r-lib.org/dev/news/index.html","id":"ragg-010","dir":"Changelog","previous_headings":"","what":"ragg 0.1.0","title":"ragg 0.1.0","text":"CRAN release: 2019-07-15 Basic setup package. png, tiff, ppm, buffer capture support Added NEWS.md file track changes package.","code":""}]