8. Диалог GIH

When your new animated brush is created, it is displayed within the image window and you would like save it into a gih format. You select FileSave as… menu, name your work with the gih extension in the new window relevant field and as soon as you pressed the Save button, the following window is displayed:

Рисунок 7.18. Диалог описания анимированой кисти

Диалог описания анимированой кисти

Этот диалог появляется тогда, когда изображение сохранено как поток изображения GIMP.


У этого диалога несколько непростых параметров. Они определяют, как кисть будет анимирована.

Растояние (процент)

Определяет растояние между последовательными отпечатками кисти в одном мазке. Об этом легче думать как о печати, вне зависимости от инструмента рисования. Если растояние мало, то печати будут лежать близко друг к другу, и мазок будет казатся сплошным. Если растояние велико, печати лежат отдельно. Диапазон значений от 1 до 200, где под 100% принимается размер диаметра кисти.

Описание

Название кисти, которое появится вверху диалога кисти (в режиме таблицы) при выборе этой кисти.

Размер ячейки

That is size of cells you will cut up in layers. Default is one cell per layer and size is that of the layer. Then there is only one brush aspect per layer.

Можно использовать один большой слой и разрезать его на ячейки, которые будут испольваны для разных аспектов анимированной кисти.

For instance, we want a 100×100 pixels brush with 8 different aspects. We can take these 8 aspects from a 400×200 pixels layer, or from a 300×300 pixels layer but with one cell unused.

Число ячеек

Это число ячеек (одна ячейка на аспект), которое будет вырезано в каждом слое. По умолчанию этот число слоёв, т.к. существует только один аспект на слой.

Показать как:

Определяет, как ячейки располагаются в слоях. На пример, если поместить восемь ячеек в четыре слоя до две ячейки на слой, то GIMP покажет 1 ряд из двух колонок в каждом слое.

Измерения, порядки, выделения

Ниже следует описание работы GIMP для того, чтобы понять, как распределить ячейки и слои.

GIMP starts retrieving cells from each layer and stacks them into a FIFO stack (First In First Out: the first in is at the top of the stack and so can be first out). In our example 4 layers with 2 cells in each, we'll have, from top to bottom: first cell of first layer, second cell of first layer, first cell of second layer, second cell of second layer, …, second cell of fourth layer. With one cell per layer or with several cells per layer, result is the same. You can see this stack in the Layer Dialog of the resulting .gih image file.

GIMP создаёт компьютерный массив из этой стопки с указанными Измерениями. Можно использовать до четырёх измерений.

В компьютерной науке массив в трёх измерениях имеет форму «массив(x,y,z)». Двухмерный массив легко представить: на бумаге это строки и столбцы

Для трёхмерных массивов говорят не об строках и столбцах, а об Измерениях и Порядках. Первое измерение идёт по x, второе — по y, третье — по z. У каждого измерения есть порядок ячеек.

To fill up this array, GIMP starts retrieving cells from the top of stack. The way it fills the array reminds that of an odometer: right rank digits turn first and, when they reach their maximum, left rank digits start running. If you have some memories of Basic programming you will have, with an array(4,2,2), the following succession: (1,1,1),(1,1,2),(1,2,1),(1,2,2),(2,1,1),(2,1,2),(2,2,2),(3,1,1),…, (4,2,2). We will see this later in an example.

Кроме порядкового номера, каждому измерению можно дать и режим Выделения. Существует несколько режимов, которые применятся во время рисования:

Постепенный

GIMP выбирает порядок из измерения согласно последовательности, по которой эти порядки сохранены в измерении.

Случайный

GIMP выбирает порядок случайным образом из соответствующего измерения.

Угловой

GIMP выбирает порядок в соответствующем измерении согласно углу движения кисти.

The first rank is for the direction 0°, upwards. The other ranks are affected, clockwise, to an angle whose value is 360/number of ranks. So, with 4 ranks in the concerned dimension, the angle will move 90° clockwise for each direction change: second rank will be affected to 90° (rightwards), third rank to 180° (downwards) and fourth rank to 270° (-90°) (leftwards).

Velocity, Pressure, x tilt, y tilt

Эти параметры предназначены для многофункциональных графических планшетов

Примеры

Изготовление одномерного изображения

Ниже мы покажем напримерах, для чего всё это годится. Вы можете вставить в новое измерение новые свойства кисти.

Начнём с одномерной кисти, которая позволит нам изучить работу режимов выделения. Мы можем представить это, как показано здесь:

. Сделайте следующее:

  1. Select FileNew… from the main menu.

    Set Width and Height for example to 30 pixels.

    In the Advanced Options, set the Color space to RGB color and set Fill with to Transparency.

    Using the Text tool create 4 layers «1», «2», «3», «4». Delete the «background» layer.

  2. Select FileSave… from the main menu to first save your image as an .xcf file to keep its properties.

    Select FileExport As… from the main menu to export the image as an animated brush with the .gih extension.

    Export the image with a .gbr extension in the brushes directory in your personal GIMP folder. The location of this folder depends on your OS:

    • Linux: /home/user_name/.config/GIMP/2.10/

    • macOS: /Users/user_name/Library/Application Support/GIMP/2.10/

    • Windows: C:\Users\user_name\AppData\Roaming\GIMP\2.10\

  3. In the Export Image as Brush Pipe dialog, provide a Description, set the Spacing (percent) to 100, set the Cell size to 30×30, set Dimension to 1, and set Ranks to 4, and the Selection dropdown to incremental. Then click the Export button.

  4. In the Brush Dialog, click on the button Refresh brushes .

    Your brush appears among the other brushes. You can use it immediately, without restarting GIMP.

    Select your brush. Select pencil tool for instance and click and hold with it on a new image:

    Цифры 1, 2, 3, 4 следуют друг за другом по порядку.

  5. Take your .xcf image file back and save it as .gih setting the Selection dropdown to random:

    Цифры будут показаны в случайном порядке.

  6. Now set the Selection dropdown to angular:

