Outils pour utilisateurs

Outils du site


issue183:inkscape

Ceci est une ancienne révision du document !


One interesting aspect of the new ‘Live Path Effects’ Selector dialog is a small toggle at the right of the toolbar, labelled “Show Experimental”. Turn this on, and your collection of LPEs will be augmented by a few others, each with a classic cherry bomb as its icon.

The cherry bomb has a long history in computer interfaces as a means to indicate something has gone wrong – the most famous instances being in the crash dialog of earlier MacOS releases, and to indicate boot problems on the Atari ST (whose GEM interface took rather a lot of “inspiration” from MacOS). In the case of Inkscape, however, it serves as a warning that using these LPEs is risky. Not only are they likely to be buggy, but there’s also no guarantee that images you create using them will be supported in future versions. Generally, therefore, I recommend leaving the Show Experimental switch disabled – unless you wish to engage in the selfless act of actually trying the experimental LPEs in order to provide some useful feedback to the developers. Definitely don’t use them for real work though.

The good news is that the best LPEs can, in time, be promoted out of the “experimental” stage and into the suite of fully supported effects. Such is the case with the Boolean Operation effect, which was experimental in version 1.0, but received enough polish and stability fixes to make it to the big time in Inkscape 1.1.

Boolean Operation

I’m going to assume that anyone reading this is already familiar with the existing boolean operations in Inkscape, found under the Path menu. If not, then you may wish to have a read of part 7 of this series, from way back in FCM #67! In short, boolean operations take two paths and manipulate them in different ways – such as joining them together into a single object (the “union” operation), cutting the shape of one out of the other (“difference”) and keeping just the parts where they overlap (“intersection”), or where they don’t overlap (“exclusion”).

Using these operations from the Path menu is as simple as selecting two paths and then choosing the appropriate menu entry. You may also need to alter the stacking order of your paths, depending on the operation you’re performing, as some of them produce different results if the roles of first and second operand are reversed. Inkscape uses the z-index of the paths to determine which is which.

With LPEs, things aren’t quite so simple when multiple paths are required. You can’t just select your two paths and add the effect. Instead, you have to begin by selecting your first operand path and add the Boolean Operation LPE to it in the normal manner. This will bring up the effect’s parameters:

With just one path, a boolean operation won’t do anything, so we need to add the second operand. This is done with the usual complex and frustrating method of copying it to the clipboard and “linking” it into the LPE: 1. Select the second operand path on the canvas. This will de-select the first one, so you’ll lose access to the LPE parameters. 2. Copy the selected path to the clipboard (Ctrl-C). 3. Re-select the first operand path in order to re-enable the LPE parameters. 4. Click on the “Link to item” button in the LPE controls (the one that looks like a clipboard).

Note that you’re not actually pasting the second path into the LPE, but rather using this convoluted technique in order to add a reference to the path – a “link” in the terminology used in LPEs. That means you are still free to make changes to the second path, and don’t need to go through this rigmarole each time: the link is live, so changes propagate automatically.

With two paths added, the actual result will largely depend on the value selected in the “Operation” pop-up menu. The “Swap operands” checkbox can be used to change Inkscape’s notion of which order the operands should be applied in (equivalent to swapping the z-index order when using the traditional boolean path operations). For some cases this will have no effect on the output. The image below gives you an idea of how these two controls work when applied to a pair of simple shapes.

At the top of the image is the original pair of paths. In each case, the LPE was applied to the orange square, with the teal circle being linked via the clipboard. The columns below show the effect of applying each operation, with the top object being the default output, and the bottom one showing the effect of ticking the “Swap Operands” checkbox.

The results are fairly self-explanatory, especially if you’re already familiar with the standard boolean operations in Inkscape. It’s worth noting that the operation referred to in the LPE as “Symmetric Difference” is, as far as I can tell, the equivalent of Path > Exclusion. I have no idea why the developers opted for different names, as it just adds unnecessary confusion.

One significant difference between the historical boolean operations and this LPE is with the output from the Division operation. With the old-style path operations the result is a pair of objects which can be dragged apart. You can see this in the image below, which shows the original objects, the immediate result of the Path > Division operation, and the effect of dragging the top-right object away.

With the LPE version, the initial output looks similar, however trying to move the top-right part actually just changes the position of the second operand path. In order to separate the parts (i.e. to actually divide them), you have to take the additional step of “fixing” the LPE by using Path > Object to Path. Of course, once you’ve done that, you no longer have the benefit of any “liveness”, so you may as well have just used the older approach in the first place.

Moving on with the parameters for the effect, next we have a checkbox labelled “Remove Inner” – but only if you’re using version 1.1. This checkbox only had an effect on some operations that were ultimately removed from this LPE for the 1.1 release due to stability issues, so there’s no need to consider it further. It’s been removed entirely from Inkscape version 1.2.

