ragg icon indicating copy to clipboard operation
ragg copied to clipboard

only draw fill with AA if stroke is drawn

Open thomasp85 opened this issue 2 years ago • 0 comments

Fix #96

This is an attempt to address the issue of neighbouring rectangles having a thin line between them due to anti-aliasing. In the default devices this is handled by never drawing fill with AA, which is extremely heavy-handed and mainly just result in poor quality.

While the issue can arise from all types of polygons, it is most prevalent with axis-oriented rectangles (when it comes to data-viz). Thankfully this is also the case where turning off antialiasing does not result in poor image quality, but at most small imprecisions in the placement of the rectangle (exasperated by low resolution).

The fix proposed here will clip rectangles to the pixel grid (thus turning off AA) if fill is drawn but not stroke. It seems to me this will strike a good balance. It will probably make sense to also have a setting to turn it off, to revert to the old behaviour

thomasp85 avatar Dec 06 '21 11:12 thomasp85