r-lib/ragg

rectangles ignore `linejoin` settings

Closed this issue · 1 comments

Hi Thomas,

In the new version of ragg, rectangles (not polygons in general) appear to ignore the linejoin setting.
When specifying a rectangle with linejoin = "mitre", I expected straight corners, but rounded corners show up.

library(grid)
tmp1 <- tempfile(fileext = ".png")
tmp2 <- tempfile(fileext = ".png")

draw_rect <- function() {
  grid.newpage()
  grid.rect(
    width = 0.5, height = 0.5,
    gp = gpar(lwd = 20, linejoin = "mitre")
  )
}

ragg::agg_png(tmp1)
draw_rect()
dev.off()
#> png 
#>   2
knitr::include_graphics(tmp1)

For reference how I expected the rectangle to look like:

png(tmp2, type = "cairo-png")
draw_rect()
dev.off()
#> png 
#>   2
knitr::include_graphics(tmp2)

Created on 2024-03-14 with reprex v2.1.0

weird - I was sure I fixed that... Thanks for the report, I'll do it properly this time