MACPAINT.TXT


Remove Frame

MacPaint description excerpted from:


                           ST Picture Formats
                           ------------------
                               Edited by:

                              David Baggett

                                Internet:
                             [email protected]

                   (Please report errors or additions.)

            Copyright (C) 1988 -- 1995  by David M. Baggett


    Non-profit redistribution of this document is permitted, provided
    the document is not modified in any way.

    Reproduction of this document in whole or in part for  commercial
    purposes is expressly forbidden without the prior written consent
    of David M. Baggett.

    The  information  presented here is not guaranteed to be correct.
    The editor and contributors will in no event be liable for direct,
    indirect, incidental, or consequential damages resulting from the 
    use of the information in this document.

    This document is the product of many hours of volunteer work by a
    large number of people. Please respect this -- do not violate the
    distribution policy.


                               CONTRIBUTORS
  
      Steve Belczyk  Phil Blanchfield  Marcel Boom  Jason Blochowiak
        John Brochu**  David Brooks  Daniel Deimert  Martyn Dryden
      Neil Forsyth  Stefan Hoehn  Gerfried Klein  G. "Maddog" Knauss
           Ken MacLeod  Shamus McBride  Jim McCabe  Lars Michael
           Darek Mihocka  David Mumper  George Nassas  Jim Omura
             Chris Ridd  George Seto   Joe Smith  Greg Wageman
                       Roland Waldi*  Gerry Wheeler



                        Introductory Information
                        ------------------------
word    = 2 bytes
long    = 4 bytes
palette = Hardware color palette, stored as 16 words.  First word is
          color register zero (background), last word is color register
          15.  Each word has the form:

          Bit:  (MSB) 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (LSB)
                      -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
                       0  0  0  0  0 R2 R1 R0  0 G2 G1 G0  0 B2 B1 B0

          R2 = MSB of red intensity
          R0 = LSB of red intensity

          G2 = MSB of green intensity
          G0 = LSB of green intensity

          B2 = MSB of blue intensity
          B0 = LSB of blue intensity

          Intensity ranges from 0 (color not present) to 7 (highest
          intensity).

          Example: { red = 7, green = 3, blue = 5 } -> 0735 (hex)

          Caveat:  It is wise to mask off the upper four bits of each
                   palette entry, since a few programs store special
                   information there (e.g., Art Studio).


 

<MacPaint>      *.MAC
 
1 long          version number [0=ignore header, 2=header valid]
38 * 8 bytes    8x8 brush/fill patterns.  Each byte is a pattern row,
                and the bytes map the pattern rows top to bottom.  The
                patterns are stored in the order they appear at the bottom
                of the MacPaint screen top to bottom, left to right.
204 bytes       unused
-------------
512 bytes       total for header

< 51200 bytes   compressed bitmap data
-------------
< 51712 bytes   total
 
NOTE:  The version number is actually a flag to MacPaint to indicate if
the brush/fill patterns are present in the file.  If the version is 0,
the default patterns are used.  Therefore you can simply save a MacPaint
file by writing a blank header (512 $00 bytes), followed by the packed
image data.

Bitmap compression:
 
   The bitmap data is for a 576 pixel by 720 pixel monochrome image.
The packing method is PackBits (see below).  There are 72 bytes per
scan line.  Each bit represents one pixel; 0 = white, 1 = black.
 



<PackBits Compression Algorithm>

The following packing algorithm originated on the Mac, was adopted by
Electronic Arts/Commodore for use in the IFF standard, and then by Tom
Hudson for use in DEGAS Elite.  The algorithm is currently used in
MacPaint, IFF, and DEGAS Elite compressed file formats.  Each scan line
is packed separately, and packing never extends beyond a scan line.

For a given control byte 'n':
    0 <= n <= 127   : use the next n + 1 bytes literally (no repetition).
 -127 <= n <= -1    : use the next byte -n + 1 times.
         n = -128   : no operation, not used.

-------------------------------------------------------------------------

* Roland Waldi contributed extensive information on the following formats:

        GEM, IMG, Doodle, STAD, Imagic Film/Picture, Art Director, IFF

** John Brochu, ST picture formats guru, provided sage advice and many
   corrections to the following formats:

        NeoChrome, DEGAS Elite Compressed, Spectrum 512 Compressed,
        GEM Bit Image, IFF, MacPaint

Version of...........Sun Oct 30 12:40:13 EST 1994
(Last change: Extended GEM .IMG format updated)