bitmap

NAME

bitmap, bmtoa, atobm - bitmap editor and converter utilities for the X Window System

SYNOPSIS

bitmap [-options ...] [filename ] [basename]

bmtoa [-chars cc] [filename]
atobm [-chars cc] [-name variable] [-xhot number] [-yhot number] [filename]

DESCRIPTION

The bitmap(1) program is a rudimentary tool for creating or editing rectangular images made up of ones and zeros. Bitmaps are used in X for defining clipping regions, cursor shapes, icon shapes, and tile and stipple patterns.

The bmtoa(1) and atobm(1) filters convert bitmap(1) files to and from ASCII strings. They are most commonly used to print out bitmaps quickly and to generate versions to include in text.

COMMAND-LINE OPTIONS

Bitmap(1) supports the standard X Toolkit command-line arguments [see X(5) ]. The following additional arguments are also supported:
-size widthxheight
Specifies size of the grid in squares.
-sw dimension
Specifies the width of squares in pixels.
-sh dimension
Specifies the height of squares in pixels.
-gt dimension
Grid tolerance. If the square dimensions fall below the specified value, grid will be automatically turned off.
-grid
+grid
Displays (+) or hides (-) the grid lines.
-axes
+axes
Displays (+) or hides (-) the major axes.
-dashed
+dashed
Displays (+) or hides (-) dashing for the frame and grid lines.
-stippled
+stippled
Displays (+) or hides (-) stippling of highlighted squares.
-proportional
+proportional
Turns proportional mode on (+) or off (-). If proportional mode is on, square width is equal to square height. If proportional mode is off, bitmap(1) will use the smaller square dimension, if they were initially different.
-dashes filename
Specifies the bitmap to be used as a stipple for dashing.
-stipple filename
Specifies the bitmap to be used as a stipple for highlighting.
-hl color
Specifies the color used for highlighting.
-fr color
Specifies the color used for the frame and grid lines.
filename
Specifies the bitmap to be initially loaded into the program. If the file does not exist, bitmap(1) will assume it is a new file.
basename
Specifies the base name to be used in the C code output file. If it is different from the base name in the working file, bitmap(1) will change it when saving the file.

Bmtoa(1) accepts the following option:

