pixmap(1)

pixmap1

Xpm pixmap editor for x

Usage

pixmap [-options ...]

Overview

The pixmap program is a tool for creating or editing rectangular images made up of colored pixels, i.e., pixmaps. Pixmaps are intensively used in X to define window backgrounds, icon images, etc.

The pixmap program can have two different interfaces, a Athena widgets version and a Motif widgets version.

Usage

Pixmap displays grid in which each square represents a single pixel in the picture being edited. Squares can be set, cleared, or inverted (this last operation will be detailed later) directly with the buttons on the pointer and a menu of higher level operations such as draw line and fill circle is provided to the side of the grid. Another menu on the top of the window allows files operations (Load, Save, ...), edit operations (Cut/Copy/Paste, attributes of pixmap editing, ...) and colors operations (drawing color, attributes of colors, ...). Pixmap uses a Pixmap widget to represent the pixmap image.

Pixmaps are stored as a C string array variable suitable for including in applications, using the format defined by Arnaud Le Hors in his Xpm library (refer to Xpm manual for format description). This format allows pixmaps to be used indistinctly on monochrome, grey scale or color displays.

Options

Pixmap accepts the following options:

-display/-d display

This option specifies the name of the X server to use.

-geometry geometry

This option specifies the placement and size of the pixmap program window on the screen. See X for details.

-help/-h

This option asks for the usage description of pixmap.

-size WIDTHxHEIGHT

This option specifies the size (width and height) in pixels of the pixmap to be edited.

-squares SIZE

This option specifies the size in display points to use to represent each pixel (a square of SIZE points).

+grid/-grid

This option indicates that the grid lines in the Pixmap widget should be displayed or not.

-stippled

This option turns off stipple drawing of transparent pixels.

-stipple pixmap

This option specifies the depth 1 pixmap to use to draw transparent pixels.

+axes/-axes

This option indicates that the axes in the Pixmap widget should be displayed or not.

+proportional/-proportional

This option indicates that the pixels in the Pixmap widget should be drawn proportional, i.e. in squares, or not.

-hl color

This option specifies the color to use for highlighting purposes. color can be any name accepted by the XParseColor(3X11) function.

-fr color

This option specifies the color to use draw grid and axes in Pixmap widget. color can be any name accepted by the XParseColor(3X11) function.

-tr color

This option specifies the color to use to represent transparent pixels. color can be any name accepted by the XParseColor(3X11) function.

-fn/-font fontname

This option specifies the font to be used in pixmap.

-filename/-f/-in filename

This option specifies the name of the file from which the pixmap to be edited should be loaded.

-colormap/-pc

This options specifies that pixmap should use its own private colormap instead of the default colormap.

Pixels editing with mouse

Pixels may be set, cleared, or inverted by pointing to them and clicking one of the buttons indicated below. Multiple pixels can be changed at once by holding the button down and dragging the cursor across them. Set pixels are filled with the current color; cleared pixels are filled with white; and inverted pixels are either set if they were originally cleared or cleared otherwise.

Button 1

This button (usually leftmost on the pointer) is used to set one or more pixels.

Button 2

This button (usually in the middle) is used to invert one or more pixels.

Button 3

This button (usually on the right) is used to clear one or more pixels.

Button 4

This button is used to clear one or more pixels.

Button 5

This button is used to clear one or more pixels.

Every button operation can be changed by means of resources in the .Xdefaults file or application defaults file (/usr/lib/X11/app-defaults/Pixmap).

Color panel

Colors in pixmap are presented in the Color Panel. Each loaded color is associated a square button, filled with the color pixel. Scrollbars around the panel enable scanning the whole panel. To choose a color for drawing, the user must click on a color button. At this time, the current name of the color is displayed as the title of the Foreground Color menu. A color can also be selected by using Shift<BtnDown> on a pixel of the current pixmap which color should be used. This accelerator is very useful when modifying small parts of a pixmap locally.

File format

