mbColorLib: Improved highlighting of selected combs in HexaColorPicker.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5484 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-12-14 11:06:20 +00:00
parent 524a3881c6
commit 56708190ca
2 changed files with 42 additions and 6 deletions

View File

@ -5,13 +5,18 @@ unit mbUtils;
interface
uses
Classes, SysUtils, Graphics;
Classes, SysUtils, Graphics, LCLIntf;
procedure Clamp(var AValue:Integer; AMin, AMax: Integer);
procedure DrawHorDottedLine(ACanvas: TCanvas; X1, X2, Y: Integer; AColor: TColor);
function PointInCircle(p: TPoint; Size: integer): boolean;
function PtInCircle(p, ctr: TPoint; Radius: Integer): Boolean;
function HighContrastColor(AColor: TColor): TColor;
function HeightOf(R: TRect): Integer;
function WidthOf(R: TRect): Integer;
implementation
procedure Clamp(var AValue: integer; AMin, AMax: integer);
@ -41,6 +46,23 @@ begin
Result := sqr(p.x - ctr.x) + sqr(p.y - ctr.y) <= sqr(Radius);
end;
function HeightOf(R: TRect): Integer;
begin
Result := R.Bottom - R.Top;
end;
function WidthOf(R: TRect): Integer;
begin
Result := R.Right - R.Left;
end;
function HighContrastColor(AColor: TColor): TColor;
begin
if GetRValue(AColor) + GetGValue(AColor) + GetBValue(AColor) > 3*128 then
Result := clBlack
else
Result := clWhite;
end;
end.