issue180:inkscape
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue180:inkscape [2022/04/30 20:48] – créée d52fr | issue180:inkscape [2022/05/09 12:28] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | This month doesn’t just mark 15 years of Full Circle Magazine – I also celebrate a full decade of writing these Inkscape columns! Many thanks to everyone who has read any of them over the years, and I hope you’ve found them useful. One thing I’ve always tried to do is to explain the underlying reasons for some of the oddities and limitations in the way Inkscape operates, and this month is no different. Having described the operation of the Measure Segments LPE last time, in this instalment I’m going to look behind the curtain at how this effect differs quite radically from those that came before it. Please note, however, that this is just for information and education – you don’t actually need anything in this instalment to simply use the LPE in the way it was intended. | + | **This month doesn’t just mark 15 years of Full Circle Magazine – I also celebrate a full decade of writing these Inkscape columns! Many thanks to everyone who has read any of them over the years, and I hope you’ve found them useful. One thing I’ve always tried to do is to explain the underlying reasons for some of the oddities and limitations in the way Inkscape operates, and this month is no different. Having described the operation of the Measure Segments LPE last time, in this instalment I’m going to look behind the curtain at how this effect differs quite radically from those that came before it. Please note, however, that this is just for information and education – you don’t actually need anything in this instalment to simply use the LPE in the way it was intended. |
First, a quick reminder of how Live Path Effects worked historically. An LPE was applied to a single path, and produced a single path as its output. The output path would replace the source path in the image. Here’s a very simple example: the Roughen LPE, when applied to the two-node path on the left, produces the multi-node path on the right. | First, a quick reminder of how Live Path Effects worked historically. An LPE was applied to a single path, and produced a single path as its output. The output path would replace the source path in the image. Here’s a very simple example: the Roughen LPE, when applied to the two-node path on the left, produces the multi-node path on the right. | ||
- | Looking at this in the XML editor, we can see that there’s still only a single path object, but as well as a multi-node “d” attribute, it also contains an “original-d” attribute (in the “inkscape” namespace”) which has only the two nodes of the original path. | + | Looking at this in the XML editor, we can see that there’s still only a single path object, but as well as a multi-node “d” attribute, it also contains an “original-d” attribute (in the “inkscape” namespace”) which has only the two nodes of the original path.** |
- | This is a pretty clever way to implement LPEs. Inkscape understands the extra attributes in its own namespace, so is able to treat the effect as a live, editable feature, while other SVG renderers, such as web browsers, will still show the result of the LPE since it’s just a normal “d” attribute like you would find on any SVG path object. | + | Ce mois-ci ne marque pas seulement les 15 ans du magazine Full Circle ; je célèbre également une décennie complète de rédaction de ces chroniques sur Inkscape ! Un grand merci à tous ceux qui les ont lues au fil des ans ; j' |
+ | |||
+ | Tout d' | ||
+ | |||
+ | En regardant cela dans l' | ||
+ | |||
+ | |||
+ | **This is a pretty clever way to implement LPEs. Inkscape understands the extra attributes in its own namespace, so is able to treat the effect as a live, editable feature, while other SVG renderers, such as web browsers, will still show the result of the LPE since it’s just a normal “d” attribute like you would find on any SVG path object. | ||
This approach does, however, come with one big limitation. Because the output is just a single path, it can be given only one style. Even if that path appears to be multiple separate shapes, it’s actually just a single SVG path element, with gaps in the shape described by the “d” attribute (i.e. with sub-paths). If we look at the same two-node path with the “Ruler” path effect applied instead, you can see that the result gives the appearance of numerous small paths. While it would be nice to be able to style the ruler’s tick marks separately from the main spine of the shape, that simply isn’t possible because, despite appearances, | This approach does, however, come with one big limitation. Because the output is just a single path, it can be given only one style. Even if that path appears to be multiple separate shapes, it’s actually just a single SVG path element, with gaps in the shape described by the “d” attribute (i.e. with sub-paths). If we look at the same two-node path with the “Ruler” path effect applied instead, you can see that the result gives the appearance of numerous small paths. While it would be nice to be able to style the ruler’s tick marks separately from the main spine of the shape, that simply isn’t possible because, despite appearances, | ||
- | With the release of version 1.0, Inkscape has added the ability for path effects such as “Measure Segments” to break this historical limitation. No longer is an LPE limited to one path in, one path out. Let’s apply “Measure Segments” to the same two-node path: | + | With the release of version 1.0, Inkscape has added the ability for path effects such as “Measure Segments” to break this historical limitation. No longer is an LPE limited to one path in, one path out. Let’s apply “Measure Segments” to the same two-node path:** |
- | Immediately we can see that there are multiple styles being applied here. Our original path maintains the thicker style we used when drawing it, but the lines added by the LPE are significantly thinner. How is this possible? Quite simply, the lines added by the LPE are no longer just sub-paths in a “d” attribute, but are additional SVG < | + | C'est une façon très intelligente d' |
+ | |||
+ | Cette approche comporte toutefois une limite importante. Comme la sortie n'est qu'un seul chemin, on ne peut lui donner qu'un seul style. Même si ce chemin semble être constitué de plusieurs formes distinctes, il s'agit en fait d'un seul élément de chemin SVG, avec des espaces dans la forme décrits par l' | ||
+ | |||
+ | Avec la sortie de la version 1.0, Inkscape a ajouté la possibilité pour les effets de chemin tels que « Mesurer les segments » de briser cette limitation historique. Un LPE n'est plus limité à un chemin d' | ||
+ | |||
+ | **Immediately we can see that there are multiple styles being applied here. Our original path maintains the thicker style we used when drawing it, but the lines added by the LPE are significantly thinner. How is this possible? Quite simply, the lines added by the LPE are no longer just sub-paths in a “d” attribute, but are additional SVG < | ||
In addition to our original path, we now have three extra < | In addition to our original path, we now have three extra < | ||
- | Intuitively, | + | Intuitively, |
- | As you’ll know from last month’s instalment, the color, font, line thickness, and other aspects of the Measure Segments LPE are set as part of the effect’s parameters, split between the “General” and “Options” tabs. Should we wish to make the dimensions match the color of the original path, for example, we’ll need to manually set it via the “Color and opacity” control in the “Options” tab. There’s no means of linking or inheriting styles, though, so if you subsequently change the stroke color of the original path, you’ll have to also remember to manually alter the LPE parameters to suit. | + | Nous pouvons immédiatement constater que plusieurs styles sont appliqués ici. Notre chemin d' |
- | If we can’t select the new elements using the mouse on the canvas, is there another approach we could use? Selecting individual elements within the XML editor does still work, and selects the corresponding item on the canvas when you do so. Even with that selection made, mouse interactions are restricted: you can drag the resize handles, but still can’t drag the object itself to move it (though using the cursor keys will work); you also can’t click on the object in order to switch to the rotate/skew handles or other modes now available with the selection box. You can change the style though, as demonstrated by this image of a multi-colored dimension line, complete with gradients and a different font. | + | En plus de notre chemin d' |
- | There’s just one problem with this approach, and it’s something of a deal-breaker. The “L” in LPE stands for “Live” because the output from an LPE is calculated dynamically whenever the original path changes, or the parameters are adjusted. This means that any manipulation of the original path – even just nudging the position of one of the nodes – or any changes to the LPE parameters, will cause the output to be recalculated and all your manual changes to be discarded. You might think that this is okay, so long as you do your changes last, and then don’t touch the object again, but the LPE output is also calculated when your file is loaded from disk: save the file, and reopen it later, and your manual changes are gone. There’s simply no way to manually edit the parts of the LPE such that Inkscape won’t throw your changes away at some point. | + | Intuitivement, vous pourriez essayer de cliquer sur l'un des nouveaux éléments du canevas afin de le sélectionner, mais vous constaterez que vos clics sont vains. Faire glisser une boîte de sélection élastique ne fonctionne pas non plus. La seule chose que vous pouvez sélectionner est le chemin d' |
- | The reason that these new elements are not selectable on the canvas is that they’re all created in a “locked” state. The ability to lock objects has been in Inkscape for a long time, but has generally been a poor substitute for keeping objects arranged in suitable layers and locking the whole layer instead. This is because a locked object is difficult to unlock again – after all, you can’t select it with the mouse to indicate which object you want to unlock. This situation improved with the release of Inkscape 1.0, which added an “Unlock Objects Below” entry to the context menu (see part 101 of this series for more details). Perhaps we could use that to allow easier editing of the individual components of our dimension line? | ||
- | Sure enough, right-clicking on the dimension, and selecting | + | **As you’ll know from last month’s instalment, the color, font, line thickness, and other aspects of the Measure Segments LPE are set as part of the effect’s parameters, split between the “General” and “Options” tabs. Should we wish to make the dimensions match the color of the original path, for example, we’ll need to manually set it via the “Color |
- | So what’s the solution? Is there a way that we can style the individual | + | If we can’t select |
- | The way to achieve this is to use the Path > Object to Path menu entry. Historically, this has been the mechanism used to “fix” the output of an LPE, collapsing all the “live” parts of the effect chain to produce just a plain and simple SVG path that has the same appearance as the final LPE output. With the Measure Segments | + | Comme vous l'avez appris dans l' |
- | For most people, all this talk of styling parts of the Measure Segments LPE will be somewhat academic. In the vast majority of cases, the normal output from the effect will be sufficient, and the parameters it provides will give enough flexibility to style the new elements well enough. If more complex adjustments are needed, then using Object to Path will usually suffice, even if it does mean sacrificing live updates of the dimensions. It would be great if Inkscape offered a means to indicate that an element has been manually styled, but that you still want the position and text content to update, but perhaps that’s too niche a requirement to warrant the development time. | + | Si nous ne pouvons pas sélectionner les nouveaux éléments à l'aide de la souris sur le canevas, y a-t-il une autre approche que nous pouvons utiliser ? La sélection d' |
- | Even if you don’t want to style the dimension parts, however, there’s one significant aspect of this LPE’s approach that you should be aware of, because the behaviour is quite surprising, and could easily catch you unawares. The behaviour of Measure Segments with regard to layers is, in my opinion, broken. | + | **There’s just one problem with this approach, and it’s something of a deal-breaker. The “L” in LPE stands for “Live” because the output from an LPE is calculated dynamically whenever the original path changes, or the parameters are adjusted. This means that any manipulation of the original path – even just nudging the position of one of the nodes – or any changes to the LPE parameters, will cause the output to be recalculated and all your manual changes to be discarded. You might think that this is okay, so long as you do your changes last, and then don’t touch the object again, but the LPE output is also calculated when your file is loaded from disk: save the file, and reopen it later, and your manual changes are gone. There’s simply no way to manually edit the parts of the LPE such that Inkscape won’t throw your changes away at some point. |
+ | |||
+ | The reason that these new elements are not selectable on the canvas is that they’re all created in a “locked” state. The ability to lock objects has been in Inkscape for a long time, but has generally been a poor substitute for keeping objects arranged in suitable layers and locking the whole layer instead. This is because a locked object is difficult to unlock again – after all, you can’t select it with the mouse to indicate which object you want to unlock. This situation improved with the release of Inkscape 1.0, which added an “Unlock Objects Below” entry to the context menu (see part 101 of this series for more details). Perhaps we could use that to allow easier editing of the individual components of our dimension line?** | ||
+ | |||
+ | Il n'y a qu'un seul problème avec cette approche et il s'agit d'une sorte de rupture de contrat. Le « L » de LPE signifie « Live » (en direct), car la sortie d'un LPE est calculée dynamiquement chaque fois que le chemin original change ou que les paramètres sont ajustés. Cela signifie que toute manipulation de la trajectoire d' | ||
+ | |||
+ | La raison pour laquelle ces nouveaux éléments ne sont pas sélectionnables sur le canevas est qu'ils sont tous créés dans un état « verrouillé ». La possibilité de verrouiller des objets existe depuis longtemps dans Inkscape, mais elle s'est généralement révélée être un piètre substitut au maintien des objets dans des couches appropriées et au verrouillage de la couche entière. En effet, un objet verrouillé est difficile à déverrouiller à nouveau - après tout, vous ne pouvez pas le sélectionner avec la souris pour indiquer quel objet vous voulez déverrouiller. Cette situation s'est améliorée avec la sortie d' | ||
+ | |||
+ | |||
+ | **Sure enough, right-clicking on the dimension, and selecting the Unlock option from the context menu, does make the individual elements selectable with the mouse. Now they can be individually styled, and can even be clicked on to switch to the rotate/skew handles and other selection box modes. Internally, what has happened is that the “sodipodi: | ||
+ | |||
+ | So what’s the solution? Is there a way that we can style the individual parts of the dimension lines beyond the limited options provided in the LPE parameters? Well, there is… but only in a way that removes their link to the original path. For example, do you want to style the leader lines as dashes, or with a different thickness to the arrowed dimension line? It’s possible, but only by also losing the live update of the text value when you move or modify the path.** | ||
+ | |||
+ | Il suffit de cliquer avec le bouton droit de la souris sur la dimension et de sélectionner l' | ||
+ | |||
+ | Quelle est donc la solution ? Existe-t-il un moyen de styliser les parties individuelles des lignes de dimension au-delà des options limitées fournies par les paramètres LPE ? Eh bien, oui... mais seulement d'une manière qui supprime leur lien avec la trajectoire d' | ||
+ | |||
+ | |||
+ | **The way to achieve this is to use the Path > Object to Path menu entry. Historically, | ||
+ | |||
+ | For most people, all this talk of styling parts of the Measure Segments LPE will be somewhat academic. In the vast majority of cases, the normal output from the effect will be sufficient, and the parameters it provides will give enough flexibility to style the new elements well enough. If more complex adjustments are needed, then using Object to Path will usually suffice, even if it does mean sacrificing live updates of the dimensions. It would be great if Inkscape offered a means to indicate that an element has been manually styled, but that you still want the position and text content to update, but perhaps that’s too niche a requirement to warrant the development time.** | ||
+ | |||
+ | Pour ce faire, il faut utiliser l' | ||
+ | |||
+ | Pour la plupart des gens, toute cette discussion sur le style des parties du LPE des segments de mesure sera quelque peu théorique. Dans la grande majorité des cas, la sortie normale de l' | ||
+ | |||
+ | |||
+ | **Even if you don’t want to style the dimension parts, however, there’s one significant aspect of this LPE’s approach that you should be aware of, because the behaviour is quite surprising, and could easily catch you unawares. The behaviour of Measure Segments with regard to layers is, in my opinion, broken. | ||
Let’s take another look at the new elements in the XML editor. This is the same content as the earlier screenshot, but I’ve cropped it to just show the relevant detail. | Let’s take another look at the new elements in the XML editor. This is the same content as the earlier screenshot, but I’ve cropped it to just show the relevant detail. | ||
- | Notice that “path144” is indented compared with the rest of the elements? That’s the original path to which we’ve applied the LPE, and it’s indented because it is a child of the Inkscape layer (the <g> element above it). The newly created < | + | Notice that “path144” is indented compared with the rest of the elements? That’s the original path to which we’ve applied the LPE, and it’s indented because it is a child of the Inkscape layer (the <g> element above it). The newly created < |
+ | |||
+ | Cependant, même si vous ne voulez pas styliser les parties de dimension, il y a un aspect important de l' | ||
+ | |||
+ | Regardons à nouveau les nouveaux éléments dans l' | ||
+ | |||
+ | Remarquez-vous que « path144 » est en retrait par rapport au reste des éléments ? C'est le chemin original auquel nous avons appliqué le LPE, et il est en retrait parce qu'il est un enfant du calque Inkscape (l' | ||
+ | |||
+ | |||
+ | **The original line is hidden, but the dimension elements are not. They all live at the top level of the SVG, not within the same layer as the path they’re associated with, so aren’t affected by hiding the layer itself. This happens regardless of how deeply nested your original path is. Consider trying to create a technical drawing showing different views of an object: common sense would tell you to put each view in a separate layer so they can be turned on and off individually, | ||
+ | |||
+ | There is a solution to this issue, but it’s not pretty. You can unlock the generated dimension content (right-click > Unlock Objects Below) – though you may need to do this multiple times for each part of the content. Then you need to select all the parts. Finally you can move them into the right layer using the Layer > Move Selection to Layer… menu option. Doing this will cause Inkscape to re-run the LPE, locking the objects again, but they will now be on the correct layer. The good news is that, once they’ve been moved, they tend to stay put. Further changes to the path or the LPE parameters won’t suddenly break them back out to the top level again. It would be much better, though, if Inkscape simply created them in the same layer as the original path by default.** | ||
+ | |||
+ | La ligne originale est cachée, mais les éléments de dimension ne le sont pas. Ils se trouvent tous au niveau supérieur du SVG, pas dans le même calque que le chemin auquel ils sont associés, et ne sont donc pas affectés par le masquage du calque lui-même. Cela se produit indépendamment de la profondeur de l' | ||
+ | |||
+ | Il existe une solution à ce problème, mais elle n'est pas très jolie. Vous pouvez déverrouiller le contenu de la dimension générée (clic droit > Déverrouiller les objets ci-dessous) - bien que vous deviez peut-être le faire plusieurs fois pour chaque partie du contenu. Ensuite, vous devez sélectionner toutes les parties. Enfin, vous pouvez les déplacer dans le bon calque en utilisant l' | ||
- | The original line is hidden, but the dimension elements are not. They all live at the top level of the SVG, not within the same layer as the path they’re associated with, so aren’t affected by hiding the layer itself. This happens regardless of how deeply nested your original path is. Consider trying to create a technical drawing showing | + | **Last month we looked at how to use this effect in practical terms. This time we’ve examined some of the technical details behind it. Now that the genie is out of the bottle, it’s likely that future LPEs will also create new elements rather than just single paths, so understanding what’s happening, and how they’re |
- | There is a solution to this issue, but it’s not pretty. You can unlock the generated dimension content (right-click > Unlock Objects Below) – though you may need to do this multiple times for each part of the content. Then you need to select all the parts. Finally you can move them into the right layer using the Layer > Move Selection to Layer… menu option. Doing this will cause Inkscape to re-run the LPE, locking the objects again, but they will now be on the correct layer. The good news is that, once they’ve been moved, they tend to stay put. Further changes to the path or the LPE parameters won’t suddenly break them back out to the top level again. It would be much better, though, if Inkscape | + | Le mois dernier, nous avons examiné comment utiliser cet effet en termes pratiques. Cette fois-ci, nous nous sommes penchés sur les détails techniques qui le sous-tendent. Maintenant que le génie est sorti de la lampe, il est probable que les futurs |
- | Last month we looked at how to use this effect in practical terms. This time we’ve examined some of the technical details behind it. Now that the genie is out of the bottle, it’s likely that future LPEs will also create new elements rather than just single paths, so understanding what’s happening, and how they’re different from older LPEs, might be a useful skill to add to your Inkscape repertoire. | ||
issue180/inkscape.1651344492.txt.gz · Dernière modification : 2022/04/30 20:48 de d52fr