The Save or Save As... commands store pixmaps using the format defined by Arnaud Le Hors in his Xpm library (version 3.x). Each pixmap is a C string array variable that can be included and used within programs, or referred to by X Toolkit pixmap resources (assuming that a String to Pixmap converter has been registered on the server). Here is an example of a pixmap file:

              /* XPM */
              static char * plaid[] = {
              /* plaid pixmap 
               * width height ncolors chars_per_pixel */
              "22 22 4 2 ",
              /* colors */
              "   c red         m white  s light_color ",
              "Y  c yellow      m black  s lines_in_mix ",
              "+  c yellow      m white  s lines_in_dark ",
              "x                m black  s dark_color ",
              /* pixels */
              "x   x   x x x   x   x x x x x x + x x x x x ", 
              "  x   x   x   x   x   x x x x x x x x x x x ", 
              "x   x   x x x   x   x x x x x x + x x x x x ", 
              "  x   x   x   x   x   x x x x x x x x x x x ", 
              "x   x   x x x   x   x x x x x x + x x x x x ", 
              "Y Y Y Y Y x Y Y Y Y Y + x + x + x + x + x + ", 
              "x   x   x x x   x   x x x x x x + x x x x x ", 
              "  x   x   x   x   x   x x x x x x x x x x x ", 
              "x   x   x x x   x   x x x x x x + x x x x x ", 
              "  x   x   x   x   x   x x x x x x x x x x x ", 
              "x   x   x x x   x   x x x x x x + x x x x x ", 
              "          x           x   x   x Y x   x   x ", 
              "          x             x   x   Y   x   x   ",
              "          x           x   x   x Y x   x   x ", 
              "          x             x   x   Y   x   x   ", 
              "          x           x   x   x Y x   x   x ", 
              "x x x x x x x x x x x x x x x x x x x x x x ", 
              "          x           x   x   x Y x   x   x ", 
              "          x             x   x   Y   x   x   ", 
              "          x           x   x   x Y x   x   x ", 
              "          x             x   x   Y   x   x   ", 
              "          x           x   x   x Y x   x   x "
              } ;

The plaid name used to reference the pixmap variable is constructed from the name of the file in which is saved the pixmap. Any directories are stripped off the front of the name and any suffix beginning with a period is stripped off the end.

The pixmap variable is a string array in which the first string of the array contains the width, height, number of colors and number of characters per pixel.

The following strings represent the color descriptions, one string per color. A color description can be composed of one or more characters that represent a pixel, and color display name preceded by the `c' character, and/or a symbolic name preceded by the `s' character, and/or a monochrome display name preceded by the `m' character, and or a grey scale 4 levels display name preceded by the string `g4' , and/or a grey scale display name preceded by the aharacter `g', specified in any order.

Following color description strings, each string represent a line of the pixmap, composed of symbolic characters assigned to colors.

Using pixmaps in programs

The format of pixmap files is designed to make pixmaps easy to use within X programs, whatever your display is. The following code could be used to create a pixmap to use as a window background, using the enhanced Xpm library (version 3.3) from Groupe Bull and assuming that the pixmap was stored in a file name plaid.xpm:

        #include "plaid.xpm"
        Pixmap pixmap;
        XpmCreatePixmapFromData (display, drawable, plaid, &pixmap, 
				 &pixmap_mask, &attributes);

Additional routines are available for reading in pixmap files and returning the data in the file in Pixmaps.

Widget hierarchy

The hierarchy of the pixmap editor is discribed here in order to configure the editor by means of X resources in a .Xdefaults file. The first widget class is the Athena version one, while the second one, separated by a | character, is the Motif version one.

