Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- MOD File Format - <b>global colour map</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Global Colour Map

 The Global colour Map is optional but recommended for  images  where
 accurate colour rendition is desired.  The existence of this colour map is
 indicated in the 'M' field of byte 5 of the Screen Descriptor.  A  colour
 map  can  also  be associated with each image in a GIF file as described
 later.  However this  global  map  will  normally  be  used  because  of
 hardware  restrictions  in equipment available today.  In the individual
 Image Descriptors the 'M' flag will normally be  zero.   If  the  Global
 colour  Map  is  present,  it's definition immediately follows the Screen
 Descriptor.   The  number  of  colour  map  entries  following  a  Screen
 Descriptor  is equal to 2**(# bits per pixel), where each entry consists
 of three byte values representing the relative intensities of red, green
 and blue respectively.  The structure of the colour Map block is:

              bits
         7 6 5 4 3 2 1 0  Byte #
        +---------------+
        | red intensity |  1    Red value for colour index 0
        |---------------|
        |green intensity|  2    Green value for colour index 0
        |---------------|
        | blue intensity|  3    Blue value for colour index 0
        |---------------|
        | red intensity |  4    Red value for colour index 1
        |---------------|
        |green intensity|  5    Green value for colour index 1
        |---------------|
        | blue intensity|  6    Blue value for colour index 1
        |---------------|
        |               |       (Continues for remaining colours)

 Each image pixel value received will be displayed according to  its
 closest match with an available colour of the display based on this colour
 map.  The colour components represent a fractional intensity  value  from
 none  (0)  to  full (255).  White would be represented as (255,255,255),
 black as (0,0,0) and medium yellow as (180,180,0).  For display, if  the
 device  supports fewer than 8 bits per colour component, the higher order
 bits of each component are used.  In the creation of  a  GIF  colour  map
 entry  with  hardware  supporting  fewer  than 8 bits per component, the
 component values for the hardware  should  be  converted  to  the  8-bit
 format with the following calculation:

   <map_value> = <component_value>*255/(2**<nbits> -1)

 This assures accurate translation of colours for all  displays.   In the
 cases  of  creating  GIF images from hardware without colour palette
 capability, a fixed palette should be created  based  on  the  available
 display  colours for that hardware.  If no Global colour Map is indicated, a
 default colour map is generated internally  which  maps  each  possible
 incoming  colour  index to the same hardware colour index modulo <n> where
 <n> is the number of available hardware colours.

See Also: Local Colour Map

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson