[Ruby] Pen Bug/Issue/Annoyance

For general discussion related FlowStone
Post Reply
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

[Ruby] Pen Bug/Issue/Annoyance

Post 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
01.png (8.77 KiB) Viewed 11527 times


It seems to be one pixel too large on the right and bottom. Is it really? Well, let's zoom in...
02.png
02.png (9.6 KiB) Viewed 11527 times
"There lies the dog buried" (German saying translated literally)
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: [Ruby] Pen Bug/Issue/Annoyance

Post by tulamide »

Let's reduce the size by one pixel in width and height, since unzoomed it seems to be too large.
03.png
03.png (8.8 KiB) Viewed 11526 times


Perfect! Or is it? Another zoom will tell:
04.png
04.png (12.84 KiB) Viewed 11526 times
Last edited by tulamide on Sun Apr 24, 2016 11:48 am, edited 1 time in total.
"There lies the dog buried" (German saying translated literally)
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: [Ruby] Pen Bug/Issue/Annoyance

Post by tulamide »

Here's another example with two rectangles, both drawn with brush and pen.
05.png
05.png (9.89 KiB) Viewed 11525 times
06.png
06.png (9.43 KiB) Viewed 11525 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.
"There lies the dog buried" (German saying translated literally)
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: [Ruby] Pen Bug/Issue/Annoyance

Post 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.
Post Reply