![]() |
![]() |
![]() |
| 4.51.2.4.45. ogRGBA() | Table of Contents | 4.51.2.4.47. ogScale() |
function ogSavePal(const palFile:string):boolean;Remarks:
Saves a palette to palFile. A palette is an array of 256 RGBA byte values. For each RGB value 0 is minimum, and 255 is maximum. The A (alpha) field is used for alignment. Returns TRUE if the save was successful. Returns FALSE if the file could not be created or written to.
Restrictions:Only relevant in 8BPP surfaces. The palette is unused for high and true colour surfaces.
See also:
{ogSavePal.pas}
uses
ObjGfx40;
var
buf1, buf2:^ogSurface;
begin
new(buf1, ogInit);
new(buf2, ogInit);
{Create an 8bpp surface}
if not buf1^.ogCreate(200, 200, OG_PIXFMT_8BPP) then
begin
writeln('Error creating buf1');
halt
end;
{Create another 8bpp surface}
if not Buf2^.ogCreate(400, 400, OG_PIXFMT_8BPP) then
begin
writeln('Error creating buf2');
halt
end;
{Save the palette in buf1 to disk.}
buf1^.ogSavePal('default.pal');
{Load the palette we just saved into buf2. This can also be
done directly with dest.ogCopyPal(source);}
if not buf2^.ogLoadPal('default.pal') then
writeln('Error loading palette');
dispose(buf2, ogDone);
dispose(buf1, ogDone);
end.
![]() |
![]() |
![]() |
| 4.51.2.4.45. ogRGBA() | Table of Contents | 4.51.2.4.47. ogScale() |