mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 18:50:45 +02:00
lcl: add NormalizeRect function
git-svn-id: trunk@18863 -
This commit is contained in:
parent
d45af9b5b8
commit
084ca7e3cd
@ -68,6 +68,9 @@ function ColorAdjustLuma(clrRGB: TColor; n: Integer; fScale: BOOL): TColor;
|
|||||||
function GetHighLightColor(const Color: TColor; Luminance: Integer = 19): TColor;
|
function GetHighLightColor(const Color: TColor; Luminance: Integer = 19): TColor;
|
||||||
function GetShadowColor(const Color: TColor; Luminance: Integer = -50): TColor;
|
function GetShadowColor(const Color: TColor; Luminance: Integer = -50): TColor;
|
||||||
|
|
||||||
|
// misc
|
||||||
|
function NormalizeRect(const R: TRect): TRect;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
//TODO: Check code on endianess
|
//TODO: Check code on endianess
|
||||||
@ -401,6 +404,31 @@ begin
|
|||||||
Result := ColorAdjustLuma(Color, Luminance, False);
|
Result := ColorAdjustLuma(Color, Luminance, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function NormalizeRect(const R: TRect): TRect;
|
||||||
|
begin
|
||||||
|
if R.Left <= R.Right then
|
||||||
|
begin
|
||||||
|
Result.Left := R.Left;
|
||||||
|
Result.Right := R.Right;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Result.Left := R.Right;
|
||||||
|
Result.Right := R.Left;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if R.Top <= R.Bottom then
|
||||||
|
begin
|
||||||
|
Result.Top := R.Top;
|
||||||
|
Result.Bottom := R.Bottom;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Result.Top := R.Bottom;
|
||||||
|
Result.Bottom := R.Top;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure DrawVerticalGradient(Canvas: TCanvas; ARect: TRect; TopColor, BottomColor: TColor);
|
procedure DrawVerticalGradient(Canvas: TCanvas; ARect: TRect; TopColor, BottomColor: TColor);
|
||||||
var
|
var
|
||||||
y, h: Integer;
|
y, h: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user