BITMAP(1)

๐Ÿ’… BITMAP(1) โ€” bitmap, bmtoa, atobm

okay bestie, gather round, because this one's a whole family of utilities from the General Commands Manual (section 1, X Window System vibes) and they're lowkey iconic. We're talking a bitmap editor plus two converter filters, and no cap they're all in one page. Let's go ๐ŸŽ€


โœจ NAME โœจ

bitmap, bmtoa, atobm โ€” bitmap editor and converter utilities for the X Window System ๐Ÿ–ผ๏ธ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

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

bmtoa [ -chars ... ] [ filename ]

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

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So bitmap is a rudimentary tool โ€” her own words, not mine โ€” for creating or editing rectangular images made up of 1's and 0's. That's it, that's the whole girlboss. Bitmaps are used in X for defining clipping regions, cursor shapes, icon shapes, and tile and stipple patterns. Very "everything is literally just a grid of bits" energy. ๐Ÿ’€

And then the bmtoa and atobm filters convert bitmap files (peep FILE FORMAT ๐Ÿ‘€) to and from ASCII strings. They're most commonly used to quickly print out bitmaps and to generate versions for including in text. Little converters, doing their thing, serving utility. ๐Ÿซถ


๐ŸŽ€ COMMAND LINE OPTIONS ๐ŸŽ€

bitmap supports the standard X Toolkit command line arguments (see X(7)), bestie โ€” that's the baseline. But the following additional arguments are supported as well, and honestly? obsessed. โœจ

  • -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. (automatic glow-down, we love a self-aware grid ๐Ÿ™ˆ)
  • -grid, +grid โ€” Turns on or off the grid lines.
  • -axes, +axes โ€” Turns on or off the major axes.
  • -dashed, +dashed โ€” Turns on or off dashing for the frame and grid lines.
  • -stippled, +stippled โ€” Turns on or off 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 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 will assume it is a new file. (no file? no problem, bestie ๐Ÿคทโ€โ™€๏ธ)
  • basename โ€” Specifies the basename to be used in the C code output file. If it is different than the basename in the working file, bitmap will change it when saving the file.

๐Ÿ’– bmtoa options

bmtoa accepts the following option โ€” one single icon, doing her one job flawlessly:

  • -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 0's and sharp signs (#) for 1's.

๐Ÿ’œ atobm options

atobm accepts the following options, okay she's got a bit more going on, main character energy:

  • -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 0's and sharp signs (#) for 1's.
  • -name variable โ€” This option specifies the variable name to be used when writing out the bitmap file. The default is to use the basename 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.

โญ all three of them, bestie

All three commands also accept these options:

  • -help โ€” Prints a usage message and exits.
  • -version โ€” Prints version info and exits.

๐ŸŒˆ USAGE ๐ŸŒˆ

bitmap displays grid in which each square represents a single bit in the picture being edited. Actual size of the bitmap image โ€” as it would appear normally and inverted โ€” can be obtained by pressing Meta+I. You are free to move the image popup out of the way to continue editing (yes, it's a draggable little diva, she won't block you ๐Ÿ’…). 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 may 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 bullseyes), this is usually at the center. iykyk ๐ŸŽฏ

Bitmaps are stored as small C code fragments suitable for including in applications. They provide an array of bits as well as symbolic constants giving the width, height, and hot spot (if specified) that may be used in creating cursors, icons, and tiles. Tiny file, big responsibilities, iconic behavior honestly. ๐Ÿ‘‘


๐Ÿ“ EDITING ๐Ÿ“

To edit a bitmap image simply click on one of the buttons with drawing commands (Point, Curve, Line, Rectangle, etc.) 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 what its previous state was.

The default behavior of mouse buttons is as specified below. ๐Ÿ–ฑ๏ธ

MouseButton1        Set
MouseButton2        Invert
MouseButton3        Clear
MouseButton4        Clear
MouseButton5        Clear

This default behavior can be changed by setting the button function resources. An example is provided below. (yes bestie, you can absolutely remap them, go off โœจ)

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

The button function applies to all drawing commands, including copying, moving and pasting, flood filling and setting the hot spot. Every single one. No exceptions, she's thorough. ๐Ÿ’€๐Ÿซถ

๐ŸŽจ DRAWING COMMANDS ๐ŸŽจ

