rnote icon indicating copy to clipboard operation
rnote copied to clipboard

Uneven line rendering when zoomed

Open XxRmotion opened this issue 3 months ago • 1 comments

Issue

When the display zoom is not 100%, the renderer computes stroke widths and pixel positions in floating-point device units. That can result in strokes with a physical width less than one device pixel or line centers positioned between pixel centers. The rasterizer therefore distributes intensity across adjacent pixels (sub-pixel sampling / anti-aliasing), causing some or all pattern lines to appear faded or partially transparent instead of solid.

Solution

  • Clamp the stroke width in physical device pixels to a minimum of 1 device pixel.
  • Provide a settings option for logical stroke width.
  • Ensure each logical line includes at least one device pixel drawn at full opacity (for example, draw a 1-pixel wide non-antialiased core pixel or composite an opaque 1-pixel mask under the anti-aliased stroke).

XxRmotion avatar Sep 05 '25 15:09 XxRmotion

The rendering part is mostly based on gtk4 (pushing various RenderNode) and I'm not sure we have the hand on all things related to aliasing here. Even if we do gl rendering instead there's not a 100 % guarantee we'd stay aligned with the pixel grid when fractional scaling is added to the mix ...

On linux with non integer display scaling, you might see more artefacts of that genre because it's floating points operations for the display scaling on top of the floating point operations for the actual canvas.

Doublonmousse avatar Sep 08 '25 17:09 Doublonmousse