The last two parameters concern the fill rule which is applied to each path. The first pop-up governs the path that the LPE is applied to, while the second is for the one added via the clipboard. Fill rules are one of the more obscure parts of vector graphics, and essentially set the rules for how complex paths with self-intersections or sub-paths should be treated when applying the fill color. You may have encountered them via the toggle buttons in the Fill & Stroke dialog (see part 95 of this series, in FCM #155).

In this image, you can see what happens when I turn the original objects into complex paths with several sub-paths. The top image shows the objects with no LPE applied (with the “evenodd” fill rule applied via the Fill & Stroke dialog). The second image shows the effect of applying the “Symmetric Difference” (aka Exclusion) effect with both pop-ups set to “non-zero”; the third is the same but with them both set to “even-odd”.

In my experience, the “positive” option just makes the objects disappear, but that might simply be an effect of the paths I’m using. The “take from object” option honours the setting in the Fill & Stroke dialog, so, in this case, the output is the same as the bottom image. My advice is to leave these pop-ups set to “take from object”, and only fiddle with them if you have complex paths and aren’t getting the result you would like in terms of the areas being filled.

As we’ve seen, the Boolean Operation effect will accept only two paths: the first operand (on which the LPE is applied) and the second operand (added via the clipboard). This is unlike some other LPEs which allow you to add multiple linked paths into a list. This is a shame, because some boolean operations could easily be extended to multiple objects, while others could simply treat a list of paths as a sequence of operands, applying them one at a time to the output from the previous operation. Instead, should you wish to apply multiple boolean operations using this LPE, you’ll have to add several instances of it to your effects list. In itself, this isn’t a problem, but you can quickly end up with a series of entries, all just labelled as “Boolean operation”, which can make it hard to keep track of what each operation is for.

Personally, I’m more likely to stick to the old-fashioned boolean operations. While it’s great to have a “live” version of these, allowing for subsequent tweaks and changes, the means of applying them is a little fiddly (as with all multi-path LPEs, to be fair), and their liveness means that they not only require more processing power to display, but are also more likely to expose bugs in the implementation (I suffered several hard crashes while creating the screenshots for this article!). LPEs also aren’t recognised by other applications, or web browsers, so although the output should look the same in theory, you get a better guarantee of that with the older operators that make permanent changes to the underlying paths.

Slice

For many use cases, the Slice LPE will likely give a better result than the Boolean Operation effect in Division mode. As noted above, this mode does not actually produce separate objects until you “fix” the effect. The Slice effect, on the other hand, does split your object into two separate parts that can be moved, and even styled, independently of each other. It is limited to splitting along a straight line, however, so the “square and circle” example I used for Division can’t be replicated using Slice. It’s a pretty easy LPE to use. Just select your object and add the effect. The object will be broken into two with a vertical split down the middle, and the two parts can be moved and styled separately, as shown in this simple example of applying the Slice LPE to a star. The parameters for this effect are pretty simple, too.

The three buttons do exactly what you would expect from their labels: • Remove any style changes that have been applied to the individual parts • Use a vertical slicing line • Use a horizontal slicing line

I’ve used the term “slicing line” to indicate that this is a straight line, not an SVG-style path that could have corners and curves. But you’re not limited to horizontal and vertical slicing: the coordinate boxes below can be used to set any start and end points for the line, allowing angled slicing lines to be used as well. In practice, nobody is likely to fill in the numbers here, though, as you can switch to the Node tool (F2) in order to move and rotate the slicing line on-canvas instead. This approach makes it easy and intuitive to adjust the line to suit your needs.

The “Allow Transforms” checkbox is a vital part of this effect – and one you’ll most likely want to leave enabled all the time. If this is unchecked then you won’t be able to move the individual parts around (nor skew, scale or rotate them). They’ll stay in their original location, relative to the source path, which may be useful if you want to style only parts of the shape differently, but don’t want to adjust their positions. For most people, however, slicing a path implies a need to move the pieces around, for which this needs to remain checked.

If you do want your shape cut into more than two parts you can apply the Slice effect more than once. Here’s how our star looks with an additional set of angled slicing lines applied to each half, and a bit more variation in the styling.

Of course, the Slice LPE can be combined with other effects. Here are our earlier complex paths, with the Boolean Operation effect applied (“Symmetric Difference” mode, “even-odd” for both operands), followed by a pair of Slice effects to produce four complex paths, each with a different fill color.

After several months, we’re now finished with the new LPEs that were added in Inkscape 1.0 and 1.1 (and that’s without considering the experimental ones!). But we’re not quite done yet: next month, I’ll take a look at some important new features that were added to an existing LPE, before moving on to the new extensions that were added in version 1.0.

Update from Inkscape.org

Important Release of Inkscape version 1.2.1 fixes data loss and crash issues

We've just resolved some critical issues in Inkscape 1.2 that were identified by our community. If you're currently using Inkscape 1.2 then this is an important update to install on your device.

It provides a fix for a number of critical bugs in the 1.2 release: • drawing data about filters, markers, gradients and more, now saves to file after performing a simple sequence of copy-paste-undo with the Export dialog open; • startup is smoother when many fonts are installed, and • rasterized (filtered) objects now show up on any page of a multipage document exported to PDF.

This release brings back the built-in ability to open PostScript/Encapsulated PostScript (.ps / .eps) files with Inkscape on macOS. Improvements were also made to user interface translations and documentation translations.

Linux users using the snap packaging format will once again be able to import and export images. Windows users will now see the correct Inkscape version image on install, while users of macOS 10.13-10.15 will be able to open extensions without them crashing.

issue183/inkscape.1659122332.txt.gz · Dernière modification : 2022/07/29 21:18 de d52fr