Simple question about clip/mask function

Post questions on how to use or achieve an effect in Inkscape.
conal2
Posts: 7
Joined: Mon Aug 29, 2011 7:30 pm

Simple question about clip/mask function

Postby conal2 » Mon Aug 29, 2011 11:18 pm

Hi, I know how to use a shape to mark a clip area.

Once executed that leaves me with everything invisible apart from what is within the area I have marked; however what I want to do is mark the area that I wish to make invisible. How is that done?

I can post images of what I am trying to do if that doesn't make sense!

Thanks in advance

Conal

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

Re: Simple question about clip/mask function

Postby prkos » Tue Aug 30, 2011 7:42 am

Unfortunately this isn't as easy as marking the area you want visible, but it's not hard either.

Lets say you want to mark a doughnut-shape area - you need to create a doughnut shaped object to use as the clipping path. Create two circles of different sizes one above the other, select them both and do a Division to get the doughnut shape and use it for clipping.

For any other shape you need to create an object that covers all of the areas you want included, and make sure the clipping path doesn't cover any areas you want excluded.
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

conal2
Posts: 7
Joined: Mon Aug 29, 2011 7:30 pm

Re: Simple question about clip/mask function

Postby conal2 » Tue Aug 30, 2011 6:10 pm

Thanks very much prkos, this won't be easy for the shapes I am working with, but at least I know how!

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

Re: Simple question about clip/mask function

Postby brynn » Tue Aug 30, 2011 7:11 pm

You're welcome to show us a screenshot of the shapes, explain your goals and ask for suggestions. There are some very creative and wise Inkscapers here, who love to share their talents :D But only if you would like to :D

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Simple question about clip/mask function

Postby druban » Wed Aug 31, 2011 2:15 am

image43.png
image43.png (127.78 KiB) Viewed 2974 times


Here is a method using difference. If you are using the stable version (0.48) you can also use path>combine to get your clipping path, but if you are on a newer build combined paths are no longer recognized for clipping purposes, unfortunately.
Your mind is what you think it is.

conal2
Posts: 7
Joined: Mon Aug 29, 2011 7:30 pm

Re: Simple question about clip/mask function

Postby conal2 » Tue Sep 06, 2011 7:24 am

Thanks druban the "difference" method worked well!

brynne - good suggestion as I have another problem - how do I make two arcs join together flush at the ends? I can't seem to make inkscape draw the ends of the arc at exactly 90 degrees - it's always just off. I have attached an image to explain what I mean - this is an extreme zoom-in on the left hand side of a letter G (made with the circle tool on arc mode) I am trying to it make blue at the top and green at the bottom - but that join between green and blue needs to be perfectly flat.

More generally - one of the biggest problems I'm having is creating an svg that will render the same in other programs;- firefox, scribus, illustrator, etc. So far, even when saving as a plain SVG that does not seem to be the case, sometimes the clip path will not be rendered and even the basic shapes can come out differently. Is this just something I have to live with?

Thanks very much for all your help!
Attachments
2_tone_letter_zoom_in.png
2_tone_letter_zoom_in.png (48.85 KiB) Viewed 2912 times

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

Re: Simple question about clip/mask function

Postby brynn » Tue Sep 06, 2011 2:37 pm

So it's a blue arc and a green arc, right? And the place where they meet needs to be exactly horizontal?
I haven't worked a lot with arcs, so there maybe a more clever way to do this.....and in fact, the more I think about it, the more I think it might not be possible in every case..... Hhmm....let me do some testing, and I'll be back to share what I learn :D

EDIT
Are these arcs drawn with the Elllipse tool :tool_ellipse: ? Or derived from an ellipse?
I think what's happening is that the arc is not exactly vertical at the end points. Here's a screenshot to hopefully clarify.

Image

I snapped the center of the original ellipse to the guide, and then I dragged the handle upwards slightly to create the arc. The other handle is still exactly horizontal to the center of the original ellipse, which means that the arc at the end point that hasn't been moved is exactly verticaly at that point. Or maybe it would be better to say it this way -- the tangent of the arc needs to be exactly vertical at the end, if you want the end to be exactly horizontal. Or if you use a guide, perpendicular to the guide. So what I think this shows is that the end of the arc is always perpendicular to the tangent of the ellipse at that point. I think this would also apply to any curve.

