mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-29 08:10:56 +01:00
made palette extendable
This commit is contained in:
parent
1e47d6ffe0
commit
9c875f9926
@ -226,3 +226,14 @@ begin
|
||||
result.data := ConvertColorToData (From, Fmt);
|
||||
end;
|
||||
|
||||
function CompareColors(const Color1, Color2: TFPColor): integer;
|
||||
begin
|
||||
Result:=integer(Color1.Red)-integer(Color2.Red);
|
||||
if Result<>0 then exit;
|
||||
Result:=integer(Color1.Green)-integer(Color2.Green);
|
||||
if Result<>0 then exit;
|
||||
Result:=integer(Color1.Blue)-integer(Color2.Blue);
|
||||
if Result<>0 then exit;
|
||||
Result:=integer(Color1.Alpha)-integer(Color2.Alpha);
|
||||
end;
|
||||
|
||||
|
||||
@ -52,22 +52,22 @@ type
|
||||
TProgressEvent = TFPImgProgressEvent;
|
||||
|
||||
TFPPalette = class
|
||||
private
|
||||
protected
|
||||
FData : PFPColorArray;
|
||||
FCount, FCapacity : integer;
|
||||
procedure SetCount (Value:integer);
|
||||
procedure SetCount (Value:integer); virtual;
|
||||
function GetCount : integer;
|
||||
procedure SetColor (index:integer; const Value:TFPColor);
|
||||
procedure SetColor (index:integer; const Value:TFPColor); virtual;
|
||||
function GetColor (index:integer) : TFPColor;
|
||||
procedure CheckIndex (index:integer);
|
||||
procedure EnlargeData;
|
||||
procedure CheckIndex (index:integer); virtual;
|
||||
procedure EnlargeData; virtual;
|
||||
public
|
||||
constructor create (ACount : integer);
|
||||
destructor destroy; override;
|
||||
procedure Build (Img : TFPCustomImage);
|
||||
procedure Merge (pal : TFPPalette);
|
||||
function IndexOf (const AColor: TFPColor) : integer;
|
||||
function Add (const Value: TFPColor) : integer;
|
||||
constructor Create (ACount : integer);
|
||||
destructor Destroy; override;
|
||||
procedure Build (Img : TFPCustomImage); virtual;
|
||||
procedure Merge (pal : TFPPalette); virtual;
|
||||
function IndexOf (const AColor: TFPColor) : integer; virtual;
|
||||
function Add (const Value: TFPColor) : integer; virtual;
|
||||
property Color [Index : integer] : TFPColor read GetColor write SetColor; default;
|
||||
property Count : integer read GetCount write SetCount;
|
||||
end;
|
||||
@ -238,9 +238,10 @@ function ConvertColor (const From : TFPColor; Fmt : TColorFormat) : TDeviceColor
|
||||
function ConvertColor (const From : TDeviceColor; Fmt : TColorFormat) : TDeviceColor;
|
||||
|
||||
operator = (const c,d:TFPColor) : boolean;
|
||||
operator or (const c,d:TFPColor) : TFPColor;
|
||||
operator or (const c,d:TFPColor) : TFPColor;
|
||||
operator and (const c,d:TFPColor) : TFPColor;
|
||||
operator xor (const c,d:TFPColor) : TFPColor;
|
||||
function CompareColors(const Color1, Color2: TFPColor): integer;
|
||||
|
||||
var ImageHandlers : TImageHandlersManager;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user