ImageEn, unit iexColorPalette

TIEColorPalette.Palette

TIEColorPalette.Palette


Declaration

property Palette: TIEArrayOfTRGB;


Description

TIEColorPalette provides two ways to access the color palette:
 As an array of TRGB
 As a stringlist of TColor or RGB values (via Colors)

Note: You can use TColor2TRGB and TRGB2TColor to convert between TColor and TRGB values


Examples

// Assign all colors in the component to a database with R, G and B columns
for i := 0 to IEColorPalette1.ColorCount - 1 do
begin
  tblColorList.Append;
  tblColorListRed.AsInteger   := IEColorPalette1.Palette[ i ].R;
  tblColorListGreen.AsInteger := IEColorPalette1.Palette[ i ].G;
  tblColorListBlue.AsInteger  := IEColorPalette1.Palette[ i ].B;
  tblColorList.Post;
end;

// Assign a palette from 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;
  IEColorPalette1.Palette := aPalette;
end;

// Export palette to an image file
bmp := TIEBitmap.Create;
IEDrawColorPalette( bmp, ColorPalette1.Palette, 30, 30, 16 );
bmp.Write( 'D:\palette.png' );
bmp.Free;




See Also

 Colors
 ColorCount
 AssignPalette
 TColor2TRGB
 TRGB2TColor
 IEDrawColorPalette