You've already forked lazarus-ccr
mbColorLib: Delphi support removed. Change version number to 2.1 (standard even/odd numbering scheme).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5549 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -7,11 +7,7 @@ unit KColorPicker;
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLIntf, LCLType, LMessages,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
LCLIntf, LCLType,
|
||||
SysUtils, Classes, Controls, Graphics, Forms,
|
||||
RGBCMYKUtils, mbTrackBarPicker, HTMLColors;
|
||||
|
||||
@@ -22,9 +18,9 @@ type
|
||||
function ArrowPosFromBlack(k: integer): integer;
|
||||
function BlackFromArrowPos(p: integer): integer;
|
||||
function GetSelectedColor: TColor;
|
||||
procedure SetSelectedColor(c: TColor);
|
||||
procedure SetCyan(c: integer);
|
||||
procedure SetMagenta(m: integer);
|
||||
procedure SetSelectedColor(c: TColor);
|
||||
procedure SetYellow(y: integer);
|
||||
procedure SetBlack(k: integer);
|
||||
protected
|
||||
@@ -68,63 +64,6 @@ begin
|
||||
FChange := true;
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetGradientColor(AValue: Integer): TColor;
|
||||
begin
|
||||
Result := CMYKtoColor(FCyan, FMagenta, FYellow, AValue);
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetBlack(k: integer);
|
||||
begin
|
||||
Clamp(k, 0, 255);
|
||||
if FBlack <> k then
|
||||
begin
|
||||
FBlack := k;
|
||||
FArrowPos := ArrowPosFromBlack(k);
|
||||
FManual := false;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetMagenta(m: integer);
|
||||
begin
|
||||
Clamp(m, 0, 255);
|
||||
if FMagenta <> m then
|
||||
begin
|
||||
FMagenta := m;
|
||||
FManual := false;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetYellow(y: integer);
|
||||
begin
|
||||
Clamp(y, 0, 255);
|
||||
if FYellow <> y then
|
||||
begin
|
||||
FYellow := y;
|
||||
FManual := false;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetCyan(c: integer);
|
||||
begin
|
||||
Clamp(c, 0, 255);
|
||||
if FCyan <> c then
|
||||
begin
|
||||
FCyan := c;
|
||||
FManual := false;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TKColorPicker.ArrowPosFromBlack(k: integer): integer;
|
||||
var
|
||||
a: integer;
|
||||
@@ -156,39 +95,6 @@ begin
|
||||
Result := k;
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetSelectedColor: TColor;
|
||||
begin
|
||||
Result := CMYKtoColor(FCyan, FMagenta, FYellow, FBlack);
|
||||
if WebSafe then
|
||||
Result := GetWebSafe(Result);
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetSelectedValue: integer;
|
||||
begin
|
||||
Result := FBlack;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetSelectedColor(c: TColor);
|
||||
var
|
||||
cy, m, y, k: integer;
|
||||
begin
|
||||
if WebSafe then c := GetWebSafe(c);
|
||||
ColorToCMYK(c, cy, m, y, k);
|
||||
FChange := false;
|
||||
SetMagenta(m);
|
||||
SetYellow(y);
|
||||
SetCyan(cy);
|
||||
SetBlack(k);
|
||||
FManual := false;
|
||||
FChange := true;
|
||||
if Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetArrowPos: integer;
|
||||
begin
|
||||
Result := ArrowPosFromBlack(FBlack);
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.Execute(tbaAction: integer);
|
||||
begin
|
||||
case tbaAction of
|
||||
@@ -225,4 +131,94 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetArrowPos: integer;
|
||||
begin
|
||||
Result := ArrowPosFromBlack(FBlack);
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetGradientColor(AValue: Integer): TColor;
|
||||
begin
|
||||
Result := CMYKtoColor(FCyan, FMagenta, FYellow, AValue);
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetSelectedColor: TColor;
|
||||
begin
|
||||
Result := CMYKtoColor(FCyan, FMagenta, FYellow, FBlack);
|
||||
if WebSafe then
|
||||
Result := GetWebSafe(Result);
|
||||
end;
|
||||
|
||||
function TKColorPicker.GetSelectedValue: integer;
|
||||
begin
|
||||
Result := FBlack;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetBlack(k: integer);
|
||||
begin
|
||||
Clamp(k, 0, 255);
|
||||
if FBlack <> k then
|
||||
begin
|
||||
FBlack := k;
|
||||
FArrowPos := ArrowPosFromBlack(k);
|
||||
FManual := false;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetCyan(c: integer);
|
||||
begin
|
||||
Clamp(c, 0, 255);
|
||||
if FCyan <> c then
|
||||
begin
|
||||
FCyan := c;
|
||||
FManual := false;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetMagenta(m: integer);
|
||||
begin
|
||||
Clamp(m, 0, 255);
|
||||
if FMagenta <> m then
|
||||
begin
|
||||
FMagenta := m;
|
||||
FManual := false;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetSelectedColor(c: TColor);
|
||||
var
|
||||
cy, m, y, k: integer;
|
||||
begin
|
||||
if WebSafe then c := GetWebSafe(c);
|
||||
ColorToCMYK(c, cy, m, y, k);
|
||||
FChange := false;
|
||||
SetMagenta(m);
|
||||
SetYellow(y);
|
||||
SetCyan(cy);
|
||||
SetBlack(k);
|
||||
FManual := false;
|
||||
FChange := true;
|
||||
if Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TKColorPicker.SetYellow(y: integer);
|
||||
begin
|
||||
Clamp(y, 0, 255);
|
||||
if FYellow <> y then
|
||||
begin
|
||||
FYellow := y;
|
||||
FManual := false;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user