Ceci est une ancienne révision du document !
This month we'll conclude our tour of the Live Path Effects that are available in both versions 0.48 and 0.91 of Inkscape, starting with perhaps one of the most useful.
Pattern Along Path
This effect is often referred to as “PAP” in forum posts and bug reports so, for brevity, I'll do the same here. Like the Spiro Spline effect, PAP can be applied automatically as part of the normal drawing process. To do so, you simply have to draw a shape for use as your “pattern”, copy it to the clipboard, and select the “Shape: From Clipboard” option when using the Pencil or Bézier tools. See part 17 of this series for more details on the technique, but suffice to say that the result is that your path will have the PAP effect applied to it – albeit with some default options selected. Whether you initially apply the LPE like this, or by explicitly adding it via the dialog, you'll find more controls available to you within the dialog's UI, in order to tweak the effect.
“Pattern along path” is something of a misnomer; it should more correctly be called “path along path” as the effect is one of taking a source path (the “pattern”) and stretching or repeating it along the skeleton path. In part 17, for example, I drew a rounded bow-tie shape, copied it to the clipboard, then used it to provide the shape for the Bézier tool, resulting in strokes which appear thinner in the middle.
It's a useful technique, but the same visual result could also be achieved by using the Bend LPE. There's a philosophical difference between the two approaches, though: the Bend LPE uses your “pattern” as the skeleton path, then lets you distort it with an on-canvas path; the PAP approach, however, lets you copy the “pattern” to the clipboard, then stretches it to match the shape of the skeleton path. On the surface, therefore, it all boils down to whether you want the skeleton path to be your pattern or your target, but there's more to the PAP effect than that. The difference really becomes apparent only when you start to change the settings.
Perhaps the most important setting is the “Pattern Copies” pop-up. This defaults to “Single, stretched”, but there are three other options available, giving the following possibilities: • Single, stretched – puts a single copy of your pattern onto the skeleton path, stretching it to the length of the latter (or shrinking it, if the skeleton path is shorter than the length of your pattern). • Single – puts a single copy of the pattern onto the skeleton path. It's distorted to match the shape of the skeleton, but isn't stretched or compressed in length. • Repeated, stretched – puts multiple copies of the pattern onto the skeleton path, stretching each of them in order to fill the length of the latter. • Repeated – puts multiple copies of the pattern onto the skeleton path, but does not stretch them, usually resulting in a path that falls short of the skeleton's length.
You can see these four possibilities shown in order in this example – the green bow-tie at the top is the pattern that's being used, whilst the red line is the skeleton path.
The Pattern Source buttons are the usual quartet used to define the path that's used as the pattern – by editing an on-canvas path, using one from the clipboard, or linking to an existing path. In this case, it's usually easiest to draw your pattern separately, then copy it to the clipboard and use the third button to apply it to your skeleton path. The first button can then be used to display a copy of the pattern on the canvas, for fine-tuning the shape.
The “thickness” of your pattern, perpendicular to the skeleton path, can be set with the Width parameter, with a checkbox to determine whether to use a fixed pixel width, or a multiple of the pattern's length. When using either of the “repeated” options, the gaps between shapes can be set using the Spacing field. Negative values are allowed, but only up to -90% of the pattern width. The Normal Offset can be used to push the pattern to one side or the other of your skeleton path, whilst Tangential Offset pushes it along the length of the path. The latter can be used to adjust the space at the end of the non-stretched options, but also works on the stretched modes to add some space at the start of the path, before the pattern begins. Once again, there's a checkbox to determine whether Spacing or Offsets are in fixed pixel values or proportional to the pattern length.
The penultimate control indicates to Inkscape that the pattern has a vertical orientation rather than a horizontal one. This is particularly useful to apply a vertical pattern to a vertical skeleton path:
Because it effectively rotates the pattern through 90° before applying it to the skeleton, it can also be used to produce a different effect, when used with a horizontal pattern and path.
Of course, the same effect could be produced by simply rotating the pattern before it's used in the LPE.
The final control is used when your pattern is not a closed shape, but has unconnected ends. By setting this to a positive number, any line ends that are separated by less than the specified amount will be fused together to produce a continuous line. In this example, I've lopped off the ends of my bow-tie and slightly shortened the top section to exaggerate the effect. The two PAP examples show the effect of using this pattern with Fuse Nearby Ends set to 0, then set to a suitable positive value. Ruler
This LPE doesn't really require much explanation – it simply draws tick marks perpendicular to your skeleton path to give the appearance of the graduations on a ruler. You can define the distance between tick marks, the frequency of major marks, and the length of both the major and minor ticks. You can also determine which side of the skeleton the ticks will be drawn on, or have them centered to appear evenly on both sides.
One use for this effect is, as the name suggests, to create a ruler. For this example I've used a combined pair of parallel lines for the skeleton path, and overlaid them onto a rounded rectangle and circle.
It's also possible to use this LPE for more artistic effects, though. When combined with other shapes it's easy for your ruler to become a zipper, a simple pathway, or even a protractor. By copying the object and applying different settings and colors to the LPE, you can easily get the effect of coloured rays emanating from your shape.
One frustrating omission from this LPE is the ability to suppress the original skeleton path in the output. This makes it more difficult to chain this effect with others. A workaround is to use Path > Object to Path to “fix” the LPE before manually removing the skeleton path, then applying other effects – but you do then lose the ability to do live edits to the parameters. For example, chaining the Ruler, then PAP effects on a circle, gives a result like the one on the left here, whereas the example on the right shows the “fixed” version with the skeleton removed before the PAP effect is added.
Sketch
This LPE does one simple thing, but, like the Hatches effect, the number of controls greatly exceeds any practical requirements for such a deliberately un-tamed result. In short, this effect simply replaces each part of your path with a number of smaller paths, overlapping and with their ends offset from the skeleton by a semi-random amount. It gives the effect of having sketched your path with repeated strokes of a pencil – and can even include construction lines for extra effect.
At the top of the UI are the controls for setting the number of paths that will be used for approximating each section of the original, and for determining how long each can be and how much they can overlap. Usually it's sufficient to adjust only the top couple of controls to set the “density” of the sketch strokes – fewer, longer strokes for a light sketch effect, more short strokes for the appearance of a more heavily scribbled line.
The Average Offset and Max Tremble controls are useful for determining the “thickness” of the sketched result. There's also a control for the number of construction lines – set it to zero if you don't want any. In this same area of the UI, the Max Length parameter is useful to sufficiently extend your construction lines from the original shape. As with the Hatches LPE, the dice buttons can be used to set a new random seed used for some of the parameters, which is only really of use for making otherwise identical copies look dissimilar.
Note that this effect can easily produce lots of new nodes, so be careful when using it as anything other than the last LPE in a chain. Here's a small showcase of the kind of results it can produce.
Stitch Sub-Paths
This effect can be thought of as a perpendicular version of the Interpolate Sub-paths LPE that I described last month. Whereas that creates a connection between two sub-paths by introducing interstitial versions that gradually distort from the shape of one path to the other, the Stitch effect joins the two sub-paths directly with a series of new paths that link evenly spaced points on one path to evenly spaced points on the other. In other words, it draws some lines from one sub-path to another.
Once again there are too many controls to be useful. You really only need the first parameter – for setting the number of new paths to draw – and the quartet of buttons for manipulating the “Stitch path”. Most of the other controls are there to let you add some randomness to your stitches, should you wish.
In its simplest form, this effect just draws straight lines from one sub-path to another. It can work on shapes with more than two sub-paths, but, for anything other than simple shapes, it can be rather unpredictable as to what the result will be. By using the buttons to paste, link to, or modify a stitch path, you can replace the straight-line stitches with something more complex. It can be good for adding a little curvature to the lines, but once again it becomes difficult to control the result as things get more complex.
In the example above, you can see, in the left hand column, some simple stitching between two basic shapes. The middle and bottom examples show the effect of altering the shape of the stitch path. The stars show a simple stitching, the application of some randomness via the UI, and the result of bending the stitch path (skeleton path omitted for clarity).
VonKoch
Finally we have the VonKoch LPE. If the name sounds familiar, then perhaps you've come across the Koch Snowflake – a fractal shape created by recursively replacing the middle of each side of an equilateral triangle with a smaller equilateral triangle. It was derived from a paper by Swedish mathematician Helge von Koch, who described the process for one side of the snowflake shape, creating a “Koch curve”. This image shows the first four iterations of the curve:
When you apply this LPE, you'll find that a pair of new copies of your path appear on the canvas. Within the UI you'll also find path buttons for a “Reference Segment” and a “Generating Path”. The two new paths you can see correspond to two sub-paths within the Generating Path. If you use the third button to paste a different path in, you'll see the number of copies change to reflect the number of sub-paths in the new Generating Path. Somewhat ironically, you have to paste in a new path to create a Koch curve, as this requires four copies, not two – so immediately the LPE makes it difficult for a layman to create its eponymous fractal! The Reference Path is used to position the copies on their Generating Path segments – essentially the skeleton is scaled and positioned such that the Reference Path lies on top of each Generating Path segment.
If that makes it all sound rather confusing, that's because it is! To adequately explain the operation of this LPE would require an article of its own. If you do wish to explore this one further, I recommend reading Tavmjong Bah's description in the official Inkscape manual, which also includes step-by-step instructions for creating a Koch curve: http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-LivePathEffects-VonKoch.html
If you do persevere with this LPE, it can produce some impressive results – as well as a lot of frustration. I did manage to create a Koch Snoflake, the Sierpinski triangle (another stalwart of fractal geometry), and a Sierpinski arrowhead curve, but it is a far from intuitive process.