16.1 Creating a Clone

To clone one or several objects, just select them and press (or use EditCloneCreate Clone). The visible result of this is exactly the same as that of duplicating (): A copy of each selected object is created and placed on top of the original. If you need to get a clone of several objects as a whole, just group them together and clone the group.

A clone is a linked copy of an object. What constitutes this link?

Most importantly, a clone copies the original’s content. If it is a clone of a path (Chapter 12) or a shape (Chapter 11), then it exactly reproduces the form of the original, and it updates automatically when you edit the original in the Node tool or in a shape tool. If it is a clone of the text, it has the same textual content and is also updated live when you edit the original with the Text tool. Finally, if you clone a group, you can then enter that group (5.10 Selecting in Groups) to add, delete, or edit objects within the group—and the group’s clone will update immediately. On the other hand, since a clone has no content of its own, you cannot edit its content—no node editing, text editing, or ungrouping is possible on a clone so long as it remains a clone.

A clone is a linked copy of an object.

Figure 16-1. A clone is a linked copy of an object.

What about transforms? If you scale, rotate, or skew the original, all its clones will do the same. However, if you just move the original object, by default the clone will not be affected (although that can be changed, see below). Of course if you select both the original and its clone, you can transform them together in any way, by moving or otherwise.

Clones respond to the original’s transforms, except for moving.

Figure 16-2. Clones respond to the original’s transforms, except for moving.

You can also move, scale, rotate, or skew the clone completely independently of its original. The clone’s own transform is applied on top of the transform inherited from the original. For example, if you squeeze a clone vertically and then rotate its original, the clone will be both rotated and squeezed—but the vertical squeeze will be applied to the shape after it is rotated, resulting in a skew, as shown in Figure 16-3.

The style of the original is also passed on to its clones. If you paint the original a different fill or stroke color, all its clones will take the same color at once.

A clone’s own transform is applied on top of the transform inherited from the original.

Figure 16-3. A clone’s own transform is applied on top of the transform inherited from the original.

Conversely, if you try to paint a clone, it will simply refuse to change its color, remaining true to its original. (Again, this rule has exceptions, as we will see below.)

To summarize, here’s a table that lists various things you can and cannot do on a clone and its original and how those changes affect one another:

 

Move

Scale, rotate, skew

Node or shape edit

Style

applied to original

does not affect clones (by default)

does affect clones

does affect clones

does affect clones

applied to clone

is possible

is possible (on top of original’s transformation)

is impossible

is impossible (unless unset in the original)

SVG

In SVG source, a clone is represented by an svg:use element. Its xlink:href attribute contains a URL pointing to the original of this clone. Per the SVG standard, this URL can point to any element, be it within the same document or in a different document anywhere on the Internet. However, Inkscape does not yet support cross-document references, so any clone created in Inkscape must have its original in the same document.