home *** CD-ROM | disk | FTP | other *** search
- The portable bitmap format is a lowest common denominator.
-
- Formats currently supported are:
-
- X11 and X10 bitmaps
- X11 window dump files
- Sun icons
- Sun raster files.
- Macintosh MacPaint files
- PostScript
- Printronix printer graphics
- "portable bitmap format"
- "compact bitmap format"
-
-
- The portable bitmap format is something I came up with while I was
- at Xerox. It is a lowest common denominator. It was originally
- designed to make it reasonable to mail bitmaps between different
- types of machines using the typical stupid network mailers we have
- today. Now it serves as the common language for this family of
- bitmap conversion filters. The definition is as follows:
-
- - A width, formatted as ASCII characters in decimal.
-
- - Whitespace (blanks, TABs, CRs, LFs).
-
- - A height, again in ASCII decimal.
-
- - Whitespace.
-
- - Width * height bits, each either '1' or '0', starting at the top-left
- corner of the bitmap, proceding in normal English reading order.
-
- - The character '1' means black, '0' means white.
-
- - Whitespace in the bits section is ignored.
-
- - Characters from a "#" to the next end-of-line are ignored (comments).
-
- - No line may be longer than 70 characters.
-
- Here is an example of a small bitmap in this format:
-
- # feep.pbm
- 24 7
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0
- 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
- 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
- 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
- 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-
- Programs that read this format should be as lenient as possible,
- accepting anything that looks remotely like a bitmap. For instance,
- the above example does not actually conform to the standard, since
- it has whitespace before the width; neverthless, it should be accepted.
-
-
- The compact bitmap format is the same basic idea as the portable
- format, but it assumes the underlying filesystem can reliably store
- 8-bit bytes. If you have the compress and zcat programs, you should
- not bother with compact bitmaps -- all formats are about the same size
- after being compressed. Otherwise, compact bitmaps are probably the
- most space-efficient format. The definition:
-
- - Two bytes of "magic number", which are always 0x2A 0x17.
-
- - Two bytes representing the width. The bytes are in "big-endian"
- order, i.e. the formula for the width is firstbyte * 256 + secondbyte.
-
- - Two bytes representing the height, same order as above.
-
- - The bits, in the same order as in the portable format: starting
- at the top-left, proceeding in normal English reading order.
- Within each byte, the most significant bit is used first, and so
- on down to the least significant bit.
-
- - Nothing special happens at the end of a row -- no padding, not even
- to the end of the current byte.
-
- - A 1 bit means black, a 0 bit means white;
-
- - All eight bits of each byte are used, except of course for the
- last byte, where there may be some extra bits. These are ignored.
-