okay bestie, here's the list of drawing commands you can get to through the buttons on the left side of the app's window. Some commands can be aborted by pressing A inside the bitmap window, which lets you pick different guiding points where applicable. ๐Ÿ’…

  • Clear โ€” clears all bits in the bitmap image. The grid squares get set to the background color. Pressing C inside the bitmap window has the same effect. โœจ
  • Set โ€” sets all bits in the bitmap image. The grid squares get set to the foreground color. Pressing S inside the bitmap window has the same effect. ๐Ÿ’–
  • Invert โ€” 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 โ€” marks an area of the grid by dragging out a rectangular shape in the highlighting color. Once the area is marked, it can be operated on by a number of commands (see Up, Down, Left, Right, Rotate, Flip, Cut, etc.). Only one marked area can be present at any time. If you attempt to mark another area, the old mark will vanish. Same effect: press Shift-MouseButton1 and drag out a rectangle in the grid window. Pressing Shift-MouseButton2 marks the entire grid area. ๐ŸŽ€
  • Unmark โ€” causes the marked area to vanish. Same effect: press Shift-MouseButton3. โœจ
  • Copy โ€” copies 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. If you click a mouse button inside the marked area, you'll be able to drag the rectangle that represents the marked area to the desired location. After you release the mouse button, the area will be copied. If you click outside the marked area, Copy will assume that you wish to mark a different region of the bitmap image, thus it will behave like Mark again. ๐Ÿ’…
  • Move โ€” moves 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 โ€” flips 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 H inside the bitmap window has the same effect. ๐Ÿ”ฅ
  • Up โ€” 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 โ€” 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 โ€” 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 โ€” 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 โ€” 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 โ€” 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 โ€” 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 โ€” 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 โ€” 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 may not be continuous, depending on the speed of your system and frequency of mouse motion events. ๐Ÿ“
  • Curve โ€” changes the grid squares underneath the mouse pointer if a mouse button is being pressed down. If you drag the mouse button continuously, it will make sure that the line is continuous. If your system is slow or bitmap receives very few mouse motion events, it might behave quite strangely. ๐Ÿ˜ญ
  • Line โ€” changes the grid squares in a line between two squares. Once you press a mouse button in the grid window, bitmap will highlight 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 โ€” changes the grid squares in a rectangle between two squares. Once you press a mouse button in the grid window, bitmap 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 โ€” identical to Rectangle, except at the end the rectangle will be filled rather than outlined. ๐Ÿ’–
  • Circle โ€” changes the grid squares in a circle between two squares. Once you press a mouse button in the grid window, bitmap 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 โ€” identical to Circle, except at the end the circle will be filled rather than outlined. ๐Ÿฆ‹
  • Flood Fill โ€” flood fills the connected area underneath the mouse pointer when you click on the desired square. Diagonally adjacent squares are not considered to be connected. ๐ŸŒŠ
  • Set Hot Spot โ€” designates one square in the grid as the hot spot if this bitmap image is to be used for defining a cursor. Pressing a mouse button in the desired square will cause a diamond shape to be displayed. ๐Ÿ’Ž
  • Clear Hot Spot โ€” removes any designated hot spot from the bitmap image. โœจ
  • Undo โ€” undoes the last executed command. It has depth one, that is, pressing Undo after Undo will undo itself. ๐Ÿ˜Œ

๐Ÿ“ FILE MENU ๐Ÿ“

