mbColorLib: Fix painting issues of mbColorPalette

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5516 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-12-16 14:22:33 +00:00
parent 88b3257b59
commit 8baa12ec3b
6 changed files with 129 additions and 59 deletions

View File

@@ -15,8 +15,12 @@ function PtInCircle(p, ctr: TPoint; Radius: Integer): Boolean;
function HighContrastColor(AColor: TColor): TColor;
function HeightOf(R: TRect): Integer;
function WidthOf(R: TRect): Integer;
function HeightOfRect(R: TRect): Integer;
function WidthOfRect(R: TRect): Integer;
function IsEmptyRect(R: TRect): Boolean;
const
EMPTY_RECT: TRect = (Left: -1; Top: -1; Right: -1; Bottom: -1);
implementation
@@ -53,16 +57,21 @@ begin
Result := sqr(p.x - ctr.x) + sqr(p.y - ctr.y) <= sqr(Radius);
end;
function HeightOf(R: TRect): Integer;
function HeightOfRect(R: TRect): Integer;
begin
Result := R.Bottom - R.Top;
end;
function WidthOf(R: TRect): Integer;
function WidthOfRect(R: TRect): Integer;
begin
Result := R.Right - R.Left;
end;
function IsEmptyRect(R: TRect): Boolean;
begin
Result := (R.Left = -1) and (R.Top = -1) and (R.Right = -1) and (R.Bottom = -1);
end;
function HighContrastColor(AColor: TColor): TColor;
begin
if GetRValue(AColor) + GetGValue(AColor) + GetBValue(AColor) > 3*128 then