Pixmap 							pixmap
	Paned|RowColumn 				parent
		Form|RowColumn 			formy
			MenuButton|CascadeButtonGadget	fileButton
			SimpleMenu|RowColumn		fileMenu
				SmeBSB|PushButtonGadget	load
				SmeBSB|PushButtonGadget	insert
				SmeBSB|PushButtonGadget	save
				SmeBSB|PushButtonGadget	saveAs
				SmeLine|SeparatorGadget	line
				SmeBSB|PushButtonGadget	resize
				SmeBSB|PushButtonGadget	rescale
				SmeBSB|PushButtonGadget	filename
				SmeBSB|PushButtonGadget	hintsCmt
				SmeBSB|PushButtonGadget	colorsCmt
				SmeBSB|PushButtonGadget	pixelsCmt
				SmeLine|SeparatorGadget	line
				SmeBSB|PushButtonGadget	quit
			MenuButton|CascadeButtonGadget	editButton
			SimpleMenu|RowColumn 		editMenu
				SmeBSB|ToggleButtonGadget	image
				SmeLine|SeparatorGadget	line
				SmeBSB|ToggleButtonGadget	grid
				SmeBSB|ToggleButtonGadget	axes
				SmeBSB|ToggleButtonGadget	proportional
				SmeBSB|ToggleButtonGadget	zoom
				SmeBSB|PushButtonGadget	zoomIn
				SmeBSB|PushButtonGadget	zoomOut
				SmeBSB|PushButtonGadget	zoomFactor
				SmeLine|SeparatorGadget	line
				SmeBSB|PushButtonGadget	cut
				SmeBSB|PushButtonGadget	copy
				SmeBSB|PushButtonGadget	paste
				SmeBSB|PushButtonGadget	crop
			MenuButton|CascadeButtonGadget	fgButton
			SimpleMenu|RowColumn 		fgMenu
				SmeBSB|PushButtonGadget	addColor
				SmeBSB|PushButtonGadget	symbolicName
				SmeBSB|PushButtonGadget	monochromeName
				SmeBSB|PushButtonGadget	g4Name
				SmeBSB|PushButtonGadget	gName
			MenuButton|CascadeButtonGadget	extensionButton
			SimpleMenu|RowColumn 		extensionMenu
				SmeBSB|PushButtonGadget	addExtension
				SmeBSB|PushButtonGadget	<extension_name>
				.
				.
				.
			Label|CascadeButtonGadget 	status
			|CascadeButtonGadget		statusb
			Command|CascadeButtonGadget	infoButton
		Paned|Form 				pane
			Form|RowColumn 		form
				Command|PushButtonGadget	undo
				Command|PushButtonGadget	clear
				Command|PushButtonGadget	set
				Command|PushButtonGadget	redraw
				Toggle|ToggleButtonGadget	copy
				Toggle|ToggleButtonGadget	move
				Toggle|ToggleButtonGadget	mark
				Command|PushButtonGadget	unmark
				|RowColumn		formh
					Command|PushButtonGadget	flipHoriz
					Command|PushButtonGadget	up
					Command|PushButtonGadget	flipVert
				|RowColumn		formh
					Command|PushButtonGadget	left
					Command|PushButtonGadget	fold
					Command|PushButtonGadget	right
				|RowColumn		formh
					Command|PushButtonGadget	rotateLeft
					Command|PushButtonGadget	down
					Command|PushButtonGadget	rotateRight
				Toggle|ToggleButtonGadget	point
				Toggle|ToggleButtonGadget	line
				Toggle|ToggleButtonGadget	rectangle
				Toggle|ToggleButtonGadget	filledRectangle
				Toggle|ToggleButtonGadget	circle
				Toggle|ToggleButtonGadget	filledCircle
				Toggle|ToggleButtonGadget	floodFill
				Toggle|ToggleButtonGadget	setHotSpot
				Command|PushButtonGadget	clearHotSpot
				Toggle|ToggleButtonGadget	setPort
				Toggle|ToggleButtonGadget	clearPort
				Toggle|ToggleButtonGadget	movePort
				Toggle|ToggleButtonGadget	portInfo
			Paned|PanedWindow		vPane
				ViewPort|ScrolledWindow	colorView
					Box|RowColumn		colorPane
						Command|PushButton	<color_name>
						.
						.
						.
				ViewPort|ScrolledWindow	pixmapView
					Pixmap|Pixmap 		pixmap
	TransientShell|TransientShell 		image
		Label|Label 				label
	PopupShell|SelectionBox 			info
		Dialog| 					dialog
			Label|				label
			Text|				value
			Command|				Okay
	PopupShell|SelectionBox 			input
		Dialog| 					dialog
			Label|				label
			Text|				value
			Command|				Okay
			Command|				Cancel
	PopupShell|SelectionBox 			file
		Dialog| 					dialog
			Label|				label
			Text|				value
			Command|				Okay
			Command|				Cancel
	PopupShell|SelectionBox 			error
		Dialog| 					dialog
			Label|				label
			Command|				Abort
			Command|				Retry
	PopupShell|SelectionBox 			qsave
		Dialog| 					dialog
			Label|				label
			Text|				value
			Command|				Yes
			Command|				No
			Command|				Cancel
	PopupShell|PopupShell			extEditorShell|extEditor_popup
		Form|Form					extEditor
			Label|Label			name
			AsciiText|ScrolledText		text
			Command|PushButtonGadget		ok
			Command|PushButtonGadget		cancel
			Command|PushButtonGadget		remove

