Outils pour utilisateurs

Outils du site


issue128:inkscape

Ceci est une ancienne révision du document !


Last time I looked at the “Fill Between Many” live path effect, so it makes sense to start this instalment with the closely related “Fill Between Strokes” LPE. I’ll race through this one quickly as, quite honestly, I can see very little benefit in using this effect over its more capable sibling.

Whereas “Fill Between Many” allows you to create a new shape that connects numerous individual paths, “Fill Between Strokes” does the same job, but is limited to a single pair of paths. Once again we also need a sacrificial path to which the effect will be applied (and which will be the source of the style for the resultant object). To demonstrate, my test image consists of a couple of black paths, plus a thick red path with a light red fill to use as the sacrificial path. I could have used a simple straight two-node path for the latter, but, by giving it a bit more shape, it’s obvious that there’s a fill applied.

The first step is, of course, to select the sacrificial path and apply the LPE. This results in a simple UI in the Live Path Effects dialog. Now we have merely to add the two paths we wish to use. As usual when linking a path in an LPE this is a little contrived; you first have to select the path and copy it to the clipboard, but that de-selects the sacrificial path and you lose the UI in the dialog. Re-select the sacrificial path, then use the first button on the “Linked Path” line to “paste” the link to the path into the effect. Do the same for the second path as well. If necessary, you can reverse the second path using the checkbox, but you can’t reverse the first path other than by changing it directly in your drawing. With those steps performed, the result looks like this. This is almost identical to using “Fill Between Many” with only two paths, except that the resultant path isn’t closed – you can see that the thick red stroke doesn’t continue along the bottom of the shape. Given that this appears to be the only real difference between the two effects, my general recommendation is to just stick with the more versatile “Fill Between Many”.

Having largely dismissed one not-so-useful effect, let’s take a look at a couple of others. The first is “Transform By 2 Points”. I’m sure most readers are familiar with the “pinch to zoom” effect on smartphones and tablets – and the extended version that includes rotation and panning which is often used in mapping applications. This LPE essentially brings that same functionality to bear on Inkscape paths. On adding this effect to a path, you’ll be presented with a complex looking interface:

This is another effect where the UI seems to be upside down – all the interesting things are in the bottom section. The buttons at the bottom act as a set of toggles, enabling and disabling different types of transformation. Begin by activating the “Elastic” and “From original width” buttons. If you now switch to the Node tool (F2) you should see that a thin blue line with diamond handles has appeared on your path.

Drag either of the handles around on the canvas and you’ll see your path dynamically stretch and rotate in a very intuitive manner. Leave the “From original width” button enabled but try toggling some of the others on and off to see what effect they each have. It should be clear that this is a very fast and natural way to transform a path so that it fits in a specific gap, or connects visually to other elements in your drawing.

If you turn off the “From original width” toggle you can be even more specific about the path placement. Now the “First Knot” and “Last Knot” fields come into play, by letting you specify nodes in your path that should be used as the start and end of the transformation line. If you need to scale an arbitrary path so that its ends lie at specific points, this will do the trick nicely.

I quite like this effect, but I find it disappointing because it’s just that – an effect. It would be so much better to see a transform option like this make its way into the roster of top-level tools in Inkscape. That would allow you to use the same sort of intuitive control whether you’re transforming paths, shapes, groups or even text.

Next in the roster of effects is “Interpolate Points”. This simply redraws your path using one of five pre-defined interpolations between the nodes. The UI is so minimal that I’m not even going to bother with a screenshot – it’s just a pop-up menu to let you select the type of interpolation you want to use. There’s no way to change the Bézier handles or otherwise adjust the curves, and the selected interpolation is applied to all the path segments; there’s no way to have different values applied to each individual segment or even sub-path. This effect is probably of most use as part of a chain with other LPEs, when you want to change the output of a previous step from straight lines to curves, or vice-versa – but otherwise there’s rarely any good reason to use this effect in preference to modifying your original path. Here’s an example of a simple path rendered using each of the five options:

The last effect I’ll be covering this month is “Join Type”. This lets you set the type of join used between path segments, in much the same manner as the Stroke Style tab of the Fill & Stroke dialog – except that it does have a couple of new tricks up its sleeve, and a big limitation to be aware of. On adding this effect to a path, you’ll be presented with this interface:

The Line Cap pop-up offers the usual options of Butt, Rounded and Square line ends. But it adds a new option as well: Peak. This gives the line ends a slight point, but there are no further options to set the size or angle of the shape. It’s certainly no replacement for the Taper Stroke effect. The Line Width control, on the other hand, offers no surprises. It just alters the width of the stroke.

The Join pop-up again offers the usual options from the Fill & Stroke dialog (Rounded, Beveled, Mitre), but throws in four types of “Extrapolated Arc” options and “Mitre Clip”. More on those shortly. The Mitre option has the usual Mitre Limit control to set the limit at which really tight corners are rendered as beveled rather than a long, thin mitre – but this effect also offers a Force Mitre checkbox to force all the corners to render as mitres, regardless of the Mitre Limit. This is a nice addition that avoids you trying to work out just how large a limit you need to set if you want all your corners pointed.

With the Mitre Clip join type, and Force Mitre turned off, the Mitre Limit control takes on a new purpose. Rather than switching the join to beveled, the mitre is drawn - but cut off, as though truncated by a clipping path, at the length specified in this widget. When dealing with very sharp angles, it provides something of a halfway house between the excessive length of a full mitre and the stubby corner of a bevel. The example below shows a simple path rendered using Beveled, Mitre, Mitre Clip and Rounded joins, with Butt, Peak, Rounded and Square line caps.

As for those Extrapolated Arc options – they do for curved lines what Mitre does for straight ones. The example below shows a path made up of a pair of curved lines with a sharp join between them. The first version has a simple Beveled join, the second extends the join linearly with a Mitre, losing the style of the curve in the process. The third version, however, shows the dramatic result of using an Extrapolated Arc.

The four types of extrapolated arc vary slightly in their rendering in most cases, but the differences can be more pronounced with some paths than others. It’s easiest to just try all of them and see which suits your particular image the best.

As with the Interpolate Points LPE, this effect is all-or-nothing. There’s no way to apply different join types to individual nodes, beyond the effects of the mitre limit. So if you want an extrapolated arc in the middle of a series of rounded joins, for example, you’ll have to manually break the path into separate objects and apply the effect to each of them separately.

Now for the elephant in the room – and it’s the usual pachyderm that we’ve encountered numerous times when looking at path effects. In order to remain compatible with SVG, the Inkscape developers haven’t just added their own line cap and join types to the file format. Instead, as with the Power Stroke and Taper Stroke effects, the results you see here are produced by rendering the path as a filled object. So if you want to use the beautiful extrapolated arcs (or the less impressive peak cap) on an object with a fill, you’ll have to use one of the usual roster of workarounds that I’ve covered in the past – whether that’s manually maintaining a second copy of the object to hold the fill, or using the Fill Between Many LPE to create a clone of your shape for filling.

This month, I’ve looked at what I consider to be some of the less useful new effects. They all have some interesting capabilities, but they also largely overlap with the functionality of other effects or tools. That’s not to dismiss them out of hand, as they do have the ability to fill specific niche use-cases, but I doubt they’ll ever be counted amongst the more commonly used tools in your Inkscape toolbox.

issue128/inkscape.1514628226.txt.gz · Dernière modification : 2017/12/30 11:03 de auntiee