Closed wez closed 3 years ago
I'm playing with this crate. In this particular scenario I'm rendering a horizontal line into a pixmap that is 8 pixels wide and 16 pixels high. I set the stroke width to 1 pixel, and the line y coordinate is 8.
The resultant bitmap data is:
> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f > 80808080 80808080 80808080 80808080 80808080 80808080 80808080 80808080 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
which looks like the line might be rendering at y = 7.something. This renders as a fainter grey color on screen, which is undesirable.
If I turn off anti-aliasing then the line renders at y = 8 at full intensity.
Is the anti-aliasing behavior a bug, or do I need to do something to manually hint the y position (perhaps offsetting by half the stroke width)?
This is the expected behaviour. Skia produces exactly the same output.
I don't think it can be "fixed".
I'm playing with this crate. In this particular scenario I'm rendering a horizontal line into a pixmap that is 8 pixels wide and 16 pixels high. I set the stroke width to 1 pixel, and the line y coordinate is 8.
The resultant bitmap data is:
which looks like the line might be rendering at y = 7.something. This renders as a fainter grey color on screen, which is undesirable.
If I turn off anti-aliasing then the line renders at y = 8 at full intensity.
Is the anti-aliasing behavior a bug, or do I need to do something to manually hint the y position (perhaps offsetting by half the stroke width)?