-chars cc
This option specifies the pair of characters to use in the string version of the bitmap. The first character is used for 0 bits and the second character is used for 1 bits. The default is to use dashes (-) for zeros and number signs (#) for ones.

OPTIONS

-chars cc
This option specifies the pair of characters to use when converting string bitmaps into arrays of numbers. The first character represents a 0 bit and the second character represents a 1 bit. The default is to use dashes (-) for zeros and number signs (#) for ones.
-name variable
This option specifies the variable name to be used when writing out the bitmap file. The default is to use the base name of the filename command-line argument or leave it blank if the standard input is read.
-xhot number
This option specifies the X coordinate of the hotspot. Only positive values are allowed. By default, no hotspot information is included.
-yhot number
This option specifies the Y coordinate of the hotspot. Only positive values are allowed. By default, no hotspot information is included.

USAGE

Bitmap(1) displays a grid in which each square represents a single bit in the picture being edited. The actual size of the bitmap image, as it would appear normally and inverted, can be obtained by pressing the Meta-I key. You can move the image popup out of the way to continue editing. Pressing the left mouse button in the popup window or Meta-I again will remove the real size bitmap image.

If the bitmap is to be used for defining a cursor, one of the squares in the images can be designated as the hot spot. This determines where the cursor is actually pointing. For cursors with sharp tips (such as arrows or fingers), this is usually at the end of the tip; for symmetric cursors (such as crosses or bulls eyes), this is usually at the center.

Bitmaps are stored as small C-code fragments suitable for including in applications. They provide an array of bits and symbolic constants giving the width, height, and hot spot (if specified) that may be used in creating cursors, icons, and tiles.

EDITING

To edit a bitmap image, click one of the buttons with drawing commands (such as Curve, Line, Rectangle), and move the pointer into the bitmap grid window. Press one of the buttons on your mouse, and the appropriate action will take place. You can either set, clear, or invert the grid squares. Setting a grid square corresponds to setting a bit in the bitmap image to 1. Clearing a grid square corresponds to setting a bit in the bitmap image to 0. Inverting a grid square corresponds to changing a bit in the bitmap image from 0 to 1 or 1 to 0, depending on its previous state. The default behavior of mouse buttons is as specified below.
MouseButton1 Set
MouseButton2 Invert
MouseButton3 Clear
MouseButton4 Clear
MouseButton5 Clear

You can change this default behavior by setting the button function resources. An example is provided below:

bitmap*button1Function: Set
bitmap*button2Function: Clear
bitmap*button3Function: Invert

The button function applies to all drawing commands, including copying, moving and pasting, flood filling and setting the hot spot.

DRAWING COMMANDS

Here is the list of drawing commands accessible through the buttons at the left side of the application's window. You can abort some commands by pressing A inside the bitmap window. This allows you to select different guiding points where applicable.
Clear
This command clears all bits in the bitmap image. The grid squares will be set to the background color. Pressing C inside the bitmap window has the same effect.
Set
This command sets all bits in the bitmap image. The grid squares will be set to the foreground color. Pressing S inside the bitmap window has the same effect.
Invert
This command inverts all bits in the bitmap image. The grid squares will be inverted appropriately. Pressing I inside the bitmap window has the same effect.
Mark
You can use this command to mark an area of the grid by dragging out a rectangular shape in the highlighting color. Once you have marked the area, it can be operated on by a number of commands (for example, see Up, Down, Left, Right, Rotate, Flip, Cut) Only one marked area can be present at any time. If you attempt to mark another area, the old mark will vanish. The same effect can be achieved by pressing Shift-MouseButton1 and dragging out a rectangle in the grid window. Pressing Shift-MouseButton2 will mark the entire grid area.
Unmark
This command will cause the marked area to vanish. You can achieve the same effect by pressing Shift-MouseButton3.
Copy
You can use this command to copy an area of the grid from one location to another. If there is no marked grid area displayed, Copy behaves just like Mark described above. Once there is a marked grid area displayed in the highlighting color, this command has two alternative behaviors:
Move
You can use this command to move an area of the grid from one location to another. Its behavior resembles the behavior of Copy command, except that the marked area will be moved instead of copied.
Flip Horizontally
This command will flip the bitmap image with respect to the horizontal axes. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing F inside the bitmap window has the same effect.
Up
This command moves the bitmap image one pixel up. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing UpArrow inside the bitmap window has the same effect.
Flip Vertically
This command flips the bitmap image with respect to the vertical axes. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing V inside the bitmap window has the same effect.
Left
This command moves the bitmap image one pixel to the left. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing LeftArrow inside the bitmap window has the same effect.
Fold
This command folds the bitmap image so that the opposite corners become adjacent. This is useful when creating bitmap images for tiling. Pressing F inside the bitmap window has the same effect.
Right
This command moves the bitmap image one pixel to the right. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing RightArrow inside the bitmap window has the same effect.
Rotate Left
This command rotates the bitmap image 90 degrees to the left (counter clockwise.) If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing L inside the bitmap window has the same effect.
Down
This command moves the bitmap image one pixel down. If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing DownArrow inside the bitmap window has the same effect.
Rotate Right
This command rotates the bitmap image 90 degrees to the right (clockwise.) If a marked area of the grid is highlighted, it will operate only inside the marked area. Pressing R inside the bitmap window has the same effect.
Point
This command changes the grid squares underneath the mouse pointer if a mouse button is being pressed down. If you drag the mouse button continuously, the line might not be continuous, depending on the speed of your system and frequency of mouse motion events.
Curve
This command changes the grid squares underneath the mouse pointer if you are pressing a mouse button. If you drag the mouse button continuously, the line will be continuous. If your system is slow, or bitmap(1) receives very few mouse-motion events, it might behave quite strangely.
Line
This command changes the grid squares in a line between two squares. Once you press a mouse button in the grid window, bitmap(1) highlights the line from the square where the mouse button was initially pressed to the square where the mouse pointer is located. By releasing the mouse button you will cause the change to take effect, and the highlighted line will disappear.
Rectangle
This command changes the grid squares in a rectangle between two squares. Once you press a mouse button in the grid window, bitmap(1)will highlight the rectangle from the square where the mouse button was initially pressed to the square where the mouse pointer is located. By releasing the mouse button you will cause the change to take effect, and the highlighted rectangle will disappear.
Filled Rectangle
This command is identical to Rectangle, except at the end, the rectangle is filled rather than outlined.
Circle
This command changes the grid squares in a circle between two squares. Once you press a mouse button in the grid window, bitmap(1) will highlight the circle from the square where the mouse button was initially pressed to the square where the mouse pointer is located. By releasing the mouse button you will cause the change to take effect, and the highlighted circle will disappear.
Filled Circle
This command is identical to Circle, except at the end, the circle is filled rather than outlined.
Flood Fill
This command will flood fill the connected area underneath the mouse pointer when you click the desired square. Diagonally adjacent squares are not considered to be connected.
Set Hot Spot
This command designates one square in the grid as the hot spot if this bitmap image is to be used for defining a cursor. When you press a mouse button in the desired square, a diamond shape is displayed.
Clear Hot Spot
This command removes any designated hot spot from the bitmap image.
Undo
This command undoes the last executed command. It has depth one, that is, pressing Undo after Undo will undo itself.

FILE MENU

You can access the File menu commands by pressing the File button and selecting the appropriate menu entry, or by pressing CTRL key with another key. These commands affect files and global bitmap parameters, such as size, base name, and file name.
New
This command clears the editing area and prompts for the name of the new file to be edited. It will not load in the new file.
Load
You can use this command to load a new bitmap file into the bitmap editor. If you have not saved the current image, you will be asked whether to save or ignore the changes. The editor can edit only one file at a time. If you need interactive editing, run a number of editors and use the cut-and-paste-mechanism described later.
Insert
This command inserts a bitmap file into the image you are currently edited. After you are prompted for the file name, click inside the grid window and drag the outlined rectangle to the location where you want to insert the new file.
Save
This command saves the bitmap image. It will not prompt you for the file name unless it is said to be <none>. If you leave the file name undesignated or -, the output will be redirected to stdout.
Save As
This command will save the bitmap image after prompting for a new file name. Use it to change the file name.
Resize
This command resizes the editing area to the new number of pixels. The size should be entered in the widthxheight format. The information in the image you are editing will not be lost unless the new size is smaller than the current image size. The editor was not designed to edit very large files.
Rescale
This command rescales the editing area to the new width and height. The size should be entered in the widthxheight format. It will not do antialiasing and information will be lost if you rescale to the smaller sizes. You can add you own algorithms for better rescaling.
Filename
This command changes the file name without changing the base name or saving the file. If you specify - for a file name, the output will be redirected to stdout.
Basename
This command changes the base name, if you want to use one that is different from the specified file name.
Quit
This command terminates the bitmap application. If you did not save the file, you will be prompted and asked whether to save the image or not. It is preferable to use this command rather than killing the process.

EDIT MENU

To access the Edit menu commands, you can either press the Edit button and select the appropriate menu entry, or press the Meta key with another key. These commands affect editing facilities such as grid, axes, zooming, and cut and paste.
Image
This command displays the image being edited and its inverse in its actual size in a separate window. The window can be moved away to continue with editing. Pressing the left mouse button in the image window will cause it to disappear from the screen.
Grid
This command controls the grid in the editing area. If the grid spacing is below the value specified by gridTolerance resource (8 by default), the grid will be automatically turned off. It can be enforced by explicitly activating this command.
Dashed
This command controls the stipple for drawing the grid lines. The stipple specified by dashes resource can be turned on or off by activating this command.
Axes
This command controls the highlighting of the main axes of the image being edited. The lines are not part of actual the image. They are provided as an aid for constructing symmetrical images. They can also be useful when you are editing and need the main axes to be highlighted.
Stippled
This command controls the stippling of the highlighted areas of the bitmap image. You can turn the stipple specified by stipple resource on or off by activating this command.
Proportional
This command controls the proportional mode. If the proportional mode is on, width and height of all image squares are forced to be equal, regardless of the proportions of the bitmap window.
Zoom
This command controls the zoom mode. If there is a marked area of the image already displayed, bitmap will automatically zoom into it. Otherwise, you must highlight an area to be edited in the zoom mode, and bitmap will automatically switch into it. You can use all the editing commands and other utilities in the zoom mode. When you zoom out, the Undo command will undo the entire zoom session.
Cut
This command copies the contents of the highlighted image area into the internal cut-and-paste buffer and then removes the highlighted area from the image.
Copy
This command copies the contents of the highlighted image area into the internal cut-and-paste buffer.
Paste
If another bitmap application has a highlighted area, this command copies the contents of the highlighted area into the image. Otherwise, if there is something in the internal cut-and-paste buffer, it copies the buffer contents to the image. To place the copied image, click in the editing window, drag the outlined image to the position where you want to place it, and then release the button.

CUT AND PASTE

Bitmap(1) supports two cut-and-paste mechanisms: the internal cut-and-paste mechanism and the global X selection cut-and-paste mechanism. You can use the internal cut-and-paste mechanism when executing copy-and-move drawing commands and cut-and-copy commands from the Edit menu. You can use the global X selection cut-and-paste mechanism whenever there is a highlighted area of a bitmap image displayed anywhere on the screen.

To copy a part of image from another bitmap editor, highlight the area you want by either using the Mark command or pressing the SHIFT key and dragging the area with the left mouse button. When the selected area becomes highlighted, any other applications (such as xterm) that use primary selection will discard their selection values and unhighlight the appropriate information. You can then use the Paste command for the Edit menu or control mouse button to copy the selected part of image into another (or the same) bitmap application. If you try to do this without a visible highlighted image area, the bitmap will fall back to the internal cut-and-paste buffer and paste whatever was there stored at the moment.

WIDGETS

Below is the widget structure of the bitmap(1) application. Indentation indicates hierarchical structure. The widget class name is given first, followed by the widget instance name. All widgets except the bitmap widget are from the standard Athena widget set.

Bitmap bitmap
	 TransientShell image
		Box box
			 Label normalImage
			 Label invertedImage
	 TransientShell input
		Dialog dialog
			 Command okay
			 Command cancel
	 TransientShell error
		Dialog dialog
			 Command abort
			 Command retry
	 TransientShell qsave
		Dialog dialog
			 Command yes
			 Command no
			 Command cancel
	 Paned parent
		Form formy
			 MenuButton fileButton
			 SimpleMenu fileMenu
					SmeBSB  new
					SmeBSB  load
					SmeBSB  insert
					SmeBSB  save
					SmeBSB  saveAs
					SmeBSB  resize
					SmeBSB  rescale
					SmeBSB  filename
					SmeBSB  basename
					SmeLine line
					SmeBSB  quit
			 MenuButton editButton
			 SimpleMenu editMenu
					SmeBSB  image
					SmeBSB  grid
					SmeBSB  dashed
					SmeBSB  axes
					SmeBSB  stippled
					SmeBSB  proportional
					SmeBSB  zoom
					SmeLine line
					SmeBSB  cut
					SmeBSB  copy
					SmeBSB  paste
			 Label status
		Pane pane
			 Bitmap bitmap
			 Form form
					Command clear
					Command set
					Command invert
					Toggle  mark
					Command unmark
					Toggle  copy
					Toggle  move
					Command flipHoriz
					Command up
					Command flipVert
					Command left
					Command fold
					Command right
					Command rotateLeft
					Command down
					Command rotateRight
					Toggle  point
					Toggle  curve
					Toggle  line
					Toggle  rectangle
					Toggle  filledRectangle
					Toggle  circle
					Toggle  filledCircle
					Toggle  floodFill
					Toggle  setHotSpot
					Command clearHotSpot
					Command undo

COLORS

If you want be able to view bitmap(1) in color, include the following in the #ifdef COLOR section of the file you read with xrdb(1):

*customization:	-color

This will cause bitmap(1) to pick up the colors in the app-defaults color customization file: /usr/lib/X11/app-defaults/Bitmap-color

BITMAP WIDGET

Bitmap widget is a stand-alone widget for editing raster images. It is not designed to edit large images, although it may also be used for that purpose. It can be freely incorporated with other applications and used as a standard editing tool. The following are the resources provided by the bitmap widget.

Bitmap Widget

Header file Bitmap.h
Class bitmapWidgetClass
Class Name Bitmap
Superclass Bitmap

The following are simple widget resources:

Name Class Type Default Value
foreground Foreground Pixel XtDefaultForeground
highlight Highlight Pixel XtDefaultForeground
framing Framing Pixel XtDefaultForeground
gridTolerance GridTolerance Dimension 8
size Size String 32x32
dashed Dashed Boolean True
grid Grid Boolean True
stippled Stippled Boolean True
proportional Proportional Boolean True
axes Axes Boolean False
squareWidth SquareWidth Dimension 16
squareHeight SquareHeight Dimension 16
margin Margin Dimension 16
xHot XHot Position NotSet (-1)
yHot YHot Position NotSet (-1)
button1Function Button1Function DrawingFunction Set
button2Function Button2Function DrawingFunction Invert
button3Function Button3Function DrawingFunction Clear
button4Function Button4Function DrawingFunction Invert
button5Function Button5Function DrawingFunction Invert
filename Filename String None ("")
basename Basename String None ("")

AUTHOR

Davor Matic, X Consortium