## inkscape-user

 [Inkscape-user] crisp lines and floating point From: Máirín Duffy - 2012-04-16 00:47:11 ```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 ```
 Re: [Inkscape-user] crisp lines and floating point From: Johan Engelen - 2012-04-16 10:47:54 ```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 ```
 Re: [Inkscape-user] crisp lines and floating point From: Máirín Duffy - 2012-04-17 01:26:30 ```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 ```
 [Inkscape-user] Antwort: Re: crisp lines and floating point From: Marcel Tippmann - 2012-04-17 06:25:19 Attachments: Message as HTML     optimized-grid-setting-inkscape.svg
 Re: [Inkscape-user] crisp lines and floating point From: Daniel Baird - 2012-04-17 01:57:40 Attachments: Message as HTML ```2012/4/17 Máirín Duffy > 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 -- Daniel Baird I've tried going to the XHTML a few times, but it's always closed. ```
 Re: [Inkscape-user] crisp lines and floating point From: Máirín Duffy - 2012-04-17 02:34:05 ```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 ```
 Re: [Inkscape-user] crisp lines and floating point From: Jurgen Gaeremyn - 2012-04-18 16:28:13 ```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 ```