Building Objects in Inkscape

Exclusive offer: get 50% off this eBook here
Inkscape Beginner’s Guide

Inkscape Beginner’s Guide — Save 50%

Create attractive layout designs, logos, brochures, icons, and more using the Inkscape vector graphics editor with this book and ebook.

£14.99    £7.50
by Bethany Hiitola | May 2012 | Open Source

This article by Bethany Hiitola author of Inkscape Beginner's Guide is all about objects. We'll learn about what objects are and how Inkscape interprets them, how to change object features, change fill and stroke, grouping objects, combining objects, and how to best use the masking and clipping features.

Details in this article include:

  • Working with objects
  • Fill and Stroke
  • Grouping
  • Clipping and masking

(For more resources on Inkscape, see here.)

Working with objects

Objects in Inkscape are any shapes that make up your overall drawing. This means that any text, path, or shape that you create is essentially an object.

Let's start by making a simple object and then changing some of its attributes.

Time for action – creating a simple object

Inkscape can create predefined shapes that are part of the SVG standard. These include rectangles/squares, circles/ellipses/arcs, stars, polygons, and spirals. To create any of these shapes, you can select items from the toolbar:

However, you can also create more freehand-based objects as well. Let's look at how we can create a simple freehand triangle:

  1. Select the Bezier tool:

  2. Click once where you want the first corner and then move the mouse/pointer to the next corner. A node appears with the click and then a freehand line:

  3. When you have the length of the first side of the triangle estimated, click for the second corner:

  4. Move the mouse to form the second side and click for the third corner:

  5. Move the mouse back to the first corner node and click it to form the triangle, shown as follows:

  6. Now save the file. From the main menu, select File and then Save. We will use this triangle to build a graphic later in this book, so choose a location to save so that you will know where to find the file.
  7. Now that the basic triangle is saved, let's also experiment with how we can manipulate the shape itself and/or the shape's position on the canvas. Let's start with manipulating the triangle.
  8. Select the triangle and drag a handle to a new location. You have essentially skewed the triangle, as shown in the following diagram:

  9. To change the overall shape of the triangle, select the triangle, then click the Edit path by Nodes tool (or press F2 ):

  10. Now the nodes of the triangle are displayed as follows:

  11. Nodes are points on a path that define the path's shape. Click a node and you can drag it to another location to manipulate the triangle's overall shape as follows:

  12. Double-click between two nodes to add another node and change the shape:

  13. If you decide that you don't want the extra node, click it (the node turns red), press Delete on your keyboard and it disappears.
  14. You can also use the control bar to add, delete, or manipulate the path/shape and nodes:

  15. If you want to change the position of the shape on the canvas by choosing the Select tool in the toolbox, click and drag the shape and move it where you need it to be.
  16. Change the size of the shape by also choosing the Select tool from the toolbox, clicking and holding the edge of the shape at the handle (small square or circles at edges), and dragging it outward to grow larger or inward to shrink until the shape is of the desired size.
  17. You can also rotate an object. Choose the Select tool from the toolbox and single-click the shape until the nodes turn to arrows with curves (this might require you to click the object a couple of times). When you see the curved arrow nodes, click-and-drag on a corner node to rotate the object until it is rotated and positioned correctly.
  18. No need to save this file again after we have manipulated it—unless you want to reference this new version of the triangle for future projects.

What just happened?

We created a free-form triangle and saved it for a future project. We also manipulated the shape in a number of ways—used the nodes to change the skew of the overall shape, added nodes to change the shape completely, and also how to move the shape around on the canvas.

Fill and Stroke

As you've already noticed, when creating objects in Inkscape they have color associated with them. You can fill an object with a color as well as give the object an outline or stroke. This section will explain how to change these characteristics of an object in Inkscape.

Fill and Stroke dialog

You can use the Fill and Stroke dialog from the main menu to change the fill colors of an object.

Time for action – using the Fill and Stroke dialog

