Tutorial | 基础
本教程描述了Inkscape的基本操作方法。本文档以Inkscape的通用文件格式保存,你可以用Inkscape进行查看、复制、编辑、保存等操作。
The Basic Tutorial covers canvas navigation, managing documents, shape tool basics, selection techniques, transforming objects with selector, grouping, setting fill and stroke, alignment, and z-order. For more advanced topics, check out the other tutorials in the Help menu.
平移画布
There are many ways to pan (scroll) the document canvas. Try Ctrl+arrow keys to scroll by keyboard. (Try this now to scroll this document down.) You can also drag the canvas by the middle mouse button. Or, you can use the scrollbars (press Ctrl+B to show or hide them). The wheel on your mouse also works for scrolling vertically; press Shift with the wheel to scroll horizontally.
放大与缩小
The easiest way to zoom is by pressing - and + (or =) keys. You can also use Ctrl+middle click or Ctrl+right click to zoom in, Shift+middle click or Shift+right click to zoom out, or rotate the mouse wheel with Ctrl. Or, you can click in the zoom entry field (in the bottom right corner of the document window), type a precise zoom value in %, and press Enter. We also have the Zoom tool (in the toolbar on left) which lets you to zoom into an area by dragging around it.
Inkscape also keeps a history of the zoom levels you've used in this work session. Press the ` key to go back to the previous zoom, or Shift+` to go forward.
Inkscape工具列
Inkscape中的绘图和修改工具集中在左侧的竖直工具列中。在窗口的上方,菜单下面是命令栏(Commands bar),提供了通用的一些控制命令,下面的工具控制栏(Tool Controls bar)则跟具体的绘图工具有关。窗口底部的状态栏(status bar)则实时显示一些操作提示和信息。
Many operations are available through keyboard shortcuts. Open Help⇒Keys and Mouse Reference to see the complete reference.
创建和管理文档
To create a new empty document, use File⇒New or press Ctrl+N. To create a new document from one of Inkscape's many templates, use File⇒New from Template… or press Ctrl+Alt+N
To open an existing SVG document, use File⇒Open (Ctrl+O). To save, use File⇒Save (Ctrl+S), or File⇒Save As (Shift+Ctrl+S) to save under a new name. (Inkscape may still be unstable, so remember to save often!)
Inkscape使用SVG(Scalable Vector Graphics可缩放矢量图形)文件格式。 SVG是一种被各种绘图软件广泛支持的开放文件标准。SVG文件是基于XML的,可以用任何文本和XML编辑器来编辑(Inkscape不属于这种文本编辑器)。除SVG外,Inkscape也可以导入和导出其它一些文件格式(EPS,PNG等)。
Inkscape opens a separate document window for each document. You can navigate among them using your window manager (e.g. by Alt+Tab), or you can use the Inkscape shortcut, Ctrl+Tab, which will cycle through all open document windows. (Create a new document now and switch between it and this document for practice.) Note: Inkscape treats these windows like tabs in a web browser, this means the Ctrl+Tab shortcut only works with documents running in the same process. If you open multiple files from a file browser or launch more than one Inkscape process from an icon it will not work.
创建形状
下面我们开始创建一些很漂亮的图形!在工具列中选择矩形工具(Rectangle)(快捷键F4),在(本文档或新文档的)绘图区中点击、拖动:
As you can see, default rectangles come up blue, with a black stroke (outline), and fully opaque. We'll see how to change that below. With other tools, you can also create ellipses, stars, and spirals:
这些工具统称为形状工具shape tools。 新创建的每一个形状上都有一个或更多四边形的控制器(handles); 试一下拖动这些控制器会产生什么样的效果。在工具控制栏中也可以对形状进行修改。工具控制栏只对当前选中的形状有效(显示出四边形控制器的),但同时也会成为当前形状工具的缺省参数,影响下次创建的图形。
To undo your last action, press Ctrl+Z. (Or, if you change your mind again, you can redo the undone action by Shift+Ctrl+Z.)
移动、缩放和旋转
Inkscape中最常用的工具是拾取器(Selector),位于工具列的顶端(箭头形状),对应快捷键F1 或者 空格(Space)。现在你可以选择当前画布上的任何对象。请点击下面的矩形。
可以看到,选择对象的周围出现八个带箭头的控制器。下面你可以:
Move the object by dragging it. (Press Ctrl to restrict movement to horizontal and vertical.)
Scale the object by dragging any handle. (Press Ctrl to preserve the original height/width ratio.)
再次在矩形上单击,控制器会发生变化,现在你可以:
Rotate the object by dragging corner handles. (Press Ctrl to restrict rotation to 15 degree steps. Drag the cross mark to position the center of rotation.)
Skew (shear) the object by dragging non-corner handles. (Press Ctrl to restrict skewing to 15 degree steps.)
在选择状态,也可以在工具控制栏(画布的上方)的输入框中输入数字,精确地控制对象的位置坐标(x,y)和尺寸(宽度W,高度H)。
通过键盘变换
Inkscape区别于大多数其它矢量绘图软件的一个特征是键盘操作的便捷性。几乎所有的命令都可以通过键盘实现,变换操作也不例外。
You can use the keyboard to move (arrow keys), scale (< and > keys), and rotate ([ and ] keys) objects. Default moves and scales are by 2 px; with Shift, you move by 10 times that. Ctrl+> and Ctrl+< scale up or down to 200% or 50% of the original, respectively. Default rotates are by 15 degrees; with Ctrl, you rotate by 90 degrees.
However, perhaps the most useful are pixel-sizetransformations, invoked by using Alt with the transform keys. For example, Alt+arrows will move the selection by 1 pixel at the current zoom (i.e. by 1 screen pixel, not to be confused with the px unit which is an SVG length unit independent of zoom). This means that if you zoom in, one Alt+arrow will result in a smaller absolute movement which will still look like one-pixel nudge on your screen. It is thus possible to position objects with arbitrary precision simply by zooming in or out as needed.
Similarly, Alt+> and Alt+< scale selection so that its visible size changes by one screen pixel, and Alt+[ and Alt+] rotate it so that its farthest-from-center point moves by one screen pixel.
Note: Linux users may not get the expected results with the Alt+arrow and a few other key combinations if their Window Manager catches those key events before they reach the inkscape application. One solution would be to change the WM's configuration accordingly.
多选
You can select any number of objects simultaneously by Shift+clicking them. Or, you can drag around the objects you need to select; this is called rubberband selection. (Selector creates rubberband when dragging from an empty space; however, if you press Shift before starting to drag, Inkscape will always create the rubberband.) Practice by selecting all three of the shapes below:
Now, use rubberband (by drag or Shift+drag) to select the two ellipses but not the rectangle:
被选择的对象上会出现一个选择标识(selection cue),默认情况下是一个虚线矩形框,它可以标识出哪些对象被选中,哪些没有选中。例如,同时选中两个椭圆和矩形时,如果没有矩形标识框,椭圆的选中与否就难以判断。
Shift+clicking on a selected object excludes it from the selection. Select all three objects above, then use Shift+click to exclude both ellipses from the selection leaving only the rectangle selected.
Pressing Esc deselects any selected objects. Ctrl+A selects all objects in the current layer (if you did not create layers, this is the same as all objects in the document).
群组
若干个绘图对象可以组合为一个群组group。群组可以像普通绘图对象一样进行移动或变换。下图中,左边的三个图形是互相独立的,而右边的三个图形是组合在一起的。试着拖动这个群组看看。
To create a group, you select one or more objects and press Ctrl+G. To ungroup one or more groups, select them and press Ctrl+U. Groups themselves may be grouped, just like any other objects; such recursive groups may go down to arbitrary depth. However, Ctrl+U only ungroups the topmost level of grouping in a selection; you'll need to press Ctrl+U repeatedly if you want to completely ungroup a deep group-in-group.
You don't necessarily have to ungroup, however, if you want to edit an object within a group. Just Ctrl+click that object and it will be selected and editable alone, or Shift+Ctrl+click several objects (inside or outside any groups) for multiple selection regardless of grouping. Try to move or transform the individual shapes in the group (above right) without ungrouping it, then deselect and select the group normally to see that it still remains grouped.
填充与轮廓
Probably the simplest way to paint an object some color is to select an object, and click a swatch in the palette below the canvas to paint it (change its fill color). Alternatively, you can open the Swatches dialog from the View menu (or press Shift+Ctrl+W), select an object, and click a swatch to paint it (change its fill color).
More powerful is the Fill and Stroke dialog from the Object menu (or press Shift+Ctrl+F). Select the shape below and open the Fill and Stroke dialog.
这个对话框中有三个标签面板:填充Fill、轮廓色彩(Stroke paint)和轮廓样式(Stroke style)。填充属性可以修改对象的内部fill 。下面的按钮可以设置填充的类型,包括不填充(图标X),单色flat color填充,以及渐变(gradients,线性或圆周)填充。对于上面的椭圆,单色填充的按钮是激活的。
这些按钮的下面,是色彩拾取器color pickers,有四种不同的方式:RGB, CMYK, HSL,色盘Wheel。可能最方便是通过色盘来选择,旋转其中的三角形来选择色调,在三角形内可以拾取不同的明暗度。四中拾取方式中都包含一个滑动条来设置对象的透明度(opacity),即alpha值。
选择不同的对象时,色彩拾取器总是自动更新,对应当前对象的填充和笔廓。(选择多个对象时,将显示色彩的平均值) 。在下面的例子上做一下练习,或者自己创建图形:
在轮廓色彩Stroke paint标签中,可以删除轮廓线stroke,也可以任意为其指定颜色和透明度:
最后一个标签面板,轮廓样式(Stroke style)中,可以设置轮廓的宽度以及其它参数:
最后,除了单色填充之外,可以选择梯度(gradients)模式来填充图形内部和轮廓:
When you switch from flat color to gradient, the newly created gradient uses the previous flat color, going from opaque to transparent. Switch to the Gradient tool (Ctrl+F1) to drag the gradient handles — the controls connected by lines that define the direction and length of the gradient. When any of the gradient handles is selected (highlighted blue), the Fill and Stroke dialog sets the color of that handle instead of the color of the entire selected object.
Yet another convenient way to change a color of an object is by using the Dropper tool (F7). Just click anywhere in the drawing with that tool, and the picked color will be assigned to the selected object's fill (Shift+click will assign stroke color).
再制、对齐和分布
One of the most common operations is duplicating an object (Ctrl+D). The duplicate is placed exactly above the original and is selected, so you can drag it away by mouse or by arrow keys. For practice, try to fill the line with copies of this black square:
Chances are, your copies of the square are placed more or less randomly. This is where the Align and Distribute dialog (Shift+Ctrl+A) is useful. Select all the squares (Shift+click or drag a rubberband), open the dialog and press the “Center on horizontal axis” button, then the “Make horizontal gaps between objects equal” button (read the button tooltips). The objects are now neatly aligned and distributed equispacedly. Here are some other alignment and distribution examples:
叠放次序Z-order
The term z-order refers to the stacking order of objects in a drawing, i.e. to which objects are on top and obscure others. The two commands in the Object menu, Raise to Top (the Home key) and Lower to Bottom (the End key), will move your selected objects to the very top or very bottom of the current layer's z-order. Two more commands, Raise (PgUp) and Lower (PgDn), will sink or emerge the selection one step only, i.e. move it past one non-selected object in z-order (only objects that overlap the selection count, based on their respective bounding boxes).
可以在下面的图形上练习改变叠放次序,让最左边的椭圆位于最上层,而最右边的椭圆位于最下层:
A very useful selection shortcut is the Tab key. If nothing is selected, it selects the bottommost object; otherwise it selects the object above theselected object(s) in z-order. Shift+Tab works in reverse, starting from the topmost object and proceeding downwards. Since the objects you create are added to the top of the stack, pressing Shift+Tab with nothing selected will conveniently select the object you created last. Practice the Tab and Shift+Tab keys on the stack of ellipses above.
选择下面的对象并移动
如果一个对象完全被另一个对象盖住了,该怎么选择呢?如果上面的图形是透明的,你虽然可以看到下面的对象,但点击时选中的却是上面的图形。
This is what Alt+click is for. First Alt+click selects the top object just like the regular click. However, the next Alt+click at the same point will select the object below the top one; the next one, the object still lower, etc. Thus, several Alt+clicks in a row will cycle, top-to-bottom, through the entire z-order stack of objects at the click point. When the bottom object is reached, next Alt+click will, naturally, again select the topmost object.
[If you are on Linux, you might find that Alt+click does not work properly. Instead, it might be moving the whole Inkscape window. This is because your window manager has reserved Alt+click for a different action. The way to fix this is to find the Window Behavior configuration for your window manager, and either turn it off, or map it to use the Meta key (aka Windows key), so Inkscape and other applications may use the Alt key freely.]
This is nice, but once you selected an under-the-surface object, what can you do with it? You can use keys to transform it, and you can drag the selection handles. However, dragging the object itself will reset the selection to the top object again (this is how click-and-drag is designed to work — it selects the (top) object under cursor first, then drags the selection). To tell Inkscape to drag whatis selected now without selecting anything else, use Alt+drag. This will move the current selection no matter where you drag your mouse.
Practice Alt+click and Alt+drag on the two brown shapes under the green transparent rectangle:
Selecting similar objects
Inkscape can select other objects similar to the object currently selected. For example, if you want to select all the blue squares below first select one of the blue squares, and use Edit⇒Select Same⇒Fill Color from the menu. All the objects with a fill color the same shade of blue are now selected.
In addition to selecting by fill color, you can select multiple similar objects by stroke color, stroke style, fill & stroke, and object type.
总结
This concludes the Basic tutorial. There's much more than that to Inkscape, but with the techniques described here, you will already be able to create simple yet useful graphics. For more complicated stuff, go through the Advanced and other tutorials in Help⇒Tutorials.
Bulia Byak; Jonathan Leighton; Ralf Stephan; Bryce Harrington; Alexandre Prokoudine; Colin Marquardt; Josh Andler; Nicolas Dufour; Gellért Gyuris
LiuXiaoqin — 2008
Esteban Capella — 2019