crisp lines and floating point
Hi,
I need a sanity check from you, my fellow Inkscape users, if you don't mind:
Draw a 1 px straight vertical line using the pen tool, holding down Ctrl to make sure it's straight.
Is there any way to do this such that the line does not end up on an X value that is X.5, where X is any integer?
Same for a 1 px straight horizontal line - no matter where I click, no matter which snapping options I enable, that sucker will only land on Y values of something + 0.5.
Is this right? Is there anyway to avoid this? I've trained myself to manually go in and delete the 0.5 and not even think about it, but I'm trying to explain something to a new Inkscape user and I feel quite silly explaining my odd way of going in to the X and Y coordinate boxes and erasing the .5 off the end of the number to her.
Thanks, ~m
On 16-4-2012 2:28, Máirín Duffy wrote:
Hi,
I need a sanity check from you, my fellow Inkscape users, if you don't mind:
Draw a 1 px straight vertical line using the pen tool, holding down Ctrl to make sure it's straight.
Is there any way to do this such that the line does not end up on an X value that is X.5, where X is any integer?
Same for a 1 px straight horizontal line - no matter where I click, no matter which snapping options I enable, that sucker will only land on Y values of something + 0.5.
Is this right? Is there anyway to avoid this? I've trained myself to manually go in and delete the 0.5 and not even think about it, but I'm trying to explain something to a new Inkscape user and I feel quite silly explaining my odd way of going in to the X and Y coordinate boxes and erasing the .5 off the end of the number to her.
I guess you are using the "visual bounding box" (preferences -> tools). The path itself is at an integer coordinate. But because the stroke width is 1 px, the path spills out 0.5 px on both sides of the coordinates specified for the path. The X and Y coordinates in the toolbar correspond to the boundingbox values. (so you see a width of 1 px, for example).
I don't know exactly what you want to end up with. If you want your path to align exactly with pixels, I think you want the path itself to be at integer+0.5 (!!!). To do this, you could use a grid that is set to 0.5 px spacing, and then a major grid line every 2 lines. The major lines will then be pixel boundaries, and you can snap your paths to the minor grid lines at 0.5px.
Cheers, Johan
On Mon, 2012-04-16 at 12:47 +0200, Johan Engelen wrote:
I guess you are using the "visual bounding box" (preferences -> tools).
I don't think I ever modified this so it must be the default setting?
Oddly, my 1 px line is at .00 x .00 coordinates when I turn on geometric bounding box but the line is blurry / inbetween pixels. If I make the coordinates .05 x .05 then the line is crisp. (?!)
The path itself is at an integer coordinate. But because the stroke width is 1 px, the path spills out 0.5 px on both sides of the coordinates specified for the path. The X and Y coordinates in the toolbar correspond to the boundingbox values. (so you see a width of 1 px, for example).
I don't know exactly what you want to end up with.
I think if the pen tool is set by default to draw 1 px and it is impossible to draw a crisp, pixel-grid aligned 1 px wide (or any odd integer width) line, it's a bug, isn't it?
If you want your path to align exactly with pixels, I think you want the path itself to be at integer+0.5 (!!!). To do this, you could use a grid that is set to 0.5 px spacing, and then a major grid line every 2 lines. The major lines will then be pixel boundaries, and you can snap your paths to the minor grid lines at 0.5px.
It just seems odd to me that it's not possible to draw a straight pixel-grid aligned line in Inkscape out-of-the-box. Thanks for the workarounds and for confirming I'm not crazy though, I thought I must be missing something.
~m
2012/4/17 Máirín Duffy <duffy@...2818...>
On Mon, 2012-04-16 at 12:47 +0200, Johan Engelen wrote:
I guess you are using the "visual bounding box" (preferences -> tools).
I don't think I ever modified this so it must be the default setting?
Oddly, my 1 px line is at .00 x .00 coordinates when I turn on geometric bounding box but the line is blurry / inbetween pixels. If I make the coordinates .05 x .05 then the line is crisp. (?!)
I think I understand what's going on.. a square pixel is 1.0 pixels wide. For a one pixel wide line to be "pixel aligned", it should be centered on the pixel, meaning the line's middle needs to be at 0.5.
If you think of a pixel as being a square with corners at (0,0), (0,1), (1,1) and (1,0) then you can see that the coordinates of a line going through the centre of that pixel needs to be at 0.5.
I'll try to do some ascii art..
(0,1) (1,1) (2,1) +-----------+-----------+ | | | | a pixel | another | | | pixel | | | | | | | +-----------+-----------+ (0,0) (1,0) (2,0)
See how a line that's one pixel wide, if you want it to be drawn on just one pixel rather than overhanging across two pixels, needs to be through the centre of the pixels at x=0.5.
Cheers
On Tue, 2012-04-17 at 11:57 +1000, Daniel Baird wrote:
See how a line that's one pixel wide, if you want it to be drawn on just one pixel rather than overhanging across two pixels, needs to be through the centre of the pixels at x=0.5.
Thanks for the explanation, hopefully others reading will be able to follow better than my cavewoman descriptions of the problem now. :)
I wonder if it should be expected that Inkscape behaves this way, or should it have some way to deal with these situations? It's just that, in the course of my teaching Inkscape to beginners, you'd think drawing a straight line would be easy-peasy basics, and inevitably the beginners notice their lines are mushy compared to other Inkscape work and I have to try to explain this... while it's not so difficult a concept, it's not exactly something you should have to think about when creating a drawing or a diagram or whatnot, is it?
E.g., I think we also have the issue that when you add a stroke to a path, you can't switch the stroke from being centered along the outer edge of the path to being along the outer part or the inner part as a stroke style option, correct? I wonder if the solution to that issue could also help solve this 'I can't draw a clean straight line out-of-the-box' issue.
By the way, in no way do I mean to be overly critical of Inkscape, I love it, it's my favorite program ever, and it always gets the job done for me. I'm finding it challenging to teach creating pixel-aligned artwork to others is the problem, perhaps other software they've used handled this in a different way.
~m
Okay... now if you're in an educational setting, it's quite easy to motivate the design decision Inkscape makes.
Imagine your 1px wide line you're drawing... and you draw it on a grid that it pixel aligned... if you expect to have the border aligned with the grid, should Inkscape put it over or under the pixel?
Now imagine you create a shape (logo) and you change the stroke width... (f.e. to 5 px) What's the behaviour you would expect? Should the stroke shrink the inner of the image? Because that's what will happen if you would consider the line edge to be the reference.
Grtz, Jurgen
On 04/17/12 04:33, Máirín Duffy wrote:
On Tue, 2012-04-17 at 11:57 +1000, Daniel Baird wrote:
See how a line that's one pixel wide, if you want it to be drawn on just one pixel rather than overhanging across two pixels, needs to be through the centre of the pixels at x=0.5.
Thanks for the explanation, hopefully others reading will be able to follow better than my cavewoman descriptions of the problem now. :)
I wonder if it should be expected that Inkscape behaves this way, or should it have some way to deal with these situations? It's just that, in the course of my teaching Inkscape to beginners, you'd think drawing a straight line would be easy-peasy basics, and inevitably the beginners notice their lines are mushy compared to other Inkscape work and I have to try to explain this... while it's not so difficult a concept, it's not exactly something you should have to think about when creating a drawing or a diagram or whatnot, is it?
E.g., I think we also have the issue that when you add a stroke to a path, you can't switch the stroke from being centered along the outer edge of the path to being along the outer part or the inner part as a stroke style option, correct? I wonder if the solution to that issue could also help solve this 'I can't draw a clean straight line out-of-the-box' issue.
By the way, in no way do I mean to be overly critical of Inkscape, I love it, it's my favorite program ever, and it always gets the job done for me. I'm finding it challenging to teach creating pixel-aligned artwork to others is the problem, perhaps other software they've used handled this in a different way.
~m
Hi Máirin,
I used to stumble over the same issue until someone posted this default settings (see attached file). The grid is set up as Johan Engelen explained in previous mail. Since then I draw happily perfect alligned icons. When I switched from illustrator to inkscape it was this allignment issue that I really missed until I got hold of these grid settings, since then I prefer to pixel allign in Inkscape,
Mit freundlichen Grüßen
i. A. Marcel Tippmann Abteilung KDS Tel : +49 8382 703-907 Fax : +49 8382 703-625
Lindauer DORNIER GmbH Rickenbacher Str. 119 88129 Lindau/B Germany http://www.lindauer-dornier.com
Wir können E-Mail-Nachrichten nur bearbeiten, wenn diese die volle Absenderadresse enthalten. We can only process E-Mails with the complete address of the sender.
Máirín Duffy <duffy@...2818...> schrieb am 17.04.2012 03:26:15:
Máirín Duffy <duffy@...2818...> 17.04.2012 03:27
Bitte antworten an Inkscape User Community inkscape-user@lists.sourceforge.net
An
Inkscape User Community inkscape-user@lists.sourceforge.net
Kopie
Thema
Re: [Inkscape-user] crisp lines and floating point
On Mon, 2012-04-16 at 12:47 +0200, Johan Engelen wrote:
I guess you are using the "visual bounding box" (preferences ->
tools).
I don't think I ever modified this so it must be the default setting?
Oddly, my 1 px line is at .00 x .00 coordinates when I turn on geometric bounding box but the line is blurry / inbetween pixels. If I make the coordinates .05 x .05 then the line is crisp. (?!)
The path itself is at an integer coordinate. But because the stroke width is 1 px, the path spills out 0.5 px on both sides of the coordinates specified for the path. The X and Y coordinates in the toolbar correspond to the boundingbox values. (so you see a width of 1
px, for example).
I don't know exactly what you want to end up with.
I think if the pen tool is set by default to draw 1 px and it is impossible to draw a crisp, pixel-grid aligned 1 px wide (or any odd integer width) line, it's a bug, isn't it?
If you want your path to align exactly with pixels, I think you want the path itself to be
at
integer+0.5 (!!!). To do this, you could use a grid that is set to 0.5
px spacing, and then a major grid line every 2 lines. The major lines will then be pixel boundaries, and you can snap your paths to the
minor
grid lines at 0.5px.
It just seems odd to me that it's not possible to draw a straight pixel-grid aligned line in Inkscape out-of-the-box. Thanks for the workarounds and for confirming I'm not crazy though, I thought I must be missing something.
~m
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
________________________________________________________________
Visit us at ITMA ASIA + CITME 2012 12. - 16.06.2012 | Shanghai, P. R. China | www.itmaasia.com | Lindauer DORNIER GmbH | Hall E3 | Stand F01 ________________________________________________________________
Lindauer DORNIER GmbH Rickenbacher Str. 119 88129 Lindau / Germany Phone: +49 8382 703-0 Fax: +49 8382 703-4 15 webmaster@...2272... http://www.lindauerdornier.com
Commercial Registry: HR Kempten Nr. B/1220
Chairman of the Supervisory Board: Prof. Dr. Dieter Feddersen, Managing Directors: Peter D. Dornier (CEO), Michael Ebeling, Dr. Andreas Rutz, Hans-Jürgen Schmidt (CFO)
participants (5)
-
Daniel Baird
-
Johan Engelen
-
Jurgen Gaeremyn
-
Marcel Tippmann
-
Máirín Duffy