Let's open the dialog and get started:

  1. Open your triangle Inkscape file again and select the triangle.
  2. From the main menu, choose Object | Fill and Stroke (or use the Shift + Ctrl + F keyboard shortcut).

  3. The Fill and Stroke dialog appears on the right-hand side of your screen. Notice it has three tabs: Fill, Stroke paint, and Stroke style , as shown in the following screenshot:

  4. Select the Fill tab (if not already selected). Here are the options for fill:
    • Type of fill: The buttons below the Fill tab allow you to select the type of fill you would like to use. No fill (the button with the X), flat color, linear or radial gradients. In the previous example screenshot, the flat fill button is selected.
    • Color picker : Another set of tabs below the type of the fill area are presented; RGB , CMYK, HSL, and Wheel. You can use any of these to choose a color. The most intuitive option is Wheel as it allows you to visually see all the colors and rotate a triangle to the color of your choice, as shown in the following screenshot:

    • Once a color is chosen, then the exact color can be seen in various values on the other color picker tabs.
    • Blur : Below the color area, you also have an option to blur the object's fill. This means that if you move the sliding lever to the right, the blur of the fill will move outward. See the following diagram for examples of an object without and with blur:

    • Opacity: Lastly, there is the opacity slider. By moving this slider to the right you will give the object an alpha of opacity setting making it a bit more transparent. The following diagram demonstrates opacity:

  5. In the Fill and Stroke dialog , if you select the Stroke paint tab , you will notice it looks very much like the Fill tab. You can remove the stroke (outline) of the object, set the color, and determine if it is a flat color or gradient:

  6. In the last tab, Stroke style is where you can most notably set the width of the stroke:

  7. You can also use this tab to determine what types of corners or joins an object has (round or square corners) and how the end caps of the border look like.
  8. The Dashes field gives options for the stroke line type, as shown in the following screenshot:

  9. Start, Mid, and End Markers allow you to add end points to your strokes, as follows:

  10. For our triangle object, use the Fill tab and choose a green color, no stroke, and 100 percent opacity:

What just happened?

You learned where to open the Fill and Stroke dialog, adjust the fill of an object, use blur and opacity, and how to change the stroke color and weights of the stroke line.

Next, let's learn other ways to change the fill and stroke options.

Color palette bar

You can also use the color palette bar to change fill color:

Time for action – using the color palette

Let's learn all the tips and tricks for using the color palette bar:

  1. From the palette bar, click a color and drag it from the palette onto the object to change its fill, as shown in the following diagram:

  2. You can also change an object and the stroke color in a number of other ways:
    • Select an object on the canvas and then click a color box in the palette to immediately set the fill of an object.
    • Select an object on the canvas and then right-click a color box in the palette. A popup menu appears with options to set the fill (and stroke).
    • If you hold the Shift key and drag a color box onto an object, it changes the stroke color.
    • Shift + left-click a color box to immediately set the stroke color.

Note, you can use the scroll bar just below the viewable color swatches on the color palette to scroll right to see even more color choices.

What just happened?

You learned how to change the fill and stroke color of an object by using the color swatches on the color palette bar on the main screen of Inkscape.

Dropper

Yet another way to change the fill or stroke of an object is to use the dropper:

Let's learn how to use it.

Time for action – using the dropper tool

Open an Inkscape file with objects on the canvas or create a quick object to try this out:

  1. Select an object on the canvas.
  2. Select the dropper tool from the toolbar or use the shortcut key F7 .
  3. Then click anywhere in the drawing with that tool that has the color you want to choose. The chosen color will be assigned to the selected object's fill. Alternatively, use Shift + click to set the stroke color.
  4. Be aware of the tool control bar and the dropper tool controls, shown as follows:

  5. The two buttons affect the opacity of the object, especially if it is different than the 100% setting.
    • If Pick is disabled, then the color as chosen by the dropper looks exactly like it is on screen
    • If Pick is enabled and Assign is disabled, then the color picked by the dropper is one that the object would have if its opacity was 100%
    • If Pick is enabled and Assign is enabled, then the color and opacity are both copied from the picked object

What just happened?

By using the dropper tool, you learned how to change a color of another object on the screen.

Inkscape Beginner’s Guide Create attractive layout designs, logos, brochures, icons, and more using the Inkscape vector graphics editor with this book and ebook.
Published: May 2012
eBook Price: £14.99
Book Price: £24.99
See more
Select your format and quantity:

(For more resources on Inkscape, see here.)

Grouping

You can combine several objects into what we call a group. The group then, can be moved or transformed (made larger/smaller) as if it were one object.