EDIT 2
druban posted while I was typing my edit

So I think what you need to do, is make sure the end of the arc is exactly vertical, or exactly perpendicular to the guide, at the end. And I think the best way to do it would be to start with an ellipse, snap it's center to the guide, and then create the arc accordingly.

Or if that's not really do-able (because I can't see what all is happening in your image) maybe you could do a clip to make it horizontal? Or maybe you could convert to path (stroke to path), and snap corner nodes to the guide, or a grid (or set nodes at the same y value)? Or possibly you could rotate the arcs until the ends are horizontal, and then readjust the line. But this last way you would technically lose the arc, and just have a curve.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Simple question about clip/mask function

Postby druban » Tue Sep 06, 2011 4:14 pm

Observe the control bar of the ellipse tool when adjusting your arc - in fact, you should use numeric entry in the fields to guarantee the absolute precision you want - 0.000 and 180.000 are the only two absolutely horizontal positions.
The pic below shows an example arc with horizontal ends, note the values in the tool control bar..

g3121.png
g3121.png (45.2 KiB) Viewed 2893 times
Last edited by druban on Tue Sep 06, 2011 9:31 pm, edited 1 time in total.
Your mind is what you think it is.

conal2
Posts: 7
Joined: Mon Aug 29, 2011 7:30 pm

Re: Simple question about clip/mask function

Postby conal2 » Tue Sep 06, 2011 8:45 pm

Druban; thanks- but doesn't that shape you have posted have exactly the same problem (if you look really close)? I have tried mine with numeric entry in the fileds at 180 degrees - same problem!

Brynn
Or maybe you could convert to path (stroke to path), and snap corner nodes to the guide, or a grid (or set nodes at the same y value)?
- that might work! I'll give it a go and let you know...

Thanks again to both of you.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Simple question about clip/mask function

Postby druban » Tue Sep 06, 2011 8:59 pm

Conal2, You are absolutely right! there appears to be a bug that renders the inner part of the stroke inaccurately. Upon examination you can see that the line bends upward right at the node. Not only that, but the left and right rendering errors appear to be different. On top of it all, the fill and stroke appear to be misaligned as well....
g3810.png
g3810.png (36.84 KiB) Viewed 2875 times

However as soon as you do stroke to path, the bend goes away and the line becomes straight! This makes it seem like a rendering issue, because the geometry must be correct.
It's a very interesting bug.
Thanks for pointing it out!
Your mind is what you think it is.

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

Re: Simple question about clip/mask function

Postby brynn » Tue Sep 06, 2011 10:18 pm

I'm not getting the same results as you are. Here's a screenshot. The stroke is 3.0 and it's zoomed all the way to the max (25,600%). The arc is 180.0 set in control bar. I have a 1 x 1 px grid enabled (blue), and a guide (red) snapped to the same grid line as the arc handle. I can just barely, barely see that the right side is very slightly above the grid and guidelines. Not nearly the distortion you both are showing. I'm on windows 7, 64-bit, Inkscape 0.48.1 stable.

Image

The distortion on the right side is a little more pronounced. But still very, very minor here.

Image

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Simple question about clip/mask function

Postby ~suv » Tue Sep 06, 2011 10:28 pm

druban wrote:It's a very interesting bug.

Bug #477969 in Inkscape: “Arc end cap not perpendicular

(the new renderer in recent devel builds is far more accurate than Inkscape stable (0.48.1) though, with the example files from the report)

conal2
Posts: 7
Joined: Mon Aug 29, 2011 7:30 pm

Re: Simple question about clip/mask function

Postby conal2 » Wed Sep 07, 2011 4:52 am

~suv; I'm glad it's a known bug and not that I'm missing something!

brynn; thanks for posting these experiments - even the level of distortion you are experiencing would be too much for me, as this needs to be usable by fussy design agencies with other software. However it does make me think I should upgrade to a newer version.

and druban;
However as soon as you do stroke to path, the bend goes away and the line becomes straight!
- this seems to work, so far!

Thanks again.


Return to “Help with using Inkscape”