Page 1 of 1
draw rectangles shows thin lines incorrect on view border
Posted: Sat Dec 15, 2012 3:28 pm
by Nubeat7
hallo, i found out that the new release shows the lines on viewborders wrong, the right and the lower lines are not showed correctly, this you can see with thin lines... this happens only when you look on the module, so it only makes trouble with exporting
Re: draw rectangles shows thin lines incorrect on view borde
Posted: Sat Dec 15, 2012 4:59 pm
by trogluddite
The Rectangle primitive does the same thing too.
I'm pretty sure that the box will always be one pixel 'too big' in each direction, and while I can explain why this is, I can see why it is not what people expect.
Let's say we use all lines 1 pixel thick...
If you drew a box with a width of one pixel, the left hand line will occupy 'column zero' of the grid of pixels. The routine then adds the box width, one, and draws the right hand line in pixel 'column one' - but when viewed, that will look like a box two pixels wide.
So when you draw a box to fill an area, the right hand edge and bottom edge are actually draw in the first row of pixels in the next grid just outside the selected area. And for a wider line, the 'centre' of the line (or outer edge when inset) will still be the row/column one pixel outside the area.
I think this is probably inherent in the Windows GDI+ routines that are used for the GUI drawing - it could be corrected by subtracting one pixel width from each dimension, but that would have to take into account the current zoom level, as this would change the 'grid size' for one pixel.
Re: draw rectangles shows thin lines incorrect on view borde
Posted: Sat Dec 15, 2012 5:25 pm
by MyCo
this is just rounding. It's also accidently, that when you draw something on x=0, and you can see that. Actually x=0 and y=0 should be invisible, but as GDI+ accepts fractional pixel numbers, it is accidently rounded that way that you can see it. To make it correctly, you have to inset your rectangle half of your pen width. So correctly, you have to draw this rectangle:
[penwidth/2, penwidth/2, v.width-penwidth, v.height-penwidth]
Re: draw rectangles shows thin lines incorrect on view borde
Posted: Sat Dec 15, 2012 7:56 pm
by Nubeat7
i see, that is logical when set to inset but shouldn`t be the the middle of a line be exactly on 0 so that everywhere the half thickness of the line is inside? i was shure that it was like this in the first fs3 release but it wasn`t, ... so if i understand right it counts always one pixel to the right and to the bottom also when it is centered?
Re: draw rectangles shows thin lines incorrect on view borde
Posted: Sat Dec 15, 2012 8:02 pm
by MyCo
0 is not the center. 0 is actually between 2 pixels, so when you draw a 1 pixel thick line at this coordinate, GDI+ tries to find the pixels, that it can use. That can either be the next pixel >0 or the next pixel <0. GDI+ rounds up, so you can see this. Same happens for the pixels at v.width and v.height