Drawing line how to?

General discussions about Inkscape.
nihon94
Posts: 100
Joined: Tue Nov 29, 2011 10:23 pm

Drawing line how to?

Postby nihon94 » Sat Aug 18, 2012 6:15 pm

Hi,

Some time easy task could become difficult. :geek:
I want to draw a vertical line with black stroke and white fill of 6px(or could be larger).
I have tried, Bezier tool and could not get Fill in, I have tried Pencil tool and could not get Fill in color.
I have succeeded only with the rectangle tool.

My Question is: if I want to draw a vertical line with black stroke(outer) and white fill (inner)of 6px
how could I achieve that?

Please share your thoughts and advice.

PS, I have read tutorial included in the Inkscape but could not find the solution. :?

Thank you.

Ailurus
Posts: 115
Joined: Fri Oct 22, 2010 9:53 am
Location: The Netherlands
Contact:

Re: Drawing line how to?

Postby Ailurus » Sat Aug 18, 2012 8:36 pm

Hi,

I think you might be confused about the "Fill" property of a path. As far as I know, the fill of a path only becomes visible when the path is curved or consists of multiple (straight) segments (where the nodes are not co-linear), i.e. you cannot fill a straight path with a color.

Indeed, it can be done with the Rectangle tool. But it can also be done with the Bézier tool, in (at least) two ways.

1.) First one would be constructing the rectangle from scratch, i.e. drawing four segments that are perpendicular to each other. To get the fourth segment perpendicular to both the third and first one, you will need some guide and/or snapping. But this isn't really helpful I guess :D

2.) Draw a straight (vertical) black curve, just a single segment. In the "Fill and Stroke" dialog, go to the "Stroke Style" tab, and select "Square Cap" for the Cap property. Also, set the width to 8px, or whatever you want. Now, duplicate this line (Ctrl+D), set the stroke to white, and the width to 6px. Because of the "Square Cap" setting, you should now have exactly what you wanted :)

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Drawing line how to?

Postby brynn » Sun Aug 19, 2012 8:27 am

A straight path cannot be filled. It can only be stroked. Well, you can give it a fill property, by you can't see the fill if the path is straight.
This might work, but I'm not entirely clear what you're asking.

Draw straight path with Pen/Bezier or Pencil/Freehand tool. Set width to whatever you want. Path menu > Stroke to Path. Add a stroke, and set colors for stroke and fill, as you like. This will have the stroke all the way around the new closed path. But that's where I'm not clear what you're asking. I think Ailurus' #2 will give the appearance 2 parallel strokes with a fill in between them. It's really 2 paths of different colors, on top of each other, with the bottom one wider than the top one. Mine will have the stroke all the way around, like along skinny rectangle.

Edit
Ailurus, my apology if I have misunderstood your comments. "straight (vertical) curve" is a little confusing :mrgreen:

Ailurus
Posts: 115
Joined: Fri Oct 22, 2010 9:53 am
Location: The Netherlands
Contact:

Re: Drawing line how to?

Postby Ailurus » Sun Aug 19, 2012 5:52 pm

brynn wrote:Ailurus, my apology if I have misunderstood your comments. "straight (vertical) curve" is a little confusing :mrgreen:


Oh sorry, with that I mean a vertical line (with the thought that a line is actually a straight curve) :D. Ha, I always wondered what the "Stroke to Path" function did, now I know it. Both our methods will give the same result as far as I can see (except when resizing, then mine will change the stroke width -- except if you use Ctrl and resize, of course).

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Drawing line how to?

Postby brynn » Sun Aug 19, 2012 7:56 pm

Hi Ailurus,
Ailurus wrote:Oh sorry, with that I mean a vertical line (with the thought that a line is actually a straight curve) :D. Ha, I always wondered what the "Stroke to Path" function did, now I know it. Both our methods will give the same result as far as I can see (except when resizing, then mine will change the stroke width -- except if you use Ctrl and resize, of course).

No apology necessary :) But I still don't understand "straight curve" :? "Straight" and "curve" seem to be mutually exclusive to me. Or....ooohh....perhaps there is a nuance of translation that I have misunderstood?

Also when you say both methods give the same result, which of your 2 solutions are you comparing to mine? Well, I'm not sure if it matters, actually, to the comments I want to make. Using Ctrl key when scaling maintains overall dimension proportions of the object. It doesn't prevent the stroke width from changing when you scale it. To prevent the stroke width from changing when you scale it, disable the "When scaling objects, scale the stroke width by the same proportions" button on Selection tool :tool_selector: control bar. (4th button from the right on 0.48.1)
scalesw.png
scalesw.png (5.5 KiB) Viewed 6558 times

Hhmm, maybe I should be clear with an illustration. Below, side by side, I have the technique I was describing on the right, and what I thought Ailurus' #2 was , on the middle and left. On the left, is a 20 px wide black stroked path on the bottom, and an 8 px wide pink stroked path on top of it (nodes literally overlapping). In the middle, same thing, except with square end cap on black path's stroke. To make mine on the right, I used the original black stroked path, Stroke to Path, add black stroke and change fill to pink.

Image
Last edited by brynn on Sun Aug 19, 2012 8:00 pm, edited 1 time in total.
Reason: tweaked illustration

