Unit 'agraphics' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#os4units]

TColorMap

This structure is the primary storage for palette data.

Declaration

Source position: agraphics.pas line 1311

type TColorMap = record

  Flags: Byte;

  

Colormap flags (COLORMAP_*)

  Type_: Byte;

  

Colormap type, reflects version (COLORMAP_TYPE_)

  Count: Word;

  

Number of palette entries

  ColorTable: Pointer;

  

Table of high nibbles of color values (see description above)

  cm_vpe: PViewPortExtra;

  

ViewPortExtra, for faster access

  LowColorBits: Pointer;

  

Table of low nibbles of color values

  TransparencyPlane: Byte;

  

  SpriteResolution: Byte;

  

  SpriteResDefault: Byte;

  

  AuxFlags: Byte;

  

Additional flags (CMAF_*)

  cm_vp: PViewPort;

  

Points back to a ViewPort this colormap belongs to

  NormalDisplayInfo: Pointer;

  

  CoerceDisplayInfo: Pointer;

  

  cm_batch_items: PTagItem;

  

  VPModeID: LongWord;

  

  PalExtra: Pointer;

  

Structure controlling palette sharing

  SpriteBase_Even: Word;

  

Color bank for even sprites

  SpriteBase_Odd: Word;

  

The same for odd sprites

  Bp_0_base: Word;

  

  Bp_1_base: Word;

  

end;

Description

Color data itself is stored in two tables: ColorTable and LowColorBits. These fields are actually pointer to arrays of Words. Each Word corresponds to one color. Number of Words in these array is equal to Count value in this structure. ColorTable stores upper nibbles of RGB values, LowColorBits stores low nibbles.

Example:

color number 4, value: $00ABCDEF
   ColorTable[4] := $0ACE,
   LowColorBits[4] := $0BDF
 

SpriteBase fields keep bank number, not a color number. On m68k Amiga colors are divided into banks, 16 per each. So bank number is color number divided by 16. Base color is a number which is added to all colors of the sprite in order to look up the actual palette entry. Amiga may run on different hardware where sprites may have base colors that do not divide by 16. In order to cover this bank numbers have a form: ((c and $0F) shl 8 ) or (c shr 4), where c is actual color number (i. e. remainder is stored in a high byte of Word).


Documentation generated on: 2021-07-30