3 Qs re stroke join style

Post questions on how to use or achieve an effect in Inkscape.
User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

3 Qs re stroke join style

Postby brynn » Wed Oct 22, 2008 4:04 pm

Hi Friends,
I've made a quick image to illustrate my questions:

Image

2 identical pentagons, one with the sharp or mitered stroke join setting, and the other with the rounded style.

1. About the rounded style, is there any way, using the stroke settings, to make the inner margin of the stroke rounded like the outer edge? Is doing Object to Path and drawing it (there are various ways of doing it, but that's not my question), the only way to accomplish it?
2. Why doesn't the inner margin match the outer margin? There are times, when using the rounded or blunt (not pictured above) style, that I would prefer the inner margin of the stroke to reflect the outer margin. So I'm just curious if there's any particular reason for this?
3. Would it be difficult to add a setting in the stroke dialog, allowing the inner margin to be shaped like the outer edge (whether rounded or blunt)? Unless someone replies to my 1st question, that there already exists a way to do this, I think I might put in a new feature request. What do you all think...or am I the only one who's ever wanted to do this? :mrgreen:

Thanks for any comments :D

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: 3 Qs re stroke join style

Postby microUgly » Wed Oct 22, 2008 7:20 pm

Imagine the outline of an object is a rail and a wheel is connected the rail at its centre. If the outside of the wheel created a big blue smudge as it traveled around the rail it would create the shape you see, including the corner.

SVG only has support for centre-stroke (as opposed to inner-stroke or outer-stroke).

You can use "outset" to create the effect you want.

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

Re: 3 Qs re stroke join style

Postby brynn » Thu Oct 23, 2008 2:11 am

Imagine the outline of an object is a rail and a wheel is connected the rail at its centre. If the outside of the wheel created a big blue smudge as it traveled around the rail it would create the shape you see, including the corner.

Right, I understand that micro.

Would it be particularly difficult to add the inner and/or outer stroke features?

I seem to recall a topic a while back asking about this, so I'm wondering if it would be worth putting in a new feature request.

Thanks microUgly :D

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: 3 Qs re stroke join style

Postby prkos » Thu Oct 23, 2008 5:22 am

just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: 3 Qs re stroke join style

Postby microUgly » Thu Oct 23, 2008 7:39 am

brynn wrote:Would it be particularly difficult to add the inner and/or outer stroke features?

In a way. As I said, it's not a part of the SVG standard. The developers would have to do something like they do with live path effects where SVG strokes are not used and spererate objects would be created to simulate a stroke.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: 3 Qs re stroke join style

Postby microUgly » Thu Oct 23, 2008 7:42 am

Oh, I should say, even if Inkscape did support inner/outer stroke, that's not going to help you get a rounded inner-corner for the same logic I described before--think of a wheel rolling around the outside of a rail. If the rail has croners then the stroke will have corners. You have to use outset.

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

Re: 3 Qs re stroke join style

Postby brynn » Thu Oct 23, 2008 11:44 am

Ok then, thanks guys.
I appreciate your time and comments.
All best.

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: 3 Qs re stroke join style

Postby kelan » Thu Oct 23, 2008 10:24 pm

Outsetting a path can deform its shape. This technique preserves shape, although there are caveats. See the end of the post for those. To use your example, let's make a pentagon with final stroke of 50.
  1. Make a pentagon.
  2. Choose a stroke width for the pentagon. You can make it as wide as you want. The wider the stroke, the more curved the inner corners of the final shape will be. Let's label this stroke width as W.
  3. Set the color of the stroke to exactly match the fill
  4. Duplicate the pentagon, and lower the duplicate below the first one. The duplicate will provide the stroke for the final object, by specifying a larger stroke that is then partially hidden by the first pentagon.
  5. To get the desired final stroke width (call it F), set the duplicate's stroke width to (F x 2) + W. In this case we want the final stroke width to be 50, so set the duplicate's stroke width to 100 + W.
  6. Group the the two shapes for easy placement.
Now the inner edge of the stroke is curved like the outer edge. And you can easily resize your shape and preserve the stroke width by making sure that toolbar option for scaling strokes with the object is turned off. That let's you worry about object size after you create a pleasingly curved inner edge.

Now for the caveats:
  • Getting the object to be a very exact size (like down to the pixel) might be difficult, because its boundaries aren't the same as a normal object with a stroke. If you're used to working with objects based on their geometric bounding box instead of the visual bounding box, that won't work with this technique because you actually end up with a group.
  • Getting a transparent fill is a bit tricky. Obviously, you can't just set the first object to be transparent. What you would need to do in this case is make a mask.
    1. The duplicate stays as it is.
    2. Make a large white box that completely covers the duplicate, and put it under the top object (in the z-order).
    3. Set the top object's fill and stroke to black.
    4. Group the top object and the white box.
    5. Mask the duplicate with the group created in the previous step.

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

Re: 3 Qs re stroke join style

Postby brynn » Thu Oct 23, 2008 10:52 pm

Oh, I see, so the way you did it, it is still a stroke in the end. That's very clever!

I didn't like the offset idea either, for the same reason you mentioned. I was thinking along similar lines, but I went Stroke to path, duplicated, scaled down duplicate, then did Difference. So my final product is actually a path.

I'm sure there are probably quite a number of ways to accomplish this. And I guess for my purpose in this image, it doesn't really matter if it's a stroke or a path.

Thanks kelan, nice idea :D


Return to “Help with using Inkscape”