Ailurus
Posts: 115
Joined: Fri Oct 22, 2010 9:53 am
Location: The Netherlands
Contact:

Re: Drawing line how to?

Postby Ailurus » Sun Aug 19, 2012 8:19 pm

Yes, could be a translation issue? But for me, a curve can be either straight (a line) or curvy (like a cubic Bézier curve -- a linear Bézier curve would be straight, just a line). To prevent confusion, I'd thought "straight curve" would indicate a line :)

I compared my second method to yours. By default, those four buttons in the toolbar are switched off for me. Anyways, both solutions are nice, and I learned something new. It's now up to Nihon94 to pick one :D

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Drawing line how to?

Postby brynn » Sun Aug 19, 2012 9:27 pm

Ooohh, I undestand now! A line drawn with Bezier tool -- that makes sense :D

nihon94
Posts: 100
Joined: Tue Nov 29, 2011 10:23 pm

Re: Drawing line how to?

Postby nihon94 » Sun Aug 19, 2012 11:59 pm

Ailurus wrote:Hi,

I think you might be confused about the "Fill" property of a path. As far as I know, the fill of a path only becomes visible when the path is curved or consists of multiple (straight) segments (where the nodes are not co-linear), i.e. you cannot fill a straight path with a color.

Indeed, it can be done with the Rectangle tool. But it can also be done with the Bézier tool, in (at least) two ways.

1.) First one would be constructing the rectangle from scratch, i.e. drawing four segments that are perpendicular to each other. To get the fourth segment perpendicular to both the third and first one, you will need some guide and/or snapping. But this isn't really helpful I guess :D

2.) Draw a straight (vertical) black curve, just a single segment. In the "Fill and Stroke" dialog, go to the "Stroke Style" tab, and select "Square Cap" for the Cap property. Also, set the width to 8px, or whatever you want. Now, duplicate this line (Ctrl+D), set the stroke to white, and the width to 6px. Because of the "Square Cap" setting, you should now have exactly what you wanted :)

------------------------------------

Thank you for reply.

Normally when someone reply I get notification but this time I did not get any and when I checked today I saw some answers.

I followed your method:
Bezier tool,
Mode, create regular Bezier path
Shape, None
I followed your method it worked just the straight line was not straight may be due to stroke. But I learned something.
Thank you

nihon94
Posts: 100
Joined: Tue Nov 29, 2011 10:23 pm

Re: Drawing line how to?

Postby nihon94 » Mon Aug 20, 2012 12:12 am

brynn wrote:A straight path cannot be filled. It can only be stroked. Well, you can give it a fill property, by you can't see the fill if the path is straight.
This might work, but I'm not entirely clear what you're asking.

Draw straight path with Pen/Bezier or Pencil/Freehand tool. Set width to whatever you want. Path menu > Stroke to Path. Add a stroke, and set colors for stroke and fill, as you like. This will have the stroke all the way around the new closed path. But that's where I'm not clear what you're asking. I think Ailurus' #2 will give the appearance 2 parallel strokes with a fill in between them. It's really 2 paths of different colors, on top of each other, with the bottom one wider than the top one. Mine will have the stroke all the way around, like along skinny rectangle.

Edit
Ailurus, my apology if I have misunderstood your comments. "straight (vertical) curve" is a little confusing :mrgreen:

-------------------------------------------

Thank you for reply.
Normally when someone reply I get notification but this time I did not get any and when I checked here I got some helpful answers. That is why I am late :oops:

I also applied your method for drawing a straight path.
I followed your method by using
Bezier tool,Mode:create regular
Bezier path Shape: None
Set width. Path menu > Stroke to Path. Add a stroke, and set colors for stroke and fill.
It worked fine. Thanks.

May I ask one thing, the method you showed and IF I use rectangle to draw a straight path what is the difference?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Drawing line how to?

Postby brynn » Mon Aug 20, 2012 6:21 pm

nihon94 wrote:May I ask one thing, the method you showed and IF I use rectangle to draw a straight path what is the difference?

They look the same when they're not selected, so there's no difference in how they look, until you select them. But they behave very differently. The rectangular shaped path is a path -- whether drawn with Pen/Bezier or Pencil/Freehand, OR rectangle drawn with Rectangle tool and then converted to path (Object to Path), they are all paths. Paths are edited with Node tool :tool_node: . The rectangle drawn with Rectangle tool (and NOT converted to path) is a shape. Shapes are edited with Selection tool :tool_selector: , or the shape tool which created it, in this case the Rectangle tool. See my screenshot:

Image

The path is on the left, and the shape is on the right. You can see that the path has nodes (tiny gray diamonds or squares). And the shape has handles (tiny white circles and squares with black borders). Handles and nodes do different things.

So to summarize, one is a path and one is a shape. The decision whether to use one or the other, depends on what you need to do with it in your image. If you need to bend it later, you should either draw it as a path, or convert a rectangle to path (Object to Path), because you won't be able to bend the rectangle shape.

I think Help menu > Tutorials cover these basic things.

Edit
Actually, I need to correct myself. Apparently you can use the Node tool to adjust the shape handles! :o


Return to “General Discussions”