Page 1 of 1
[Ruby] Pen Bug/Issue/Annoyance
Posted: Sun Apr 24, 2016 11:45 am
by tulamide
It isn't important if it is a bug or an annoyance, but it needs to be addressed.
There are times when you need to draw pixel-accurate. Unfortunately the brush and the pen act differently, and the brush is the one that acts correct.
Let's have a look at a rectangle drawn two times, first with the brush, then with a pen. The pen is aligned "inset", which means it should behave just like the brush (no pixel border crossing, full size)

- 01.png (8.77 KiB) Viewed 11522 times
It seems to be one pixel too large on the right and bottom. Is it really? Well, let's zoom in...

- 02.png (9.6 KiB) Viewed 11522 times
Re: [Ruby] Pen Bug/Issue/Annoyance
Posted: Sun Apr 24, 2016 11:45 am
by tulamide
Let's reduce the size by one pixel in width and height, since unzoomed it seems to be too large.

- 03.png (8.8 KiB) Viewed 11521 times
Perfect! Or is it? Another zoom will tell:

- 04.png (12.84 KiB) Viewed 11521 times
Re: [Ruby] Pen Bug/Issue/Annoyance
Posted: Sun Apr 24, 2016 11:45 am
by tulamide
Here's another example with two rectangles, both drawn with brush and pen.

- 05.png (9.89 KiB) Viewed 11520 times

- 06.png (9.43 KiB) Viewed 11520 times
And now the issue becomes apparent. The larger pen rectangle seems to only draw half as thick on the right and bottom! Which let's me assume that "inset" doesn't really inset, but just moves the starting point by 50% to the right and bottom, and then clips to the full size.
I had a lot of problems because of that behavior. For example, on the 1:1 zoom-level it will snap to pixels, which means that sometimes the lines right/bottom are drawn, sometimes not. Especially if the values aren't as acurate as in this example.
Please consider this being a bug and change its behavior.
Re: [Ruby] Pen Bug/Issue/Annoyance
Posted: Mon Apr 25, 2016 3:46 am
by Tronic
Sigh...
I do not think is direct related to Pen method,
I get the same problem even if drawing two rectangle filled, and clip them to just have the edge,
the same annoying results,
I believe that the problem is how it is clipped in origin, and not by our commands,
it seems to have a error of calculation of the actual area to draw.