Lines where only appears one or the other type of a widget (like Dialog| or |CascadeButtonGadget) mean that the widget doesn't exist in one or the other version. In the case of dialogs in the Motif version, the widgets are created by means of convenient routines which assign the name of the widget depending on the name of the dialog. By the way, we can't provide with a list of types and names for the substructure of dialog widgets in the Motif version. However, these shouldn't be often modified.

X defaults

In addition to the standard Athena or Motif widgets resources, pixmap uses the following resources for the Pixmap widget (named pixmap):

Cursor

The cursor to use within the Pixmap widget.

Foreground

The initial foreground color for drawing.

Highlight

The highlighting color.

Framing

The framing color, used to draw grid and axes.

Transparent

The color representing transparent pixels.

Proportional

Toggles initial proportional display mode.

Grid

Toggles initial grid display.

GridTolerance

Determines when to display grid according to SquareSize.

Stippled

Suppress stipple drawing of transparent pixels.

Stipple

Depth 1 pixmap to use to draw transparent pixels stippled.

Axes

Toggles axes display.

Resize

Toggles Pixmap widget resize when requesting by window manager.

Distance

The margin around Pixmap widget.

SquareSize

The size in screen points used to display each pixmap pixels.

PixmapWidth

The initial width of the pixmap.

PixmapHeight

The initial height of the pixmap.

Button1Action

The action associated to mouse button 1 (between Set, Invert and Clear).

Button2Action

The action associated to mouse button 2 (between Set, Invert and Clear).

Button3Action

The action associated to mouse button 3 (between Set, Invert and Clear).

Button4Action

The action associated to mouse button 4 (between Set, Invert and Clear).

Button5Action

The action associated to mouse button 5 (between Set, Invert and Clear).

Filename

The initial file to load.

AddColorNtfyProc

The procedure to call when reading a pixmap file to notify color loading. It is strongly advised not to change this resource.

ExtensionNtfyProc

The procedure to call when reading a pixmap file to notify extension loading. It is strongly advised not to change this resource.

Releases

8 releases since Debian 5.0 (Lenny); the text changed 1 time.

  1. 5.0–11
  2. 12

Bugs

If you move the pointer too fast while holding a pointer button down, some pixels may be missed. This is caused by limitations in how frequently the X server can sample the pointer location.

Loading a pixmap file where the same color is used more than once with different symbols and descriptions, and writing it will loose information concerning the color used more than once. The pixmap file plaid given as an example in this man won't be saved that way by pixmap.

Accelerators to menu operations don't seem to work with Athena version.

In the Motif version, the Filename... and Resize... commands open their respective dialog window in a strange mode. The user has to voluntary (;-) give the focus to the text widget inside to be able to change its content.

Author

pixmap by Lionel Mallet - Simulog. Extension edition and customized Port editor by Tim Wise - SES Inc.

From pixmap 2.6.6-1 in Debian 12 (Bookworm). Parsed by carta from the page's man source.