Time for action – grouping objects

When grouping objects, there is no limit to the number of objects that can be grouped together. You can also take multiple groups and group them together as well. Let's start with a simple example of how to group objects:

  1. Open an Inkscape document and draw separate objects to create the shape of a sun as follows:

  2. Now select all the objects on your screen. Click the select tool and then click and drag a bounding box around all objects that you want in the group or press the Ctrl + A key and select all objects on the canvas:

  3. Once all the objects are selected, from the main menu select Object | Group or use the Ctrl + G shortcut keys, as shown in the following screenshot:

    You'll notice the bounding box that was once around each individual object has now bound around the entire group of objects. You'll also notice in the status bar that a group is selected and the number of objects it contains (group of objects in layer ).

  4. Now you can select the group and move it on the canvas. Notice, all of the objects move as one:

  5. You can also transform the object by dragging any corner node to make the group of objects smaller or bigger. You can even drag those handles and skew and rotate the group of objects as follows:

  6. To add additional objects to this group, double-click the group itself then draw or paste the new object to be included. To ungroup, select the group and then from the main menu select Object | Ungroup (or use the shortcut keys Ctrl + U). If you have grouped more than one group, ungrouping will only "disconnect" the topmost level of grouping; you'll need to ungroup repeatedly to keep ungrouping objects.
  7. If you want to edit an object within a group, you don't have to ungroup it. Just press the Ctrl key and click that object and it will be selected and editable. Alternatively, select the node tool and click the individual object within a group for editing.

What just happened?

You were able to group several objects and then manipulate that group of objects as one— moving, transforming, and editing it. We even discussed a little trick about editing individual objects within a group.

Clipping and masking

Another way of joining objects is to use clips and masks. These features are used to determine which parts of an object are visible. Clips define what areas of another object are fully visible. Technically speaking, Inkscape takes the top object's path in and clips all the paths below it (in the selection) to the shape of the top path.

When you use a mask it visually crops objects with transparent areas to become fully transparent in the masked object, white areas become fully opaque, and all other colors translate into different levels of opacity in the masked object. To make sure this is clear, we'll do a few exercises.

Time for action – clipping objects

Let's build out our triangle object and create a tree that has a pattern of leaves in it:

 

  1. Open your triangle Inkscape file.
  2. Use the Bezier tool and create a rectangular shape below your triangle, as shown in the following diagram:

  3. Remember if you don't get the lines exactly right the first time, select the Edit Paths by Nodes tool and adjust by dragging the nodes to the appropriate locations.
  4. Draw another rectangular object below the previous one, as shown in the following diagram:

  5. And draw the final rectangle below the last one as follows:

  6. Now we are going to focus on making the left sides of the three rectangular objects more rounded and smooth. Select the first rectangle and choose the Edit Paths by Nodes tool.
  7. Add a node on the left side of that rectangular object:

  8. Select the smooth node option from the control bar:

  9. Your left side will now become a curve, as shown in the following diagram:

  10. Repeat, adding a node and smoothing the left side of each of the remaining two rectangles as follows:

  11. On the bottom rectangle, add another node in the middle of the bottom side and smooth it so it has a more rounded side to it, as shown in the following diagram:

  12. Now it is time to adjust the color and stroke of each of the objects on the canvas. Move the color palette bar scroll bar to the right to get to a set of green colors as follows:

  13. Select the top triangle and choose a light color green for it:

  14. Select each of the rectangles and give an increasingly darker green color to them as follows:

  15. Now select all objects on the canvas (Ctrl + A) and remove the stroke:

  16. With all of the objects still selected on the canvas, create a duplicate of them. From the main menu select File | Duplicate (or use the Ctrl + D shortcut keys).

  17. Click the flip horizontally button:

  18. Move the objects so they mirror the original shapes, as shown in the following diagram:

  19. Add a long vertical rectangle at the bottom for the leaf stem:

  20. Again, select all objects on the screen by pressing Ctrl + A and group them so they become one object. From the main menu select Object | Group or use the Ctrl + G shortcut keys. You have created one leaf!
  21. Select your leaf, press the Shift key, and then drag the handle of the bounding box inward to scale your leaf smaller.
  22. With the leaf still selected, from the main menu choose, Edit | Clone | Create Tiled Clones... as shown in the following screenshot:

  23. From the Clone dialog, for Rows, columns: adjust to 10 x 10 and click Create , as shown in the following screenshot:

  24. Your canvas will now have a pattern/grid of leaves on it:

  25. Press Ctrl + A to select all of the leaves and then use the Ctrl + G shortcut keys to group them.
  26. Use the Bezier tool and create a simple triangle tree shape, as shown in the following diagram:

  27. Make sure that the basic tree you just created (that will be used as a clip or mask) overlaps the others. You can use the Ctrl + Page Up keys to ensure an object is the topmost object.
  28. Press Ctrl + A to select all objects on your canvas.
  29. In the main menu select Object | Clip | Set, as shown in the following screenshot:

  30. You can see how the top object becomes the shape of the object with the bottom object peeking through. Note, if you select three objects (instead of grouping) and perform a clip, you'll end up with two separate clipped objects:

  31. Just like in a group, if you double-click a clip, you will be able to select and edit the objects within it.

  32. To edit the actual clip (or mask), you will have to release it first. From the main menu select Object | Clip | Release.

