How to...

# Deal with layers

Suppose that you are working on a button graphic with some text like OK, and you would like to change the text to e.g. Cancel. When using a simpler graphic program, you have to remove the text pixel-by-pixel, restoring the exact background carefully.

Using layers, this process is much easier. You have to create one layer for the background and one for the text, then select the text layer and use the Eraser (E) tool to clear the whole layer - the background now remains intact. When not using layers, the process is as hard as removing graffiti - a separate layer is similar to placing a removable protective coating on the concerned wall. All pages of your GreenPixel document initially consist of one layer named Background.

The most important properties of a layer are:

- Name

  This is an arbitrary text identifier for the layer.

- Visibility

  Invisible layers can also be drawn to (of course if they are selected).

- Opacity (0..255)
- Blend mode

  This property specifies how the layer pixels blend with the underlying image. The default mode is Normal. Other modes can be used for special effects: Multiply simulates the effect of sheets drawn with permanent marker, using the Screen mode is similar to shooting two images on the same film, Lighter Color chooses the lighter of the layer and background colors, etc.

It's important to know that only those layers are editable which are selected in the Layers list window - painting tools only affect these layers. If no layers are selected in the list, you will see a dashed circle (No sign) when trying to use a tool.

Nevertheless, the floating selection counts as a special layer - it cannot be drawn to, but it can be moved and resized, while other layers have a static size in GreenPixel.

Note that layer information cannot be preserved unless you save your work in the native GreenPixel format. When saving a multilayer image in e.g. PNG format, only the result of the blending process is saved - reopening that file would show only one Background layer remaining (read more here.

## Creating colored text using layers

The following example demonstrates the use of layer masks:

1. Create a page about 400 by 100 pixels large.
2. Select a dark red color and the Bucket (K) tool.
3. Fill the whole Background layer with red paint.
4. Select the Retouch (U) tool.
5. Set the retouch mode to Hue and the brush size to a larger value in the Tool behavior dialog.
6. Draw some strokes with the retouch brush on the red background.

   This causes an effect similar to the colors of spilt oil by modifying image hue.

7. Create a new layer using Layers|New layer or pressing Ctrl+L.
8. Double-click on the item representing the new layer in the layers list or choose Layers|Layer properties to open the properties dialog.
9. Name this layer Text and choose the Mask blend mode.

   When using the Mask blend mode, the alpha values of the layer below are multiplied with the alpha of the blending layer - this means that transparent pixels hide all background pixels, so you will see a fully transparent image now.

10. Select the new layer in the list, use the Text (T) tool, type some text and click OK.

    Since the text serves as a mask for the layer below, its opaque pixels allow the background to show through.

11. Move the floating selection to the right place and press Ctrl+D.