Trim Line to Match Shape Outline

Post questions on how to use or achieve an effect in Inkscape.
jtrohde
Posts: 1
Joined: Mon Feb 20, 2012 6:33 am

Trim Line to Match Shape Outline

Postby jtrohde » Mon Feb 20, 2012 6:55 am

Hello,

I apologize if this has already been discussed, but I tried searching the forum to no avail.

I am fairly new to Inkscape... My goal is to trim the edges of a line so that they fit within another shape. Specifically in this case, I need the white line's edges to fit within the edge of the heart shape. I have posted a screenshot of what I've got currently in Inkscape (a heart object and a white line - the black portion is just a temporary background layer), and what I'm hoping to achieve (I used GIMP to trim pixels as a quick example).

Thanks in advance for you help!
Attachments
inkscape_working_copy.png
Current Inkscape Document Screen Capture
inkscape_working_copy.png (19.43 KiB) Viewed 1892 times
heartrate-512-final.png
Desired Result
heartrate-512-final.png (19.01 KiB) Viewed 1892 times

llogg
Posts: 443
Joined: Tue Mar 11, 2008 7:30 am

Re: Trim Line to Match Shape Outline

Postby llogg » Mon Feb 20, 2012 10:27 am

Duplicate your heart shape. Select the heart and the line and do object>clip. The heart must be "above" the line.

EDITED TO ADD ALTERNATE METHOD
You could also use the path functions to do this and end up with something that might be easier to edit down the line than a clipped object.
1. Select the line and do Path>Stroke to path.
2. Duplicate the heart shape.
3. Select heart and line and do Path>Intersection.
Last edited by llogg on Mon Feb 20, 2012 10:43 am, edited 1 time in total.

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

Re: Trim Line to Match Shape Outline

Postby brynn » Mon Feb 20, 2012 10:36 am

Image
Welcome to InkscapeForum!

There may be a few ways to do this. And it might not matter which way you do it. But there are certain situations where one or the other might be preferred. So if this causes a problem down the road, we can offer other options.

The one that's easiest to explain is clipping (and some would argue the easiest way).

-- select the heart
-- duplicate (Edit menu or control bar button)
-- give the duplicate some other color, doesn't matter what, just something different
-- select the duplicate heart and the white line
-- Object menu > Clip > Set

Now if you ever need to undo this, for some reason down the road, you can use Object menu > Clip > Release. This is when the duplicate being a different color might be helpful, because it will allow you to distinguish it from the original.

I think I would probably use a technique called 'node editing' to make the white line ends match the heart border. That's because I'm quite comfortable with node editing. However, many people avoid node editing if at all possible. If it turns out that clipping causes some as yet unforeseen problem, then we can explain either node editing or even some other technique.

Let us know how it goes :D


Return to “Help with using Inkscape”