I'm using the folowing code to extract the bmicolors section from a bmp
file, and hold in an array [0..255] of RGBquad called coltab
TYPE RGBQUAD = RECORD
rgbBlue,
rgbGreen,
rgbRed,
rgbReserved:BYTE;
END;
COLOURTABLE = ARRAY [0..255] OF RGBQUAD;
VAR f:FILE;
rgbrec:RGBQUAD;
coltab:COLOURTABLE;
BEGIN(* of load_bmp *)
assign(f, path);
reset(f, 1);
blockread(f, bmh, 14); { read the bitmapfileheader into bmh }
blockread(f, bmih, 40); { read the bitmapinfoheader into bmih }
CASE bmih.biBitCount OF
1 :colours:=8; { Check the biBitCount record}
4 :colours:=64; { from bmih to see how many }
8 :colours:=1024;{ colour records to read from }
24 :colours:=0; { the colour table. }
END;
blockread(f, coltab, colours);
{ This bit reads the bmicolors section of the file into coltab, which
should be in the same format. I would expect coltab to hold an exact
replica of bmicolors after this, but when I enter it into the palette
and draw stuff with it, it becomes apparant that the colours are all out
of order.}
If anybody knows anything about BMPs, or has written a unit or some code
which loads the palette up properly, I'd really appreciate it if they
would drop me a line or post here, cheers, ... I've been having nothing
but problems lately... Well, it's probably character building or
something...
Alex Noble.........................................a...@elbon.demon.co.uk
Coming soon : www.fatcitynews.com