Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linemitre threshold #119

Closed
teunbrand opened this issue Oct 23, 2022 · 2 comments
Closed

linemitre threshold #119

teunbrand opened this issue Oct 23, 2022 · 2 comments

Comments

@teunbrand
Copy link

Hi Thomas and team,

I just noticed that the ragg png and cairo png devices handle linemitre thresholds somewhat differently. This causes the cairo device to bevel the linejoins in the graphic below, whereas ragg does not. I'm no expert on the subject, but I had expected to see bevelled linejoins at linemitre = 1 (the lower limit that {grid} accepts).

Thanks for reading!

library(grid)

grob <- polylineGrob(
  x = seq(0.1, 0.9, length.out = 4),
  y = rep(c(0.1, 0.9), length.out = 4),
  gp = gpar(
    linemitre = 1, lwd = 20,
    linejoin = "mitre"
  )
)

tmp1 <- tempfile(fileext = ".png")
png(tmp1, type = "cairo")
grid.newpage() 
grid.draw(grob)
dev.off()
#> png 
#>   2
knitr::include_graphics(tmp1)

tmp2 <- tempfile(fileext = ".png")
ragg::agg_png(tmp2)
grid.newpage()
grid.draw(grob)
dev.off()
#> png 
#>   2
knitr::include_graphics(tmp2)

Created on 2022-10-24 by the reprex package (v2.0.1)

@thomasp85
Copy link
Member

Thanks for noticing - this is a regression due to some refactoring of the rendering code

@teunbrand
Copy link
Author

Great, thanks Thomas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants