[cairo] Polyline overshoot

Uli Schlachter psychon at znc.in
Wed Mar 9 15:55:50 UTC 2022


Hi,

Am 09.03.22 um 14:34 schrieb Frans Meulenbroeks:
[...]
> However when I look at the resulting image I get things like the image below.
> E.g. I am not very happy with the pixel at 798, 205 as I am drawing no lines with x < 800 at all.As these are measurement results I would like to see less overshoot.As you can see from the code above I already added 0.5 to the coordinates.Is there a way to improve this? Or where is my expectation wrong?

I tried to turn your code sample into an executable program. The result
is attached (I also guess a line width of 1). Next I also guessed that
this is due to a line join. The default join is miter, which is
documented as:

 * @CAIRO_LINE_JOIN_MITER: use a sharp (angled) corner, see
 * cairo_set_miter_limit() (Since 1.0)

I set the line join to round and the result changed. This is already
done in the attached program.

> PS: this is all rendered using an ARGB32 surface of 1920x1080 pixels

I went with a 15x15 image. And with RGB24 since my image viewer would
otherwise not tell me where the top left corner of the image is.

Cheers,
Uli
-- 
"In the beginning the Universe was created. This has made a lot of
 people very angry and has been widely regarded as a bad move."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.png
Type: image/png
Size: 135 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20220309/d04b19b3/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c
Type: text/x-csrc
Size: 923 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20220309/d04b19b3/attachment.c>


More information about the cairo mailing list