![]() |
![]() |
![]() |
| 4.51.2.4.40. ogLine() | Table of Contents | 4.51.2.4.42. ogPolygon() |
function ogLoadPal(const palfile:string):boolean; virtual;Remarks:
Loads a palette contained in 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 load was successful. Returns FALSE if the file doesn't exist or the palette couldn't be completely read in. In the event there is an error loading the palette, the original palette will be restored.
Restrictions:Only relevant in 8BPP surfaces. The palette is unused for high and true colour buffers. Will allocate a new palette if none exists.
See also:
{ogLoadPal.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.40. ogLine() | Table of Contents | 4.51.2.4.42. ogPolygon() |