home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Audio / Patchmix / XWindowsSource / bitmap / bitmap.man < prev    next >
Encoding:
Text File  |  1992-03-28  |  18.9 KB  |  659 lines

  1. bITMAP(1) USER COMMANDS BITMAP(1)
  2.  
  3.  
  4.  
  5. NAME
  6.  bitmap, bmtoa, atobm - bitmap editor and converter utilities
  7.  for X
  8.  
  9.  
  10. SYNOPSIS
  11.  bitmap [-options ...]  f i l e n a m e  W I D T Hx H E I G H T
  12.  
  13.  bmtoa [-chars ...] [ f i l e n a m e]
  14.  
  15.  atobm [-chars  c c] [-name  v a r i a b l e] [-xhot  n u m b e r] [-yhot
  16.   n u m b e r] [ f i l e n a m e]
  17.  
  18. DESCRIPTION
  19.  The  b i t m a p program is a rudimentary tool for creating or
  20.  editing rectangular images made up of 1's and 0's. Bitmaps
  21.  are used in X for defining clipping regions, cursor shapes,
  22.  icon shapes, and tile and stipple patterns.
  23.  
  24.  The  b m t o a and  a t o b m filters convert  b i t m a p files (FILE FOR-
  25.  MAT) to and from ASCII strings. They are most commonly used
  26.  to quickly print out bitmaps and to generate versions for
  27.  including in text.
  28.  
  29. USAGE
  30.   B i t m a p displays grid in which each square represents a sin-
  31.  gle bit in the picture being edited. Squares can be set,
  32.  cleared, or inverted directly with the buttons on the
  33.  pointer and a menu of higher level operations such as draw
  34.  line and fill circle is provided to the side of the grid.
  35.  Actual size versions of the bitmap as it would appear nor-
  36.  mally and inverted appear below the menu.
  37.  
  38.  If the bitmap is to be used for defining a cursor, one of
  39.  the squares in the images may be designated as the  h o t s p o t.
  40.  This determines where the cursor is actually pointing. For
  41.  cursors with sharp tips (such as arrows or fingers), this is
  42.  usually at the end of the tip; for symmetric cursors (such
  43.  as crosses or bullseyes), this is usually at the center.
  44.  
  45.  Bitmaps are stored as small C code fragments suitable for
  46.  including in applications. They provide an array of bits as
  47.  well as symbolic constants giving the width, height, and
  48.  hotspot (if specified) that may be used in creating cursors,
  49.  icons, and tiles.
  50.  
  51.  The  W I D T H x H E I G H T argument gives the size to use when creat-
  52.  ing a new bitmap (the default is 16x16). Existing bitmaps
  53.  are always edited at their current size.
  54.  
  55.  If the  b i t m a p window is resized by the window manager, the
  56.  size of the squares in the grid will shrink or enlarge to
  57.  
  58.  
  59.  
  60. Sun Release 3.2 Last change: 28 October 1988 1
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. BITMAP(1) USER COMMANDS BITMAP(1)
  68.  
  69.  
  70.  
  71.  fit.
  72.  
  73. OPTIONS
  74.   B i t m a p accepts the following options:
  75.  
  76.  -help
  77.  This option will cause a brief description of the allow-
  78.  able options and parameters to be printed.
  79.  
  80.  -display  d i s p l a y
  81.  This option specifies the name of the X server to used.
  82.  
  83.  -geometry  g e o m e t r y
  84.  This option specifies the placement and size of the bit-
  85.  map window on the screen. See  X for details.
  86.  
  87.  -nodashed
  88.  This option indicates that the grid lines in the work
  89.  area should not be drawn using dashed lines. Although
  90.  dashed lines are prettier than solid lines, on some
  91.  servers they are significantly slower.
  92.  
  93.  -name  v a r i a b l e n a m e
  94.  This option specifies the variable name to be used when
  95.  writing out the bitmap file. The default is to use the
  96.  basename of the  f i l e n a m e command line argument.
  97.  
  98.  -bw  n u m b e r
  99.  This option specifies the border width in piXels of the
  100.  main window.
  101.  
  102.  -fn  f o n t
  103.  This option specifies the font to be used in the but-
  104.  tons.
  105.  
  106.  -fg  c o l o r
  107.  This option specifies the color to be used for the fore-
  108.  ground.
  109.  
  110.  -bg  c o l o r
  111.  This option specifies the color to be used for the back-
  112.  ground.
  113.  
  114.  -hl  c o l o r
  115.  This option specifies the color to be used for
  116.  highlighting.
  117.  
  118.  -bd  c o l o r
  119.  This option specifies the color to be used for the win-
  120.  dow border.
  121.  
  122.  -ms  c o l o r
  123.  
  124.  
  125.  
  126. Sun Release 3.2 Last change: 28 October 1988 2
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. BITMAP(1) USER COMMANDS BITMAP(1)
  134.  
  135.  
  136.  
  137.  This option specifies the color to be used for the
  138.  pointer (mouse).
  139.  
  140.   B m t o a accepts the following option:
  141.  
  142.  -chars  c c
  143.  This option specifies the pair of characters to use in
  144.  the string version of the bitmap. The first character
  145.  is used for 0 bits and the second character is used for
  146.  1 bits. The default is to use dashes (-) for 0's and
  147.  sharp signs (#) for 1's.
  148.  
  149.   A t o b m accepts the following options:
  150.  
  151.  -chars  c c
  152.  This option specifies the pair of characters to use when
  153.  converting string bitmaps into arrays of numbers. The
  154.  first character represents a 0 bit and the second char-
  155.  acter represents a 1 bit. The default is to use dashes
  156.  (-) for 0's and sharp signs (#) for 1's.
  157.  
  158.  -name  v a r i a b l e
  159.  This option specifies the variable name to be used when
  160.  writing out the bitmap file. The default is to use the
  161.  basename of the  f i l e n a m e command line argument or leave
  162.  it blank if the standard input is read.
  163.  
  164.  -xhot  n u m b e r
  165.  This option specifies the X coordinate of the hotspot.
  166.  Only postive values are allowed. By default, no hotspot
  167.  information is included.
  168.  
  169.  -yhot  n u m b e r
  170.  This option specifies the Y coordinate of the hotspot.
  171.  Only postive values are allowed. By default, no hotspot
  172.  information is included.
  173.  
  174. CHANGING GRID SQUARES
  175.  Grid squares may be set, cleared, or inverted by pointing to
  176.  them and clicking one of the buttons indicated below. Mul-
  177.  tiple squares can be changed at once by holding the button
  178.  down and dragging the cursor across them. Set squares are
  179.  filled and represent 1's in the bitmap; clear squares are
  180.  empty and represent 0's.
  181.  
  182.   B u t t o n  1
  183.  This button (usually leftmost on the pointer) is
  184.  used to set one or more squares. The corresponding
  185.  bit or bits in the bitmap are turned on (set to 1)
  186.  and the square or squares are filled.
  187.  
  188.   B u t t o n  2
  189.  
  190.  
  191.  
  192. Sun Release 3.2 Last change: 28 October 1988 3
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. BITMAP(1) USER COMMANDS BITMAP(1)
  200.  
  201.  
  202.  
  203.  This button (usually in the middle) is used to
  204.  invert one or more squares. The corresponding bit
  205.  or bits in the bitmap are flipped (1's become 0's
  206.  and 0's become 1's).
  207.  
  208.   B u t t o n  3
  209.  This button (usually on the right) is used to clear
  210.  one or more squares. The corresponding bit or bits
  211.  in the bitmap are turned off (set to 0) and the
  212.  square or squares are emptied.
  213.  
  214. MENU COMMANDS
  215.  To make defining shapes easier,  b i t m a p provides 13 commands
  216.  for drawing whole sections of the grid at once, 2 commands
  217.  for manipulating the hotspot, and 2 commands for updating
  218.  the bitmap file and exiting. A command buttons for each of
  219.  these operations is located to the right of the grid.
  220.  
  221.  Several of the commands operate on rectangular portions of
  222.  the grid. These areas are selected after the command button
  223.  is pressed by moving the cursor to the upper left square of
  224.  the desired area, pressing a pointer button, dragging the
  225.  cursor to the lower right hand corner (with the button still
  226.  pressed) , and then releasing the button. The command may
  227.  be aborted by pressing any other button while dragging or by
  228.  releasing outside the grid.
  229.  
  230.  To invoke a command, move the pointer over that command and
  231.  click any button.
  232.  
  233.   C l e a r  A l l
  234.  This command is used to clear all of the bits in
  235.  the bitmap as if Button 3 had been dragged through
  236.  every square in the grid. It cannot be undone.
  237.  
  238.   S e t  A l l
  239.  This command is used to set all of the bits in the
  240.  bitmap as if Button 1 had been dragged through
  241.  every square in the grid. It cannot be undone.
  242.  
  243.   I n v e r t  A l l
  244.  This command is used to invert all of the bits in
  245.  the bitmap as if Button 2 had been dragged through
  246.  every square in the grid.
  247.  
  248.   C l e a r  A r e a
  249.  This command is used to clear a region of the grid
  250.  as if Button 3 had been dragged through each of the
  251.  squares in the region. When this command is
  252.  invoked, the cursor will change shape to indicate
  253.  that the area to be cleared should be selected as
  254.  outlined above.
  255.  
  256.  
  257.  
  258. Sun Release 3.2 Last change: 28 October 1988 4
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. BITMAP(1) USER COMMANDS BITMAP(1)
  266.  
  267.  
  268.  
  269.   S e t  A r e a
  270.  This command is used to set a region of the grid as
  271.  if Button 1 had been dragged through each of the
  272.  squares in the region. When this command is
  273.  invoked, the cursor will change shape to indicate
  274.  that the area to be set should be selected as out-
  275.  lined above.
  276.  
  277.   I n v e r t  A r e a
  278.  This command is used to inverted a region of the
  279.  grid as if Button 2 had been dragged through each
  280.  of the squares in the region. When this command is
  281.  invoked, the cursor will change shape to indicate
  282.  that the area to be inverted should be selected as
  283.  outlined above.
  284.  
  285.   C o p y  A r e a
  286.  This command is used to copy a region of the grid
  287.  from one location to another. When this command is
  288.  invoked, the cursor will change shape to indicate
  289.  that the area to be copied should be selected as
  290.  outlined above. The cursor should then be clicked
  291.  on the square to which the upper left hand corner
  292.  of the region should be copied.
  293.  
  294.   M o v e  A r e a
  295.  This command is used to move a region of the grid
  296.  from one location to another. When this command is
  297.  invoked, the cursor will change shape to indicate
  298.  that the area to be moved should be selected as
  299.  outlined above. The cursor should then be clicked
  300.  on the square to which the upper left hand corner
  301.  of the region should be moved. Any squares in the
  302.  region's old position that aren't also in the new
  303.  position are cleared.
  304.  
  305.   O v e r l a y  A r e a
  306.  This command is used to copy all of the set squares
  307.  in a region of the grid from one location to
  308.  another. When this command is invoked, the cursor
  309.  will change shape to indicate that the area to be
  310.  copied should be selected as outlined above. The
  311.  cursor should then be clicked on the square to
  312.  which the upper left hand corner of the region
  313.  should be overlaid. Only the squares that are set
  314.  in the region will be touched in the new location.
  315.  
  316.   L i n e
  317.  This command will set the squares in a line between
  318.  two points. When this command is invoked, the cur-
  319.  sor will change shape to indicate that the pointer
  320.  should be clicked on the two end points of the
  321.  
  322.  
  323.  
  324. Sun Release 3.2 Last change: 28 October 1988 5
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331. BITMAP(1) USER COMMANDS BITMAP(1)
  332.  
  333.  
  334.  
  335.  line.
  336.  
  337.   C i r c l e
  338.  This command will set the squares on a circle
  339.  specified by a center and a point on the curve.
  340.  When this command is invoked, the cursor will
  341.  change shape to indicate that the pointer should be
  342.  clicked on the center of the circle and then over a
  343.  point on the curve. Small circles may not look
  344.  very round because of the size of the grid and the
  345.  limits of having to work with discrete pixels.
  346.  
  347.   F i l l e d  C i r c l e
  348.  This command will set all of the squares in a cir-
  349.  cle specified by a center and a point on the curve.
  350.  When this command is invoked, the cursor will
  351.  change shape to indicate that the pointer should be
  352.  clicked on the center of the circle and then over a
  353.  point on the curve. All squares side and including
  354.  the circle are set.
  355.  
  356.   F l o o d  F i l l
  357.  This command will set all clear squares in an
  358.  enclosed shape. When this command is invoked, the
  359.  cursor will change shape to indicate that the
  360.  pointer should be clicked on any empty square
  361.  inside the shape to be filled. All empty squares
  362.  that border horizontally or vertically with the
  363.  indicated square are set out to the enclosing
  364.  shape. If the shape is not closed, the entire grid
  365.  will be filled.
  366.  
  367.   S e t  H o t  S p o t
  368.  This command designates one square in the grid as
  369.  the hot spot if this bitmap to be used for defining
  370.  a cursor. When the command is invoked, the cursor
  371.  will change indicating that the pointer should be
  372.  clicked on the square to contain the hot spot.
  373.  
  374.   C l e a r  H o t  S p o t
  375.  This command removes any designated hot spot from
  376.  the bitmap.
  377.  
  378.   W r i t e  O u t p u t
  379.  This command writes a small fragment of C code
  380.  representing the bitmap to the filename specified
  381.  on the command line. If the file already exists,
  382.  the original file will be renamed to  f i l e n a m e~
  383.  before the new file is created. If an error occurs
  384.  in either the renaming or the writing of the bitmap
  385.  file, a dialog box will appear asking whether or
  386.  not  b i t m a p should use / t m p/ f i l e n a m e instead.
  387.  
  388.  
  389.  
  390. Sun Release 3.2 Last change: 28 October 1988 6
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397. BITMAP(1) USER COMMANDS BITMAP(1)
  398.  
  399.  
  400.  
  401.   Q u i t
  402.  This command causes  b i t m a p to display a dialog box
  403.  asking whether or not it should save the bitmap (if
  404.  it has changed) and then exit. Answering  y e s is
  405.  the same as invoking  W r i t e  O u t p u t;  n o causes  b i t m a p
  406.  to simply exit; and  c a n c e l will abort the  Q u i t com-
  407.  mand so that more changes may be made.
  408.  
  409. FILE FORMAT
  410.  The  W r i t e  O u t p u t command stores bitmaps as simple C program
  411.  fragments that can be compiled into programs, referred to by
  412.  X Toolkit pixmap resources, manipulated by other programs
  413.  (see  x s e t r o o t), or read in using utility routines in the
  414.  various programming libraries. The width and height of the
  415.  bitmap as well as the hotspot, if specified, are written as
  416.  preprocessor symbols at the start of the file. The bitmap
  417.  image is then written out as an array of characters:
  418.  
  419.  #define namewidth 11
  420.  #define nameheight 5
  421.  #define namexhot 5
  422.  #define nameyhot 2
  423.  
  424.  static char namebits[] = {
  425.  0x91, 0x04, 0xca, 0x06, 0x84,
  426.  0x04, 0x8a, 0x04, 0x91, 0x04
  427.  };
  428.  
  429.  The name prefix to the preprocessor symbols and to the bits
  430.  array is constructed from the  f i l e n a m e argument given on the
  431.  command line. Any directories are stripped off the front of
  432.  the name and any suffix beginning with a period is stripped
  433.  off the end. Any remaining non-alphabetic characters are
  434.  replaced with underscores. The  n a m e x h o t and  n a m e y h o t
  435.  symbols will only be present if a hotspot has been desig-
  436.  nated using the  S e t  H o t  S p o t command.
  437.  
  438.  Each character in the the array contains 8 bits from one row
  439.  of the image (rows are padded out at the end to a multiple
  440.  of 8 to make this is possible). Rows are written out from
  441.  left to right and top to bottom. The first character of the
  442.  array holds the leftmost 8 bits of top line, and the last
  443.  characters holds the right most 8 bits (including padding)
  444.  of the bottom line. Within each character, the leftmost bit
  445.  in the bitmap is the least signficant bit in the character.
  446.  
  447.  This process can be demonstrated visually by splitting a row
  448.  into words containing 8 bits each, reversing the bits each
  449.  word (since Arabic numbers have the significant digit on the
  450.  right and images have the least significant bit on the
  451.  left), and translating each word from binary to hexidecimal.
  452.  
  453.  
  454.  
  455.  
  456. Sun Release 3.2 Last change: 28 October 1988 7
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463. BITMAP(1) USER COMMANDS BITMAP(1)
  464.  
  465.  
  466.  
  467.  In the following example, the array of 1's and 0's on the
  468.  left represents a bitmap containing 5 rows and 11 columns
  469.  that spells  X 1 1. To its right is is the same array split
  470.  into 8 bit words with each row padded with 0's so that it is
  471.  a multiple of 8 in length (16):
  472.  
  473.  10001001001 10001001 00100000
  474.  01010011011 01010011 01100000
  475.  00100001001 00100001 00100000
  476.  01010001001 01010001 00100000
  477.  10001001001 10001001 00100000
  478.  
  479.  Reversing the bits in each word of the padded, split version
  480.  of the bitmap yields the left hand figure below. Interpret-
  481.  ting each word as hexidecimal number yields the array of
  482.  numbers on the right:
  483.  
  484.  10010001 00000100 0x91 0x04
  485.  11001010 00000110 0xca 0x06
  486.  10000100 00000100 0x84 0x04
  487.  10001010 00000100 0x8a 0x04
  488.  10010001 00000100 0x91 0x04
  489.  
  490.  The character array can then be generated by reading each
  491.  row from left to right, top to bottom:
  492.  
  493.  static char namebits[] = {
  494.  0x91, 0x04, 0xca, 0x06, 0x84,
  495.  0x04, 0x8a, 0x04, 0x91, 0x04
  496.  };
  497.  
  498.  The  b m t o a program may be used to convert  b i t m a p files into
  499.  arrays of characters for printing or including in text
  500.  files. The  a t o b m program can be used to convert strings
  501.  back to  b i t m a p format.
  502.  
  503. USING BITMAPS IN PROGRAMS
  504.  The format of  b i t m a p files is designed to make bitmaps and
  505.  cursors easy to use within X programs. The following code
  506.  could be used to create a cursor from bitmaps defined in
  507.   t h i s. c u r s o r and  t h i s m a s k. c u r s o r:
  508.  
  509.  #include "this.cursor"
  510.  #include "thismask.cursor"
  511.  
  512.  XColor foreground, background;
  513.  /* fill in foreground and background color structures */
  514.  Pixmap source = XCreateBitmapFromData (display, drawable,
  515.  thisbits, thiswidth, thisheight);
  516.  Pixmap mask = XCreateBitmapFromData (display, drawable,
  517.  thismaskbits, thismaskwidth, thismaskheight);
  518.  Cursor cursor = XCreatePixmapCursor (display, source, mask,
  519.  
  520.  
  521.  
  522. Sun Release 3.2 Last change: 28 October 1988 8
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529. BITMAP(1) USER COMMANDS BITMAP(1)
  530.  
  531.  
  532.  
  533.  foreground, background, thisxhot, thisyhot);
  534.  
  535.  
  536.  Additional routines are available for reading in  b i t m a p
  537.  files and returning the data in the file, in Bitmap
  538.  (single-plane Pixmap for use with routines that require
  539.  stipples), or full depth Pixmaps (often used for window
  540.  backgrounds and borders). Applications writers should be
  541.  careful to understand the difference between Bitmaps and
  542.  Pixmaps so that their programs function correctly on color
  543.  and monochrome displays.
  544.  
  545.  For backward compatibility,  b i t m a p will also accept X10 for-
  546.  mat  b i t m a p files. However, when the file is written out
  547.  again it will be in X11 format
  548.  
  549. X DEFAULTS
  550.   B i t m a p uses the following resources:
  551.  
  552.  Background
  553.  The window's background color. Bits which are 0 in the
  554.  bitmap are displayed in this color. This option is use-
  555.  ful only on color displays. The default value is  w h i t e.
  556.  
  557.  BorderColor
  558.  The border color. This option is useful only on color
  559.  displays. The default value is  b l a c k.
  560.  
  561.  BorderWidth
  562.  The border width. The default value is 2.
  563.  
  564.  BodyFont
  565.  The text font. The default value is  v a r i a b l e.
  566.  
  567.  Foreground
  568.  The foreground color. Bits which are 1 in the bitmap
  569.  are displayed in this color. This option is useful only
  570.  on color displays. The default value is  b l a c k.
  571.  
  572.  Highlight
  573.  The highlight color.  b i t m a p uses this color to show the
  574.  hot spot and to indicate rectangular areas that will be
  575.  affected by the  M o v e  A r e a,  C o p y  A r e a,  S e t  A r e a, and
  576.   I n v e r t  A r e a commands. If a highlight color is not
  577.  given, then  b i t m a p will highlight by inverting. This
  578.  option is useful only on color displays.
  579.  
  580.  Mouse
  581.  The pointer (mouse) cursor's color. This option is use-
  582.  ful only on color displays. The default value is  b l a c k.
  583.  
  584.  
  585.  
  586.  
  587.  
  588. Sun Release 3.2 Last change: 28 October 1988 9
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595. BITMAP(1) USER COMMANDS BITMAP(1)
  596.  
  597.  
  598.  
  599.  Geometry
  600.  The size and location of the bitmap window.
  601.  
  602.  Dimensions
  603.  The  W I D T H x H E I G H T to use when creating a new bitmap.
  604.  
  605. SEE ALSO
  606.  X(1),  X l i b -  C  L a n g u a g e  X  I n t e r f a c e (particularly the sec-
  607.  tion on  M a n i p u l a t i n g  B i t m a p s),  X m u R e a d B i t m a p D a t a F r o m F i l e
  608.  
  609. BUGS
  610.  The old command line arguments aren't consistent with other
  611.  X programs.
  612.  
  613.  If you move the pointer too fast while holding a pointer
  614.  button down, some squares may be missed. This is caused by
  615.  limitations in how frequently the X server can sample the
  616.  pointer location.
  617.  
  618.  There is no way to write to a file other than the one speci-
  619.  fied on the command line.
  620.  
  621.  There is no way to change the size of the bitmap once the
  622.  program has started.
  623.  
  624.  There is no  u n d o command.
  625.  
  626. COPYRIGHT
  627.  Copyright 1988, Massachusetts Institute of Technology.
  628.  See  X( 1) for a full statement of rights and permissions.
  629.  
  630. AUTHOR
  631.   b i t m a p by Ron Newman, MIT Project Athena; documentation,
  632.   b m t o a, and  a t o b m by Jim Fulton, MIT X Consortium.
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654. Sun Release 3.2 Last change: 28 October 1988 10
  655.  
  656.  
  657.  
  658.  
  659.