| ImageEn, unit iexColorPalette |
|
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
IEColorToRGB and
IERGBToColor to convert between
TColor and
TRGB values
◼You can output the palette as an image using
IEDrawColorPalette, or show the palette to the user using
IEPromptForColor
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.SaveToFile( 'D:\palette.png' );
bmp.Free();
See Also
◼Colors
◼ColorCount
◼AssignPalette
◼IEColorToRGB
◼IERGBToColor
◼IEDrawColorPalette