The File menu commands can be accessed by pressing the File button and selecting the appropriate menu entry, or by pressing Ctrl key with another key. These commands deal with files and global bitmap parameters, such as size, basename, filename etc. ๐Ÿซถ

  • New โ€” 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 โ€” loads a new bitmap file into the bitmap editor. If the current image has not been saved, user 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 cut and paste mechanism as described below. ๐ŸŽ€
  • Insert โ€” inserts a bitmap file into the image being currently edited. After being prompted for the filename, click inside the grid window and drag the outlined rectangle to the location where you want to insert the new file. ๐Ÿซถ
  • Save โ€” saves the bitmap image. It will not prompt for the filename unless it is said to be <none>. If you leave the filename undesignated or -, the output will be piped to stdout. ๐Ÿ’พ
  • Save As โ€” saves the bitmap image after prompting for a new filename. It should be used if you want to change the filename. ๐Ÿ’–
  • Resize โ€” resizes the editing area to the new number of pixels. The size should be entered in the WIDTHxHEIGHT format. The information in the image being edited will not be lost unless the new size is smaller than the current image size. The editor was not designed to edit huge files. ๐Ÿ“
  • Rescale โ€” 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. Feel free to add your own algorithms for better rescaling. ๐Ÿ”
  • Filename โ€” changes the filename without changing the basename nor saving the file. If you specify - for a filename, the output will be piped to stdout. ๐Ÿท๏ธ
  • Basename โ€” changes the basename, if a different one from the specified filename is desired. โœจ
  • Quit โ€” terminates the bitmap application. If the file was not saved, user will be prompted and asked whether to save the image or not. This command is preferred over killing the process. ๐Ÿ‘‹

๐Ÿ’… EDIT MENU ๐Ÿ’…

Okay so the Edit menu commands are your little editing control room: press the Edit button and pick the menu entry, or hold Meta with another key. These deal with editing facilities like grid, axes, zooming, cut and paste, etc. Slay.

  • Image โ€” shows the image being edited and its inverse at actual size in a separate window. You can move that window away and keep editing. Pressing the left mouse button in the image window makes it disappear. Iconic.
  • Grid โ€” controls the grid in the editing area. If the grid spacing is below the value specified by the gridTolerance resource (8 by default), the grid is automatically turned off. You can enforce it by explicitly activating this command.
  • Dashed โ€” controls the stipple for drawing grid lines. The stipple specified by the dashes resource can be turned on or off by activating this command.
  • Axes โ€” controls highlighting of the main axes of the image being edited. The actual lines are not part of the image. Theyโ€™re there to help when youโ€™re constructing symmetrical images, or whenever having the main axes highlighted helps your editing.
  • Stippled โ€” controls the stippling of the highlighted areas of the bitmap image. The stipple specified by the stipple resource can be turned on or off by activating this command.
  • Proportional โ€” controls proportional mode. If itโ€™s on, width and height of all image squares are forced to be equal, regardless of the proportions of the bitmap window.
  • Zoom โ€” controls zoom mode. If thereโ€™s a marked area of the image already displayed, bitmap will automatically zoom into it. Otherwise, you have to highlight an area to be edited in zoom mode, and bitmap will automatically switch into it. You can use all the editing commands and other utilities in zoom mode. When you zoom out, the undo command will undo the whole zoom session.
  • Cut โ€” cuts the contents of the highlighted image area into the internal cut and paste buffer.
  • Copy โ€” copies the contents of the highlighted image area into the internal cut and paste buffer.
  • Paste โ€” checks if there are any other bitmap applications with a highlighted image area, or if thereโ€™s something in the internal cut and paste buffer, and copies it to the image. To place the copied image, click in the editing window and drag the outlined image to the position where you want to place it, then release the button.

โœ‚๏ธ CUT AND PASTE โœ‚๏ธ

Bitmap supports two cut and paste mechanisms: the internal cut and paste, and the global X selection cut and paste. The internal cut and paste is used when executing copy and move drawing commands and also cut and copy commands from the edit menu. The global X selection cut and paste is used whenever there is a highlighted area of a bitmap image displayed anywhere on the screen.

To copy a part of an image from another bitmap editor, simply highlight the desired area by 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, etc.) that use primary selection will discard their selection values and unhighlight the appropriate information. Now use the Paste command from the Edit menu or the control mouse button to copy the selected part of the image into another (or the same) bitmap application. If you attempt 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 stored there at the moment.

๐Ÿงฉ WIDGETS ๐Ÿงฉ

Below is the widget structure of the bitmap 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 bitmap to be viewable in color, include the following in the #ifdef COLOR section of the file you read with xrdb:

*customization:                 -color

This will cause bitmap to pick up the colors in the app-defaults color customization file:

/usr/share/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 be used for that purpose as well. 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

All the Simple Widget resources plus ...

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

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Davor Matic, MIT X Consortium


source/version vibes: X Version 11, bitmap 1.1.1, and BITMAP(1) โ€” thatโ€™s the footer, bestie. The date spot is literally not listed in this footer, so consider that your cute little sign-off ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from