Skip to content

linemitre threshold #119

@teunbrand

Description

@teunbrand

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions