5. 路径

Paths are curves (known as Bézier-curves). Paths are easy to learn and use in GIMP. To understand their concepts and mechanism, look at the glossary Bézier-curve or Wikipedia [WKPD-BEZIER]. The Paths tool is very powerful, allowing you to design complex shapes. When designing a shape, you first use the Paths tool in GIMP to create a path. After that you usually stroke or fill the path.

在GIMP中,术语“勾画路径”意味着将特定样式应用于路径(颜色、宽度、图案…)。

A path can be used in several ways:

  • 您可以将封闭路径转换为选区。

  • 任何路径,无论是开放的还是封闭的,都可以被勾画;也就是说,以多种方式在图像上绘制。

  • A path can be filled with a color or pattern. If the path is not closed, it will try to figure out the shape and then fill it. However, this will not work if the path is a straight line.

图 7.10. Illustration of four different paths

Illustration of four different paths

GIMP 路径的四个示例:一个封闭的多边形;一个开放的多边形;一个封闭而弯曲的;一种混合了直线和曲线段。

5.1. 路径创建

首先为您的路径绘制轮廓;轮廓可以稍后修改(请参阅路径工具)。首先,使用以下方法之一选择路径工具:

  • Use Tools → Paths from the menu.

  • 使用工具箱中的相关图标5. 路径 - 图2

  • 使用快捷键B

When the Paths tool is selected, the mouse cursor changes into a crosshair with a curve by default. The actual shape depends on your mouse pointer mode setting. Make sure that the Paths Edit Mode in Tool Options is set to Design.

Left click in the image to create the first point of the path. Move the mouse to a new point and left click to create another point linked to the previous point. Although you can create as many points as you desire, you only need two points to learn about Paths.

While adding points, the mouse cursor has a little “+” next to the curve, which indicates that clicking will add a new point.

When the mouse cursor is close to one of the path points, the “+” changes into a cross with arrows; like the move tool. You can then move the existing path point.

To close your path, go with the mouse on top of the point you want to connect to, and then Ctrl-click that point. When you are done designing your path, you can click Enter. This will turn the path into a Selection. You can also keep adding more points, or start changing the curves of the path.

To edit the curves of your path, move the mouse cursor close to a line segment, left-click and drag the line segment. Two events occur.

  • 线段在被拉动时会倾斜和弯曲。

  • Each line segment has two start points and end points marked by little square rectangles, these are called handles. A “direction line” now projects from each start point for the line segment that was moved. This direction line usually has a different color than the lines of the path.

The curved line segment leaves an end point in the same direction that the “direction line” leaves the start point. The length of this line controls how far the line segment projects along the “direction line” before curving towards the other path point.

The handle at the end of each “direction line” can be dragged to change the direction and length of the curve. The handles on the other end, where they connect to the path, can be used to move the position of that path point.

图 7.11. 路径被操纵时的外观

路径被操纵时的外观

Appearance of a path while it is manipulated using the Paths tool.

路径由两个部分组成,包括直线段和曲线段。黑色方块是锚点,空心圆圈表示选中的锚点,两个空心方块是与选中锚点关联的手柄。