Outils pour utilisateurs

Outils du site


issue62:tutoinkscape

Ceci est une ancienne révision du document !


Last month, we learned how to draw ellipses using the Circle tool. But you may have noticed that we didn't actually draw any circles, despite the tool's name. You may have got close by adjusting an ellipse by eye, but that's not quite the same as drawing a perfect circle. The secret to drawing a perfect circle is actually the secret to making the best use of Inkscape in general: you need to use the keyboard.

Inkscape has a huge number of keyboard shortcuts and modifiers. Last month, I mentioned using the Plus and Minus keys to zoom in and out, but there are hundreds more listed on the Inkscape Keys and Mouse Reference – the URL is at the end of this article, but you can also get to it directly via the Help menu in Inkscape. Such a large number of shortcuts can be overwhelming, so I'm just going to introduce them a few at a time, starting with the CTRL and SHIFT keys.

These keys serve different purposes depending on what you're doing in Inkscape at the time that you press them, but, very broadly speaking, they usually have the following effects: CTRL: Lock or snap some aspect of the operation SHIFT: Affect the center or starting point for an operation

An “operation” in this case refers to drawing, rotating, skewing, or otherwise manipulating an object. Let’s look at each of these keyboard modifiers when used with our Circles and Ellipses tool.

Select the Circle tool by clicking its icon, or by pressing the “e” key (for ellipse) or the F5 key. Now hold down CTRL while you drag an ellipse out onto the canvas. You'll find that you can no longer smoothly adjust the width and height of the ellipse, but rather that it snaps to fixed ratios of 1:1, 1:2, 3:1, and so on. So the answer to the question of how to draw a circle is simply to hold down CTRL whilst drawing an ellipse.

As well as locking the ratio when you first draw an object, the CTRL key can also be used to snap your subsequent edits to defined values. Try selecting your ellipse with the Circle tool active, then move the small circular control handles (to turn your ellipse into a segment or arc) while holding the CTRL key. You'll find that the handles snap to particular angles, defaulting to 15°. You can change that value via the File > Inkscape Preferences > Steps dialog, where you can choose from a selection of other angles via a drop down list, although the default is a good choice for most uses.

Now try selecting an ellipse using the Select tool (previous page, pointer icon), then clicking a second time to enable the rotation and skewing handles. Hold down CTRL as you rotate your object, and you'll find that the same snapping action occurs. It also happens for skewing, but that's a little less obvious with an ellipse, so we'll come back to that one a little later.

Click on the ellipse again to switch back to the move and scale handles. If you try dragging your ellipse around, you'll find that the CTRL key locks you to only horizontal or vertical movements. Now, try resizing with the arrow handles, and you'll discover that the CTRL key locks the aspect ratio of your ellipse – you can make it bigger and smaller, but it will keep the same ratio of width to height.

If you use a mouse with a wheel, then the CTRL key has another feature: hold it down as you scroll the mouse wheel in order to quickly zoom in and out of your document. While you're playing with the mouse wheel, try using it to click and drag the canvas around – a much faster way to pan around your drawing than using the scroll bars.

Now let's consider the SHIFT key. Try holding it down while drawing a new ellipse. Notice that it's being drawn relative to the center of the ellipse, rather than the corner. One of the most common uses for the SHIFT key in Inkscape is to change the starting or reference point for an operation.

Select an ellipse using the Select tool, then hold SHIFT as you resize it with the arrow handles. Notice how the reference point for your actions has switched to the center of the ellipse. Try pressing and releasing SHIFT while you're in the middle of resizing the ellipse to make it more obvious. You don't have to press these modifiers right at the start of an operation, you can press and release them at any point. The only thing that matters is whether they're pressed when you release the mouse button.

Click the ellipse to switch to rotation mode, and hold SHIFT while you rotate or skew using the handles. You should see the small cross that indicates the rotation center jump to the opposite corner or side from the handle you're moving, and your ellipse will rotate or skew around that reference point.

You can also combine the CTRL and SHIFT keys. Press both as you draw with the Circle tool in order to create a perfect circle drawn out from its center point, or while you rotate your ellipse to rotate it in 15° steps around the opposite corner from the rotation handle.

Let's finish this month with a new shape: there's only so much you can draw with circles and ellipses so we'll create some rectangles and squares instead.

For this, we'll use the Rectangle tool (shown left. Press F4 or “r”). Start by clicking on the button in the toolbox, then drag your shape out on the drawing canvas, just as you've been doing with ellipses. You should now have a nice rectangle:

Notice how your rectangle has small square and circular handles, like those on the ellipses. The two square handles are used to adjust the width and height. Hold SHIFT as you move them to constrain your changes to just one direction or the other. The circle handle, like that on an ellipse, is actually a pair of handles on top of one another. Move just one of them (or hold CTRL whilst moving either of them), and you'll get nice symmetrically-rounded corners to your rectangle – like a quarter of a circle. Move both of them and you'll get an elliptically-rounded corner instead. If you want to go back to perfect 90° corners, simply SHIFT-click one of the circular handles, or use the button at the end of the Tool Control bar (just above the canvas).

The CTRL and SHIFT keys work in a very similar way with the Rectangle tool as they do with the Circle tool: hold down CTRL while you draw your rectangle to constrain it to fixed ratios if you want to create a perfect square, or hold down SHIFT if you want to draw from the center outwards rather than corner to corner.

Of course you can change the color of the fill and stroke for your rectangles – just as we did with ellipses last month. You can also use the Select tool to move, resize, rotate, and skew them – and if you hold down CTRL while skewing a rectangle, it's a lot more obvious what's happening than it is with an ellipse.

Now that you can create rectangles and squares, why not enhance that snowman you drew last month by adding a hat and pipe?

Useful Links: Keys and Mouse Reference: http://inkscape.org/doc/keys048.html

issue62/tutoinkscape.1341291483.txt.gz · Dernière modification : 2012/07/03 06:58 de fredphil91