Friday, May 27, 2016

Inkscape Education

In the video in my post two weeks ago, I said that Inkscape didn't have a way to make a variable-width stroke. Last week I decided to double-check that, and it turns out it actually can, sort of!

Now, it's still technically true that you can't do a variable-width stroke because of how Inkscape handles things behind the scenes. But to understand, let's talk about strokes, fills, and paths with the help of a visual aid:

So because that's probably clear as mud, let me elaborate. Inkscape works with what are known as Scalable Vector Graphics, or SVG. Objects in SVG have attributes called fill and stroke. Fill is what, well, fills the object, while stroke is the outline around it. These attributes can be simple, solid colors, or gradients (linear or radial), or even patterns.

Lines in SVG can either have the ends connect or not. If they do, you get a 2D-shape called a path (the three objects at the top of the picture that have both fill and stroke are all paths). If not, the line's appearance is controlled by its stroke, where the width is a single number that controls the width at all points. (You can have a fill on an open line, but it will usually look rather strange. It can be used to good effect in some cases, though.) Technically, you still can't have a line with a stroke that varies in width from point to point.

What you can do, however, is use the Powerstroke path effect. (To activate it, go to Path→Path Effects… then click the '+' button to add a new effect.) This changes a line into a path, and adds some handles that can be dragged to vary the width of the path at arbitrary points.

Now, by making the line a path, what was once merely a 1D-stroke is now a 2D-fill, and the new path can have a completely new stroke set (like the purple-stroked path in the bottom-right corner of the picture). And unfortunately, because it's changing the width of 2D-object, the Powerstroke effect sometimes produces rough transitions, as can also be seen in the picture. If you vary the width too much from point to point you'll probably need to do some hand-smoothing of the result. However, it's still the closest thing to a truly variable-width stroke there is, and can be quite handy if used well.

I've actually learned quite a few new things about Inkscape over the weekend courtesy of the nifty website goInkscape, which has a whole bunch of tutorials showing how to things I never knew you could do. For instance, I found out you can create arrays of clones of an object similar to the way can do so in Blender in 3D, which I plan to make use of in the future. If you're using Inkscape at all, check it out! You'll probably learn something. A hui hou!

No comments:

Post a Comment

Think I said something interesting or insightful? Let me know what you thought! Or even just drop in and say "hi" once in a while - I always enjoy reading comments.