# Pixmap Editor

The Pixmap Editor is a tool to allow the design and modification of color Pixmaps. Pixmaps can be either created from scratch, read in from XPM format files, or read from X Bitmap files. When a Pixmap design is complete, it can be bound to a global Pixmap Object name which is then accessible throughout the rest of WorkShop Visual.

The Pixmap Editor has a menubar at the top of the window, a toolbar beneath the menubar, a tools palette on the left, the current foreground and background colors beneath the tools palette, an image drawing area in the centre and an image shown actual size on the right.

Pixmap Editor Toolbar

The toolbar contains buttons for the following operations:

- Open. Open a pixmap file.
- Cut. Cut the selected area of the pixmap.
- Copy. Copy the selected area of the pixmap.
- Paste. Pastes the contents of the clipboard into the pixmap.
- Clear. Clears the selected area.
- Zoom in/Zoom out. Zoom in magnifies the whole image and zoom out makes the image appear smaller. These are view options and do not affect the pixmap.

Pixmap Editor File Menu

The File menu contains four options: "New", "Open File", "Save XPM File" and "Close".

New

New creates a new, blank editing area removing any image that was there before. WorkShop Visual warns you if you have not bound the image since making any changes. If you wish to bind the image, select "Cancel" and then bind it. If you do not wish to bind the image, press "OK" and continue.

Open file

If you have X pixmap files on your system, you can also use these in your interface. Selecting "Open file..." in the File Menu displays a file selector which lets you load a pixmap file into the Pixmap Editor. WorkShop Visual reads pixmaps in XPM3 format. It also reads X bitmap files and converts the bitmaps to pixmaps for editing in the Pixmap Editor.

Save XPM file

Selecting "Save XPM file..." lets you write the pixmaps you create to files. WorkShop Visual writes XPM1 and XPM3 format. You should normally save pixmaps in XPM3 format. XPM1 is provided for compatibility with older versions of third-party pixmap-handling utilities.

Close

This closes the editor window. If you have made changes since last binding, WorkShop Visual will issue a warning.

Saving Your Work

Every time you bind or write to an XPM file, you effectively save the current state of the pixmap you are creating. It's a good idea to do this frequently as you work.

Pixmap Editor Edit Menu

The Edit menu has seven items: "Undo", "Cut", "Copy", "Paste", "Clear", "Crop" and "Select All".

Most of these options operate on the selected portion of the pixmap.

The selected portion of the pixmap includes pixels in the rectangular border marked with crosses and all the pixels within the border. Note that when you select an area of the image, the size and location of the selected area is displayed in the status line at the bottom left of the window. The "Select all" option in the Edit menu selects the entire image.

- Undo. This undoes the last action in the editing area.
- Cut. Cut removes the selected portion of the image to the clipboard.
- Copy. Copy copies the selected portion of the image to the clipboard.
- Paste. Pastes the contents of the clipboard into the selected area. If the selected area is smaller than the area on the clipboard, WorkShop Visual places the top left of the clipboard image at the top left of the selected area and draws as much of the area from the clipboard as there is room to do.
- Clear. Clear removes the selected portion of the image without copying it to the clipboard.
- Crop. Crop reduces the image to the selected area, thereby resizing it.
- Select All. This selects the whole image.

Pixmap Editor View Menu

The view menu contains one pullright menu item, labelled "Drag color". When you pullright from this item, two radio buttons appear labelled "Invert" and "xor". These describe the method of showing the selection rectangle.

Pixmap Editor Image Menu

The Image menu contains one item, "Resize".

Pixmap Editor Effects Menu

The Effects menu has four items: "Reflect Horizontally", "Reflect Vertically", "Rotate 180" and "Gray Out".

- Reflect "Reflect Horizontally" and "Reflect Vertically" reflect the selected area across a horizontal or vertical axis respectively.
- Rotate "Rotate 180" rotates the selected area through 180 degrees - effectively reflecting the selected area across a diagonal axis.
- Gray Out This item creates a grayed out version of the selected area by `xor'ing each pixel. This is useful for creating insensitive pixmaps.

Pixmap Editor Palette Menu

The Palette menu allows you to edit the color palette or read in a new palette. There are two items: "Edit Palette" and "Read Palette".

Edit Palette

This produces the Palette Editor.

Read Palette

This lets you read in the palette of a saved pixmap file. When you select this item, a file selection dialog appears prompting you for the name of an Xpm format file. When the file is read in, the palette of colors from the saved file replaces the existing palette. WorkShop Visual then changes the colors of the current image, if you have one, to use the colors of the new palette. WorkShop Visual will use the closest color match it can find.

Supplied with WorkShop Visual are some palettes which are color cubes. Also supplied is the palette used by WorkShop Visual for its icons. These files can be found in:

$VISUROOT/lib/palettes

where VISUROOT is the install directory of your VISUROOT.

Tools Palette

To help you draw and color your image there is a palette of tools on the left of the Pixmap Editor window.

Note that all of the drawing tools use the current foreground color. You can, however, use the current background color instead. You may also, later, decide that you wish to change all instances of a particular color in your image.

You must select one of these to perform an operation on the window. There is always one and only one selected at any time.

Dropper Tool Shortcut

With any tool selected, clicking over a color with the Control key held down sets the foreground color in exactly the same way as the dropper tool. Clicking with Mouse Button 2 while the Control key is held down sets the background color.

Dragging into the Editing Area

You can drag pixmaps and pixmap filenames into the editing using the Motif "drag and drop" mechanism. Usually this means pressing Mouse Button 2 over the source and dragging it into the Pixmap Editor editing area before releasing the mouse button. If this does not work, check with your system administrator for your system's configuration.

A dragged pixmap appears in the editing area exactly as if you had created it yourself, complete with a color palette containing all the colors used in the pixmap.

Color Palette

Color palettes are important in the Pixmap Editor. In order to create color pixmaps you need to specify which colors you wish to use. Any colors defined in the color palette for a pixmap will be stored with the pixmap. While you are creating your image you need to be aware which colors from the palette are the current background and foreground colors.

Background and Foreground colors

The two squares of color below the tools palette show the current foreground and background colors. The foreground color is the color used for any drawing. The background color is used to fill blank space left by the editor. "Cut" and "Clear" both leave blank space which is filled with the background color. "Gray out" uses the background color to produce the grayed out effect. Resizing to a larger size fills the extra space with the background color.

Swapping Background and Foreground colors

When you draw anything in the Pixmap Editor, the current foreground color is used. If, however, you draw with Mouse Button 2 pressed down, the current background color is used.

Seeing the color Palette

Pressing the mouse button when the pointer is over either the background or foreground square displays the color palette.

You can edit the color palette so that it contains the colors you wish to use in your image.

Changing the Background and Foreground colors

You can change the current background and foreground colors by displaying the color palette and releasing the mouse button over the new color.

Changing a color in the Image

If you have a color image and you wish to change all instances of one particular color to another, do the following:

1. Make sure the color you wish to change is the current foreground color.
2. Press the Control key and select another foreground color.
Wherever the previous color was displayed in your image, the new color is now displayed.

See also:

- Color Palette Editor
- Reading and writing XPM and bitmap files
- Color Selector dialog
- Microsoft Windows Mode
- About WorkShop Visual