ImageEn, unit iexColorPalette

SavePaletteToFile


Declaration

procedure SavePaletteToFile(const FileName: TFileName; Palette: TIEArrayOfTRGB; Truncate: Boolean);


Description

Saves a set of colors to file in JASC Palette format (*.pal, *.psppalette).

If Truncate is true, then only the first 256 colors of the palette are output.

Note: The JASC Palette format supports only 256 colors. If Truncate is set to false the created format may be incompatible with other applications.


Example

// Save a set of colors in a database that contains R, G and B columns
var
  aPalette: TIEArrayOfTRGB;
  i: integer;
begin
  i := 0;
  SetLength( aPalette, tblColorList.RecordCount );
  tblColorList.First;
  While not tblColorList.EOF do
  begin
    aPalette[ i ].R := tblColorListRed.AsInteger;
    aPalette[ i ].G := tblColorListGreen.AsInteger;
    aPalette[ i ].B := tblColorListBlue.AsInteger;
    inc( i );
    tblColorList.Next;
  end;
  SavePaletteToFile( 'D:\ColorSet.pal', aPalette, False );
end;


See Also

LoadPaletteFromFile
SaveToFile