If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
draw rectangles shows thin lines incorrect on view border
5 posts
• Page 1 of 1
draw rectangles shows thin lines incorrect on view border
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
- Attachments
-
- rectborders.fsm
- (1.19 KiB) Downloaded 1067 times
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: draw rectangles shows thin lines incorrect on view borde
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.
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.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: draw rectangles shows thin lines incorrect on view borde
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]
[penwidth/2, penwidth/2, v.width-penwidth, v.height-penwidth]
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: draw rectangles shows thin lines incorrect on view borde
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?
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: draw rectangles shows thin lines incorrect on view borde
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
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests