Scratchpad clippingtutorial

From Inkscape Wiki
Revision as of 03:25, 27 June 2007 by Ryanlerch (talk | contribs)
Jump to navigation Jump to search
This is a tutorial scratchpad. When this tutorial gets to a level of "completeness" it will be converted into docbook xml format and commited to the SVN.

If you edit or add anything, feel free to add your name to the authors list, so you get credit where credit is due!

Translating this tutorial: please do not translate this tutorial yet, it is still in the early stages of development and will be modified drastically. Translations can take place once it has been migrated to the SVN.

Images please upload SVG format images. However, the PNG thumbs are not working properly on the wiki, so just provide a link to the uploaded SVG on the wiki.


Clipping, Masking and Patterns


ryan lerch, ryanlerch at gmail dot com


This tutorial covers the usage of the clip and mask functions in inkscape, as well as how to create, apply and edit patterns to fills and strokes.



The clip function in inkscape allows an object or a group of objects to be clipped(cropped) so that only parts of the elements are visible. Clipping can be applied to any object (including linked and imbedded bitmaps.)

The easiest way to understand clipping is to see it in action. Take the following assortment of objects:

Now, place another object on top of all the others. This is what we are using for our clipping object. Note that the z-order of the clipping object is important, as Inkscape takes the top-most object as the clipping object. Also note that the style(fill, stroke, opacity etc) of the object is irrelevant, all that is used when clipping is the shape of the object.

The next step is to select all the objects that you want clipped and the clipping object, and in the menus go to object > clip > set. The result is:

As you can see, only the parts of the objects that were inside the bounds of the clipping object are visible now.

Clipping does not delete parts of your objects, it merely tells the SVG renderer not to display them. This means that we can also release objects from a clip. Do this by selecting the object that you wish to release, and in the menus go to object > clip release. In the following example, the blue star object was selected, and the clip was released:

So the purple clipping object has now returned, and the blue star object is no longer clipped. Note that the other two objects are still clipped, as the clip was applied to 3 seperate objects. These clips still apply and can be released if needed. Because clipping paths can be applied to any object, if you wanted to treat the 3 objects as a whole, you would group them, then apply the clip to the group.

Clipping can be done on any object, even objects that have had filters applied to them. Below is an example of using clipping to create a bubble effect on a circle:

A clip can also be done on bitmaps that are embedded into or linked from an SVG: