Unit PalUnit

///////////////////////////////////////////////////////////////////////////// // Palette management routines // ŠJohn Biddiscombe // j.biddiscombe@rl.ac.uk // // /////////////////////////////////////////////////////////////////////////////

Classes

pal_animator -

Functions

create_256_identity_palette_from_file -
create_256_pens_using_paletteindex - Create pens from palette.
create_default_236_greyscale_palette -
default_log_palette -
DirectoryExists - fills a TStringlist with palettes - useful for listboxes
dispose_256_pens -
find_all_palettes -
LogPal_to_RGBQuad -
Set_Palette_Directory -

Types

palentries
palindices
pen_array
pMyBitmapInfo
Ppalentries
pPens
RGBdouble
RGBQuads
RGBvalues
TMyBitmapInfo
TMyLogPalette

Constants

Variables

Palette_Dir


Functions


function create_256_identity_palette_from_file(var pal:TMyLogPalette;var Hpal:integer; filename:shortstring) : boolean;


procedure create_256_pens_using_paletteindex(var pens:pen_array; style:integer);

Create pens from palette. Because we use PaletteIndex to create the pens, we can still use them after the palette changes

procedure create_default_236_greyscale_palette(var pal:TMyLogPalette; var Hpal:integer);


procedure default_log_palette(var pal:TMyLogPalette);


function DirectoryExists(dir:string) : boolean;

fills a TStringlist with palettes - useful for listboxes

procedure dispose_256_pens(pens:pen_array);


procedure find_all_palettes(destlist:TStringList);


procedure LogPal_to_RGBQuad(f,n:word; var logpal:palentries; var RGBQuad:RGBQuads);


function Set_Palette_Directory(dir:string) : boolean;


Types


palentries   = array[0..255] of TPaletteEntry;
Mine
palindices   = array[0..255] of word;

pen_array = array[0..255] of integer;
C++Builder screws up typedefs - so use int instead of HPen,HPalette
pMyBitmapInfo  = ^TMyBitmapInfo

Ppalentries  = ^palentries

pPens     = ^pen_array

RGBdouble = record
r : double;
g : double;
b : double;
end;
A rather odd object used for nicccce.....palette walking in Zonerings
RGBQuads     = array[0..255] of TRGBQUAD;

RGBvalues = record
r : integer;
g : integer;
b : integer;
end;

TMyBitmapInfo = record
BMIheader : TBITMAPINFOHEADER;
BMIcolors : palindices;
end;

TMyLogPalette = record
palVersion : Word;
palNumEntries : Word;
palEntry : palentries;
pal_mycolours : integer;
end;

Constants


Variables

Palette_Dir : string

the global variables here are useful.