What just happened?

We took some objects, built a leaf object, cloned it to make a pattern, and used that to create a clipping mask. We even learned a few details about how to edit objects within the clip as well as releasing.

Time for action – masking objects

Here are some quick steps to see what a mask will look like:

  1. Use the same objects in an open Inkscape document as in the previous example. This time, however, let's make the background leaves black and the tree in front a grayscale color as follows:

  2. Press Ctrl + A to select all objects on your canvas.
  3. In the main menu select Object | Mask | Set.

  4. In this result, the top object also becomes the overall shape, while the bottom peeks through. However, you will notice the degrees of grayscale setting over the entire object now. Masking depends only on grayscale. Thus, when using white, the objects below will be fully visible; when using black, the objects below will be fully blocked; and any gray level in between, the objects will be partially masked as in our example:

  5. Just like in a group, if you double-click a clip, you will be able to select and edit the objects within it.

  6. One other item to note here is that the resulting masked object will have a bounding box that will be as large as the largest object, which will make it hard to scale and align in some design situations.
  7. To edit the actual clip (or mask), you will have to release it first. From the main menu, select Object | Mask | Release.

What just happened?

This time we created a mask and learned how to edit and release it in Inkscape.

Summary

You should be ready to move forward and learn even more about creating paths into complex shapes. We spent most of this article learning about the nuances of objects in Inkscape; how to build the predefined shapes and then how to combine and alter them using fills, strokes, clips, masks, and more. Now, we will learn about paths and how to manipulate them.


Further resources on this subject:


Inkscape Beginner’s Guide Create attractive layout designs, logos, brochures, icons, and more using the Inkscape vector graphics editor with this book and ebook.
Published: May 2012
eBook Price: £14.99
Book Price: £24.99
See more
Select your format and quantity:

About the Author :


Bethany Hiitola

Bethany Hiitola is a working writer and technology geek. With a degree in Scientific and Technical Communications, she's worked as a technical writer and multimedia developer for over 12 years—she spends the rest of her time as a wife, mother, gadget geek, and Master of the Household. She's written more user manuals than she can count, essays, novels, and a few technical books—including Inkscape 0.48 Essentials for Web Designers. More details are at her website: bethanyhiitola.com

Books From Packt


Inkscape 0.48 Essentials for Web Designers
Inkscape 0.48 Essentials for Web Designers

Inkscape 0.48 Illustrator's Cookbook
Inkscape 0.48 Illustrator's Cookbook

Inkscape 0.48 Essentials for Web Designers: LITE
Inkscape 0.48 Essentials for Web Designers: LITE

GIMP 2.6 cookbook
GIMP 2.6 cookbook

Blender 2.5 Materials and Textures Cookbook
Blender 2.5 Materials and Textures Cookbook

Blender 3D 2.49 Architecture, Buildings, and   Scenery
Blender 3D 2.49 Architecture, Buildings, and Scenery

OpenSceneGraph 3   Cookbook
OpenSceneGraph 3 Cookbook

OpenSceneGraph 3.0: Beginner's Guide
OpenSceneGraph 3.0: Beginner's Guide


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software