Анимированная кисть с тремя измерениями

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

The first question we have to answer to is the number of images that is necessary. We reserve the first dimension (x) to the brush direction (4 directions). The second dimension (y) is for Left/Right alternation and the third dimension (z) for color variation. Such a brush is represented in a 3D array «myarray(4,2,2)»:

There are 4 ranks in first dimension (x), 2 ranks in second dimension (y) and 2 ranks in third dimension (z). Thus there are 4×2×2 = 16 cells. We need 16 images.

  1. Создание изображений одного измерения (x)

    Open a new 30×30 pixels image, RGB with Transparent Fill Type. Using the zoom draw a left hand with fingers upwards.[2] Save it as handL0k.xcf (hand Left 0° Black).

    Open the Layer Dialog. Double click on the layer to open the Layer Attributes Dialog and rename it to handL0k.

    Duplicate the layer. Let visible only the duplicated layer, select it and apply LayerTransformRotate 90° clockwise. Rename it to handL90k.

    Повторите те же операции для создания handL180k и handL-90k (или handL270k).

  2. Создание изображений двух измерений (y)

    У этого измерения в нашем примере два порядка — для левой стороны и для правой. Первый порядок, левый, уже существует. Мы построим правый порядок с помощью горизонтального отражения.

    Duplicate the handL0k layer. Let it visible only and select it. Rename it to handR0K. Apply LayerTransformFlip Horizontally.

    Повторите ту же операцию над другими слоями слева, чтобы создать им правосторонний эквивалент.

    Re-order layers to have a clockwise rotation from top to bottom, alternating Left and Right: handL0k, handR0k, handL90k, handR90k, …, handR-90k.

  3. Создание изображений трёх измерений (z)

    Создание изображений трёх измерений (z). У третьего измерения два порядка, один для чёрного цвета, другой для синего. Первый порядок, чёрный, уже существует. Видно, что изображения третьего порядка - синие копии изображений второго порядка. Таким образом получаются 16 изображений. Для удобства управления, мы используем слои с двумя изображениями.

    Select the handL0k layer and let it visible only. Use ImageCanvas Size… to change the canvas size to 60×30 pixels.

    Сдублируйте слой hand0k. В копии залейте руку синим с помощью инструмента Плоская заливка.

    Теперь выберите инструмент Перемещение. Нажмите на него дважды, чтобы получить доступ к его параметрам. Выберите параметр «Переместить активный слой». Переместите синюю руку в правую часть слоя. Для точного позиционирования используйте Масштаб.

    Make sure only handL0k and its blue copy are visible. Right click on the Layer Dialog: Apply the Merge Visible Layers command with the option Expand as Necessary. You get a 60×30 pixels layer with the black hand on the left and the blue hand on the right. Rename it to «handsL0».

    Повторите эту операцию над другими слоями.

  4. Установить слои по порядку

    Layers must be set in order so that GIMP can find the required image at some point of using the brush. Our layers are yet in order but we must understand more generally how to have them in order. There are two ways to imagine this setting in order. The first method is mathematical: GIMP divides the 16 layers first by 4; that gives 4 groups of 4 layers for the first dimension. Each group represents a direction of the brush. Then, it divides each group by 2; that gives 8 groups of 2 layers for the second dimension: each group represents a L/R alternation. Then another division by 2 for the third dimension to represent a color at random between black and blue.

    Второй способ — зрительный, используя представление массива. Соотношение между двумя методами показано в следующем изображении:

    Как GIMP читает этот массив?: GIMP начинает с первого измерения, которое указано как «угловое», например 90°. В этом порядке 90° (жёлтый), во втором измерении он выбирает чередование Л/П «постеренным» образом. Потом, в третьем измерении, случайным образом, он выбирает цвет. И наконец, слои должны быть в следующем порядке:

  5. Voilà. Your brush is ready. Save it as .xcf first, then export as .gih with the following parameters:

    • Расстояние: 100

    • Описание:Руки

    • Cell Size: 30×30

    • Чисто ячеек: 16

    • Измерения: 3

      • Измерение 1: 4 порядка Выделение: Угловое

      • Измерение 2: 2 порядка Выделение: Постепенное

      • Измерение 3: 2 порядка Выделение: Случай

    Place your .gih file into the GIMP brush directory and refresh the brush box (see steps above). You can now use your brush.

    Рисунок 7.19. Вот результат штрихования кистью эллиптичесого выделения:

    Вот результат штрихования кистью эллиптичесого выделения:

    Эта кисть регулятно меняется между правосторонней и левосторонней, чёрной и синей случайным образом, в зависимости от четырёх направлений кисти.




[2] Ok, we are cheating here: our hand is borrowed from https://commons.wikimedia.org/wiki/File:Stop_hand.png.