5. Контуры

Paths are curves (known as Bézier-curves). In GIMP it's very easy to learn and to use them. To understand their concepts and mechanism you can go to the glossary Bézier-curve or to Wikipedia [WKPD-BEZIER]. It is a very powerful tool to design sophisticated forms. To use it in GIMP you must operate by two successive ways: 1st Create the path and 2nd Stroke path.

According to the terminology used in GIMP, «Stroke path» means here to apply a specific style to the path (color, width, pattern... ).

Paths are used for two main purposes:

Рисунок 7.10. Illustration of four different path creating

Illustration of four different path creating

Четыре примера контуров в GIMP; замкнутый и многоугольный; открытый и многоугольный; замкнутый и изогнутый; комбинация из прямых и изогнутых сегментов.


5.1. Создание контуров

Контуры создаются и редактируются с помощью инструмента Контур. Контуры, как слои и каналы, являются компонентами изображения. Когда изображение сохраняется в родном для GIMP формате XCF, все контуры сохраняются вместе с ним. Список контуров изображения может быть просмотрен с помощью диалога Кривые. Если вы хотите переместить контур с одного изображения в другое, вы можете сделать это с помощью копирования и вставки, используя всплывающий диалог в диалоге "Контуры", или с помощью перетаскивания значка из диалога "Контуры" в желаемое окно изображения.

  • In the image menu, click ToolsPath,

  • or on the relevant icon in toolbox,

  • or use hotkey B

Кривые GIMP принадлежат к математическому типу, называемому "Кривые Безье". Практическими терминами это означает, что они определяются управляющими точками и рычагами. "Управляющая точка" это точка, через которую проходит контур. "Рычаги" определяют направление контура когда он входит или покидает управляющую точку: каждая точка имеет два прикреплённых к ней рычага.

Контуры могут быть очень сложными. Если вы создаёте их вручную с помощью инструмента "Кривые", обычно они содержат не более дюжины управляющих точек (часто намного меньше); но если вы создадите их с помощью преобразования выделения в контур, или преобразованием текста в контур, результат с лёгкостью может содержать сотни управляющих точек, или даже тысячи.

Рисунок 7.11. Appearance of a path while being manipulated

Appearance of a path while being manipulated

Контур, обрабатываемый с помощью инструмента "Кривые"


Paths can be created and manipulated using the Path tool. The image above shows a path which consists of two components, having both straight and curved segments, being worked on with the Path tool. Black squares are anchor points, the open circle indicates the selected anchor and the two open squares are the two handles which are associated with this anchor from the curves on either side of it.

Paths, like layers and channels, are components of an image. When an image is saved in GIMP's native XCF file format, any paths it has are saved along with it. The list of paths in an image can be viewed and operated on using the Paths dialog. If you want to move a path from one image to another, you can do so by copying and pasting using the pop-up menu in the Paths dialog, or by dragging an icon from the Paths dialog into the destination image's window.

Каждый компонент контура может быть открытым или замкнутым : "замкнутый" означает, что последняя управляющая точка соединена с первой управляющей точкой. Если вы преобразуете контур в выделение, любой открытый компонент автоматически преобразовывается в замкнутый с помощью соединения прямой линией последней управляющей точки с первой.

Сегменты контура могуть быть прямыми или изогнутыми. Контур, целиком состоящий из прямых называется "многоугольным". Когда вы создаёте сегмент контура, он создаётся прямым, поскольку рычаги управляющей точки размещаются на прямо управляющей точке, с нулевой длиной, что и создаёт сегмент - прямую линию.

Одна приятная вещь в контурах это то, что они очень лёкгие в плане потребления памяти, особенно в сравнении с изображениями. Контур требует памяти только для хранения координат управляющих и рычагов: 1К памяти достаточно для размещения весьма сложного контура, но не достаточно для размещения RGB слоя даже размером 20x20 пикселей. Поэтому можно содержать буквально сотни контуров в изображении без каких-либо стрессовых нагрузок для вашей системы.

Each component of a path can be either open or closed: «closed» means that the last anchor point is connected to the first anchor point. If you transform a path into a selection, any open components are automatically converted into closed components by connecting the last anchor point to the first anchor point with a straight line.

Path segments can be either straight or curved. A path all of whose segments are straight is called «polygonal». When you create a path segment, it starts out straight, because the handles for the anchor points are initially placed directly on top of the anchor points, yielding handles of zero length, which produce straight-line segments. You can make a segment curved by dragging a handle away from one of the anchor points.

One nice thing about paths is that they are very light in terms of resource consumption, especially in comparison with images. Representing a path in RAM only requires storing the coordinates of its anchors and handles: 1K of memory is enough to hold quite a complex path, but not enough to hold even a 20x20 pixel RGB layer. Therefore, it is quite possible to have literally hundreds of paths in an image without putting any significant stress of your system. (How much stress managing them would put on you is, of course, another question.) Even a path with thousands of segments consumes minimal resources in comparison to a typical layer or channel.