mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 21:00:43 +02:00
LCL, Graphics.pp: added IncColor() counterpart to the existing DecColor() function, patch by Don Siders, issue #40682
This commit is contained in:
parent
4da22ba599
commit
c9a4f79b92
@ -1925,6 +1925,7 @@ function StringToColorDef(const S: shortstring; const DefaultValue: TColor): TCo
|
|||||||
procedure GetColorValues(Proc: TGetColorStringProc);
|
procedure GetColorValues(Proc: TGetColorStringProc);
|
||||||
function InvertColor(AColor: TColor): TColor;
|
function InvertColor(AColor: TColor): TColor;
|
||||||
function DecColor(AColor: TColor; AQuantity: Byte): TColor;
|
function DecColor(AColor: TColor; AQuantity: Byte): TColor;
|
||||||
|
function IncColor(AColor: TColor; AQuantity: Byte): TColor;
|
||||||
function IsSysColor(AColor: TColorRef): Boolean;
|
function IsSysColor(AColor: TColorRef): Boolean;
|
||||||
|
|
||||||
function Blue(rgb: TColorRef): BYTE; // does not work on system color
|
function Blue(rgb: TColorRef): BYTE; // does not work on system color
|
||||||
@ -2711,6 +2712,18 @@ begin
|
|||||||
Result := RGBToColor(R, G, B);
|
Result := RGBToColor(R, G, B);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Increases the component RGB values in a color by the specified amount
|
||||||
|
function IncColor(AColor: TColor; AQuantity: Byte): TColor;
|
||||||
|
var
|
||||||
|
R, G, B : Byte;
|
||||||
|
begin
|
||||||
|
RedGreenBlue(ColorToRGB(AColor), R, G, B);
|
||||||
|
R := Min(255, Integer(R) + AQuantity);
|
||||||
|
G := Min(255, Integer(G) + AQuantity);
|
||||||
|
B := Min(255, Integer(B) + AQuantity);
|
||||||
|
Result := RGBToColor(R, G, B);
|
||||||
|
end;
|
||||||
|
|
||||||
function IsSysColor(AColor: TColorRef): Boolean;
|
function IsSysColor(AColor: TColorRef): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (AColor and SYS_COLOR_BASE) <> 0;
|
Result := (AColor and SYS_COLOR_BASE) <> 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user