You've already forked lazarus-ccr
mbColorLib: Remove LColorPicker and VColorPicker from lib (are replaced by LVColorPicker). Remove two forgotten Delphi dfm files.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5597 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,265 +0,0 @@
|
||||
unit LColorPicker;
|
||||
|
||||
interface
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE DELPHI}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
LCLIntf, LCLType, SysUtils, Classes, Controls, Graphics, Forms,
|
||||
HTMLColors, {RGBHSLUtils, }mbTrackBarPicker;
|
||||
|
||||
type
|
||||
TLColorPicker = class(TmbTrackBarPicker)
|
||||
private
|
||||
FHue, FSat, FLuminance: Double;
|
||||
FMaxHue, FMaxSat, FMaxLum: Integer;
|
||||
function ArrowPosFromLum(L: integer): integer;
|
||||
function GetHue: Integer;
|
||||
function GetLuminance: Integer;
|
||||
function GetSat: Integer;
|
||||
function LumFromArrowPos(p: integer): integer;
|
||||
procedure SetHue(H: integer);
|
||||
procedure SetLuminance(L: integer);
|
||||
procedure SetMaxHue(H: Integer);
|
||||
procedure SetMaxLum(L: Integer);
|
||||
procedure SetMaxSat(S: Integer);
|
||||
procedure SetSat(S: integer);
|
||||
protected
|
||||
procedure Execute(tbaAction: integer); override;
|
||||
function GetArrowPos: integer; override;
|
||||
function GetGradientColor(AValue: Integer): TColor; override;
|
||||
function GetSelectedColor: TColor; override;
|
||||
function GetSelectedValue: integer; override;
|
||||
procedure SetSelectedColor(c: TColor); override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
published
|
||||
property Hue: integer read GetHue write SetHue;
|
||||
property Saturation: integer read GetSat write SetSat;
|
||||
property Luminance: integer read GetLuminance write SetLuminance;
|
||||
property MaxHue: Integer read FMaxHue write SetmaxHue default 360;
|
||||
property MaxSaturation: Integer read FMaxSat write SetMaxSat default 255;
|
||||
property MaxLuminance: Integer read FMaxLum write SetMaxLum default 255;
|
||||
property SelectedColor default clRed;
|
||||
property HintFormat;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
mbUtils, mbColorConv;
|
||||
|
||||
{TLColorPicker}
|
||||
|
||||
constructor TLColorPicker.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FMaxHue := 360;
|
||||
FMaxSat := 255;
|
||||
FMaxLum := 255;
|
||||
FGradientWidth := FMaxLum + 1;
|
||||
FGradientHeight := 1;
|
||||
FHue := 0;
|
||||
FSat := FMaxSat;
|
||||
SetLuminance(FMaxLum div 2);
|
||||
HintFormat := 'Luminance: %value (selected)';
|
||||
end;
|
||||
|
||||
function TLColorPicker.ArrowPosFromLum(L: integer): integer;
|
||||
var
|
||||
a: integer;
|
||||
begin
|
||||
if Layout = lyHorizontal then
|
||||
begin
|
||||
a := Round((Width - 12) * L / FMaxLum);
|
||||
if a > Width - FLimit then a := Width - FLimit;
|
||||
end
|
||||
else
|
||||
begin
|
||||
a := Round((Height - 12) * (FMaxLum - L) / FMaxLum);
|
||||
if a > Height - FLimit then a := Height - FLimit;
|
||||
end;
|
||||
if a < 0 then a := 0;
|
||||
Result := a;
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.Execute(tbaAction: integer);
|
||||
begin
|
||||
case tbaAction of
|
||||
TBA_Resize:
|
||||
SetLuminance(GetLuminance());
|
||||
TBA_MouseMove:
|
||||
SetLuminance(LumFromArrowPos(FArrowPos));
|
||||
TBA_MouseDown:
|
||||
SetLuminance(LumFromArrowPos(FArrowPos));
|
||||
TBA_MouseUp:
|
||||
SetLuminance(LumFromArrowPos(FArrowPos));
|
||||
TBA_WheelUp:
|
||||
SetLuminance(GetLuminance() + Increment);
|
||||
TBA_WheelDown:
|
||||
SetLuminance(GetLuminance() - Increment);
|
||||
TBA_VKRight:
|
||||
SetLuminance(GetLuminance() + Increment);
|
||||
TBA_VKCtrlRight:
|
||||
SetLuminance(FMaxLum);
|
||||
TBA_VKLeft:
|
||||
SetLuminance(GetLuminance() - Increment);
|
||||
TBA_VKCtrlLeft:
|
||||
SetLuminance(0);
|
||||
TBA_VKUp:
|
||||
SetLuminance(GetLuminance() + Increment);
|
||||
TBA_VKCtrlUp:
|
||||
SetLuminance(FMaxLum);
|
||||
TBA_VKDown:
|
||||
SetLuminance(GetLuminance() - Increment);
|
||||
TBA_VKCtrlDown:
|
||||
SetLuminance(0);
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLColorPicker.GetArrowPos: integer;
|
||||
begin
|
||||
if FMaxLum = 0 then
|
||||
Result := inherited GetArrowPos
|
||||
else
|
||||
Result := ArrowPosFromLum(GetLuminance());
|
||||
end;
|
||||
|
||||
function TLColorPicker.GetGradientColor(AValue: Integer): TColor;
|
||||
begin
|
||||
Result := HSLToColor(FHue, FSat, AValue/FMaxLum);
|
||||
end;
|
||||
|
||||
function TLColorPicker.GetHue: Integer;
|
||||
begin
|
||||
Result := Round(FHue * FMaxHue);
|
||||
end;
|
||||
|
||||
function TLColorPicker.GetLuminance: Integer;
|
||||
begin
|
||||
Result := Round(FLuminance * FMaxLum);
|
||||
end;
|
||||
|
||||
function TLColorPicker.GetSat: Integer;
|
||||
begin
|
||||
Result := Round(FSat * FMaxSat);
|
||||
end;
|
||||
|
||||
function TLColorPicker.GetSelectedColor: TColor;
|
||||
begin
|
||||
Result := HSLToColor(FHue, FSat, FLuminance);
|
||||
if WebSafe then
|
||||
Result := GetWebSafe(Result);
|
||||
end;
|
||||
|
||||
function TLColorPicker.GetSelectedValue: integer;
|
||||
begin
|
||||
Result := GetLuminance();
|
||||
end;
|
||||
|
||||
function TLColorPicker.LumFromArrowPos(p: integer): integer;
|
||||
var
|
||||
L: integer;
|
||||
begin
|
||||
case Layout of
|
||||
lyHorizontal : L := Round( p / (Width - 12) * FMaxLum);
|
||||
lyVertical : L := Round((1.0 - p /(Height - 12)) * FMaxLum);
|
||||
end;
|
||||
Clamp(L, 0, FMaxLum);
|
||||
Result := L;
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.SetHue(H: integer);
|
||||
begin
|
||||
Clamp(H, 0, FMaxHue);
|
||||
if GetHue() <> H then
|
||||
begin
|
||||
FHue := H / FMaxHue;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.SetLuminance(L: integer);
|
||||
begin
|
||||
Clamp(L, 0, FMaxLum);
|
||||
if GetLuminance() <> L then
|
||||
begin
|
||||
FLuminance := L / FMaxLum;
|
||||
FArrowPos := ArrowPosFromLum(L);
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.SetMaxHue(H: Integer);
|
||||
begin
|
||||
if H = FMaxHue then
|
||||
exit;
|
||||
FMaxHue := H;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
// if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.SetMaxLum(L: Integer);
|
||||
begin
|
||||
if L = FMaxLum then
|
||||
exit;
|
||||
FMaxLum := L;
|
||||
FGradientWidth := FMaxLum + 1; // 0 .. FMaxHue --> FMaxHue + 1 pixels
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
// if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.SetMaxSat(S: Integer);
|
||||
begin
|
||||
if S = FMaxSat then
|
||||
exit;
|
||||
FMaxSat := S;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.SetSat(S: integer);
|
||||
begin
|
||||
Clamp(S, 0, FMaxSat);
|
||||
if GetSat() <> S then
|
||||
begin
|
||||
FSat := S / FMaxSat;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLColorPicker.SetSelectedColor(c: TColor);
|
||||
var
|
||||
H, S, L: Double;
|
||||
needNewGradient: Boolean;
|
||||
begin
|
||||
if WebSafe then
|
||||
c := GetWebSafe(c);
|
||||
if c = GetSelectedColor then
|
||||
exit;
|
||||
|
||||
// ColortoHSL(c, H, S, L); // not working in HSLPicker
|
||||
ColorToHSL(c, H, S, L);
|
||||
needNewGradient := (H <> FHue) or (S <> FSat);
|
||||
FHue := H;
|
||||
FSat := S;
|
||||
FLuminance := L;
|
||||
if needNewGradient then
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
|
||||
end.
|
@ -1,204 +0,0 @@
|
||||
object OfficeMoreColorsWin: TOfficeMoreColorsWin
|
||||
Left = 194
|
||||
Top = 112
|
||||
Width = 331
|
||||
Height = 358
|
||||
ActiveControl = OKbtn
|
||||
BorderIcons = [biSystemMenu]
|
||||
Caption = 'More colors...'
|
||||
Color = clBtnFace
|
||||
Constraints.MinHeight = 358
|
||||
Constraints.MinWidth = 331
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poMainFormCenter
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
OnResize = FormResize
|
||||
DesignSize = (
|
||||
315
|
||||
319)
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object Label4: TLabel
|
||||
Left = 268
|
||||
Top = 218
|
||||
Width = 21
|
||||
Height = 13
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = 'New'
|
||||
Transparent = True
|
||||
end
|
||||
object Label5: TLabel
|
||||
Left = 260
|
||||
Top = 306
|
||||
Width = 37
|
||||
Height = 13
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = 'Current'
|
||||
Transparent = True
|
||||
end
|
||||
object Pages: TPageControl
|
||||
Left = 6
|
||||
Top = 6
|
||||
Width = 227
|
||||
Height = 316
|
||||
ActivePage = Standard
|
||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||
TabOrder = 0
|
||||
OnChange = PagesChange
|
||||
object Standard: TTabSheet
|
||||
Caption = 'Standard'
|
||||
DesignSize = (
|
||||
219
|
||||
288)
|
||||
object Label2: TLabel
|
||||
Left = 6
|
||||
Top = 7
|
||||
Width = 34
|
||||
Height = 13
|
||||
Caption = '&Colors:'
|
||||
FocusControl = Hexa
|
||||
Transparent = True
|
||||
end
|
||||
object Hexa: THexaColorPicker
|
||||
Left = 6
|
||||
Top = 26
|
||||
Width = 209
|
||||
Height = 207
|
||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||
HintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h'
|
||||
IntensityText = 'Intensity'
|
||||
TabOrder = 0
|
||||
Constraints.MinHeight = 85
|
||||
Constraints.MinWidth = 93
|
||||
OnChange = HexaChange
|
||||
end
|
||||
end
|
||||
object Custom: TTabSheet
|
||||
Caption = 'Custom'
|
||||
ImageIndex = 1
|
||||
DesignSize = (
|
||||
219
|
||||
288)
|
||||
object Label1: TLabel
|
||||
Left = 6
|
||||
Top = 7
|
||||
Width = 34
|
||||
Height = 13
|
||||
Caption = '&Colors:'
|
||||
FocusControl = HSL
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 6
|
||||
Top = 178
|
||||
Width = 60
|
||||
Height = 13
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Color mo&del:'
|
||||
FocusControl = ColorModel
|
||||
end
|
||||
object LRed: TLabel
|
||||
Left = 6
|
||||
Top = 204
|
||||
Width = 23
|
||||
Height = 13
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = '&Red:'
|
||||
end
|
||||
object LGreen: TLabel
|
||||
Left = 6
|
||||
Top = 230
|
||||
Width = 33
|
||||
Height = 13
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = '&Green:'
|
||||
end
|
||||
object LBlue: TLabel
|
||||
Left = 6
|
||||
Top = 256
|
||||
Width = 24
|
||||
Height = 13
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = '&Blue:'
|
||||
end
|
||||
object HSL: THSLColorPicker
|
||||
Left = 6
|
||||
Top = 20
|
||||
Width = 211
|
||||
Height = 152
|
||||
HSPickerHintFormat = 'H: %h S: %s'#13'Hex: %hex'
|
||||
LPickerHintFormat = 'Luminance: %l'
|
||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||
TabOrder = 0
|
||||
OnChange = HSLChange
|
||||
DesignSize = (
|
||||
211
|
||||
152)
|
||||
end
|
||||
object ColorModel: TComboBox
|
||||
Left = 74
|
||||
Top = 172
|
||||
Width = 92
|
||||
Height = 21
|
||||
Style = csDropDownList
|
||||
Anchors = [akLeft, akBottom]
|
||||
ItemHeight = 13
|
||||
ItemIndex = 0
|
||||
TabOrder = 1
|
||||
Text = 'RGB'
|
||||
OnChange = ColorModelChange
|
||||
Items.Strings = (
|
||||
'RGB'
|
||||
'HSL')
|
||||
end
|
||||
end
|
||||
end
|
||||
object OKbtn: TButton
|
||||
Left = 242
|
||||
Top = 6
|
||||
Width = 73
|
||||
Height = 23
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = 'OK'
|
||||
ModalResult = 1
|
||||
TabOrder = 1
|
||||
end
|
||||
object Cancelbtn: TButton
|
||||
Left = 242
|
||||
Top = 36
|
||||
Width = 73
|
||||
Height = 23
|
||||
Anchors = [akTop, akRight]
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 2
|
||||
end
|
||||
object NewSwatch: TmbColorPreview
|
||||
Left = 246
|
||||
Top = 238
|
||||
Width = 68
|
||||
Height = 32
|
||||
Hint = 'RGB(255, 255, 255)'
|
||||
Anchors = [akRight, akBottom]
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
OnColorChange = NewSwatchColorChange
|
||||
end
|
||||
object OldSwatch: TmbColorPreview
|
||||
Left = 246
|
||||
Top = 269
|
||||
Width = 68
|
||||
Height = 32
|
||||
Hint = 'RGB(255, 255, 255)'#13#10'Hex: FFFFFF'
|
||||
Anchors = [akRight, akBottom]
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
OnColorChange = OldSwatchColorChange
|
||||
end
|
||||
end
|
@ -1,26 +0,0 @@
|
||||
object ScreenForm: TScreenForm
|
||||
Left = 198
|
||||
Top = 117
|
||||
Align = alClient
|
||||
BorderIcons = []
|
||||
BorderStyle = bsNone
|
||||
Caption = 'Pick a color...'
|
||||
ClientHeight = 96
|
||||
ClientWidth = 149
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
Font.Style = []
|
||||
FormStyle = fsStayOnTop
|
||||
OldCreateOrder = False
|
||||
Position = poDefault
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
OnMouseMove = FormMouseMove
|
||||
OnMouseUp = FormMouseUp
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
end
|
@ -1,267 +0,0 @@
|
||||
unit VColorPicker;
|
||||
|
||||
interface
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE DELPHI}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
LCLIntf, LCLType, SysUtils, Classes, Controls, Forms, Graphics,
|
||||
{RGBHSVUtils,} mbTrackBarPicker, HTMLColors;
|
||||
|
||||
type
|
||||
TVColorPicker = class(TmbTrackBarPicker)
|
||||
private
|
||||
FHue, FSat, FVal: Double;
|
||||
FMaxHue, FMaxSat, FMaxVal: Integer;
|
||||
function ArrowPosFromVal(v: integer): integer;
|
||||
function ValFromArrowPos(p: integer): integer;
|
||||
function GetHue: Integer;
|
||||
function GetSat: Integer;
|
||||
function GetValue: Integer;
|
||||
procedure SetHue(h: integer);
|
||||
procedure SetMaxHue(h: Integer);
|
||||
procedure SetMaxSat(s: Integer);
|
||||
procedure SetMaxVal(v: Integer);
|
||||
procedure SetSat(s: integer);
|
||||
procedure SetValue(v: integer);
|
||||
protected
|
||||
procedure Execute(tbaAction: integer); override;
|
||||
function GetArrowPos: integer; override;
|
||||
function GetGradientColor(AValue: Integer): TColor; override;
|
||||
function GetSelectedColor: TColor; override;
|
||||
function GetSelectedValue: integer; override;
|
||||
procedure SetSelectedColor(c: TColor); override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
published
|
||||
property Hue: integer read GetHue write SetHue;
|
||||
property Saturation: integer read GetSat write SetSat;
|
||||
property Value: integer read GetValue write SetValue;
|
||||
property MaxHue: Integer read FMaxHue write SetMaxHue default 359;
|
||||
property MaxSaturation: Integer read FMaxSat write SetMaxSat default 255;
|
||||
property MaxValue: Integer read FMaxVal write SetMaxVal default 255;
|
||||
property SelectedColor default clRed;
|
||||
property HintFormat;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
mbUtils, mbColorConv;
|
||||
|
||||
{TVColorPicker}
|
||||
|
||||
constructor TVColorPicker.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FMaxHue := 359;
|
||||
FMaxSat := 255;
|
||||
FMaxVal := 255;
|
||||
FGradientWidth := FMaxVal + 1;
|
||||
FGradientHeight := 1;
|
||||
FHue := 0;
|
||||
FSat := 0;
|
||||
SetValue(FMaxVal);
|
||||
HintFormat := 'Value: %value (selected)';
|
||||
end;
|
||||
|
||||
function TVColorPicker.ArrowPosFromVal(v: integer): integer;
|
||||
var
|
||||
a: integer;
|
||||
begin
|
||||
if Layout = lyHorizontal then
|
||||
begin
|
||||
a := Round((Width - 12) * v / FMaxVal);
|
||||
if a > Width - FLimit then a := Width - FLimit;
|
||||
end
|
||||
else
|
||||
begin
|
||||
a := Round((Height - 12) * (FMaxVal - v) / FMaxVal);
|
||||
if a > Height - FLimit then a := Height - FLimit;
|
||||
end;
|
||||
if a < 0 then a := 0;
|
||||
Result := a;
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.Execute(tbaAction: integer);
|
||||
begin
|
||||
case tbaAction of
|
||||
TBA_Resize:
|
||||
SetValue(GetValue());
|
||||
TBA_MouseMove:
|
||||
SetValue(ValFromArrowPos(FArrowPos));
|
||||
TBA_MouseDown:
|
||||
SetValue(ValFromArrowPos(FArrowPos));
|
||||
TBA_MouseUp:
|
||||
SetValue(ValFromArrowPos(FArrowPos));
|
||||
TBA_WheelUp:
|
||||
SetValue(GetValue() + Increment);
|
||||
TBA_WheelDown:
|
||||
SetValue(GetValue() - Increment);
|
||||
TBA_VKRight:
|
||||
SetValue(GetValue() + Increment);
|
||||
TBA_VKCtrlRight:
|
||||
SetValue(FMaxVal);
|
||||
TBA_VKLeft:
|
||||
SetValue(GetValue() - Increment);
|
||||
TBA_VKCtrlLeft:
|
||||
SetValue(0);
|
||||
TBA_VKUp:
|
||||
SetValue(GetValue() + Increment);
|
||||
TBA_VKCtrlUp:
|
||||
SetValue(FMaxVal);
|
||||
TBA_VKDown:
|
||||
SetValue(GetValue() - Increment);
|
||||
TBA_VKCtrlDown:
|
||||
SetValue(0);
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVColorPicker.GetArrowPos: integer;
|
||||
begin
|
||||
if FMaxVal = 0 then
|
||||
Result := inherited GetArrowPos
|
||||
else
|
||||
Result := ArrowPosFromVal(GetValue());
|
||||
end;
|
||||
|
||||
function TVColorPicker.GetGradientColor(AValue: Integer): TColor;
|
||||
begin
|
||||
Result := HSVtoColor(FHue, FSat, AValue / FMaxVal);
|
||||
end;
|
||||
|
||||
function TVColorPicker.GetHue: Integer;
|
||||
begin
|
||||
Result := round(FHue * FMaxHue);
|
||||
end;
|
||||
|
||||
function TVColorPicker.GetSat: Integer;
|
||||
begin
|
||||
Result := round(FSat * FMaxSat);
|
||||
end;
|
||||
|
||||
function TVColorPicker.GetSelectedColor: TColor;
|
||||
begin
|
||||
Result := HSVtoColor(FHue, FSat, FVal);
|
||||
if WebSafe then
|
||||
Result := GetWebSafe(Result);
|
||||
end;
|
||||
|
||||
function TVColorPicker.GetSelectedValue: integer;
|
||||
begin
|
||||
Result := GetValue();
|
||||
end;
|
||||
|
||||
function TVColorPicker.GetValue: Integer;
|
||||
begin
|
||||
Result := round(FVal * FMaxVal);
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.SetHue(h: integer);
|
||||
begin
|
||||
if h > FMaxHue+1 then h := FMaxHue + 1;
|
||||
if h < 0 then h := 0;
|
||||
if GetHue() <> h then
|
||||
begin
|
||||
FHue := h / (FMaxHue + 1);
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.SetMaxHue(h: Integer);
|
||||
begin
|
||||
if h = FMaxHue then
|
||||
exit;
|
||||
FMaxHue := h;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
// if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.SetMaxSat(s: Integer);
|
||||
begin
|
||||
if s = FMaxSat then
|
||||
exit;
|
||||
FMaxSat := s;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
// if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.SetMaxVal(v: Integer);
|
||||
begin
|
||||
if v = FMaxVal then
|
||||
exit;
|
||||
FMaxVal := v;
|
||||
FGradientWidth := FMaxVal + 1;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
// if FChange and Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.SetSat(s: integer);
|
||||
begin
|
||||
if s > FMaxSat then s := FMaxSat;
|
||||
if s < 0 then s := 0;
|
||||
if GetSat() <> s then
|
||||
begin
|
||||
FSat := s / FMaxSat;
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.SetSelectedColor(c: TColor);
|
||||
var
|
||||
h, s, v: Double;
|
||||
needNewGradient: Boolean;
|
||||
begin
|
||||
if WebSafe then
|
||||
c := GetWebSafe(c);
|
||||
if c = GetSelectedColor then
|
||||
exit;
|
||||
|
||||
RGBToHSV(GetRValue(c), GetGValue(c), GetBValue(c), h, s, v);
|
||||
needNewGradient := (h <> FHue) or (s <> FSat);
|
||||
FHue := h;
|
||||
FSat := s;
|
||||
FVal := v;
|
||||
if needNewGradient then
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
|
||||
procedure TVColorPicker.SetValue(V: integer);
|
||||
begin
|
||||
if v < 0 then v := 0;
|
||||
if v > FMaxVal then v := FMaxVal;
|
||||
if GetValue() <> v then
|
||||
begin
|
||||
FVal := v / FMaxVal;
|
||||
FArrowPos := ArrowPosFromVal(v);
|
||||
Invalidate;
|
||||
DoChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TVColorPicker.ValFromArrowPos(p: integer): integer;
|
||||
var
|
||||
v: integer;
|
||||
begin
|
||||
case Layout of
|
||||
lyHorizontal : v := Round(p / (Width - 12) * FMaxVal);
|
||||
lyVertical : v := Round(FMaxVal - p / (Height - 12) * FMaxVal);
|
||||
end;
|
||||
Clamp(v, 0, FMaxVal);
|
||||
Result := v;
|
||||
end;
|
||||
|
||||
end.
|
@ -603,14 +603,14 @@ object Form1: TForm1
|
||||
end
|
||||
object TabSheet4: TTabSheet
|
||||
Caption = 'HSLRingPicker'
|
||||
ClientHeight = 365
|
||||
ClientWidth = 420
|
||||
ClientHeight = 376
|
||||
ClientWidth = 468
|
||||
ImageIndex = 3
|
||||
object HSLRingPicker1: THSLRingPicker
|
||||
Left = 50
|
||||
Height = 351
|
||||
Height = 362
|
||||
Top = 6
|
||||
Width = 322
|
||||
Width = 370
|
||||
Luminance = 240
|
||||
RingPickerHintFormat = 'Hue: %h'
|
||||
SLPickerHintFormat = 'S: %hslS V: %v'#13'Hex: %hex'
|
||||
@ -637,6 +637,7 @@ object Form1: TForm1
|
||||
HintFormat = 'H: %h S: %s V: %v'#13'Hex: %hex'
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
TabOrder = 0
|
||||
Luminance = 128
|
||||
Saturation = 0
|
||||
OnChange = HSVColorPicker1Change
|
||||
end
|
||||
@ -691,7 +692,7 @@ object Form1: TForm1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Button5
|
||||
Left = 238
|
||||
Height = 339
|
||||
Height = 347
|
||||
Top = 0
|
||||
Width = 230
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -703,7 +704,7 @@ object Form1: TForm1
|
||||
AnchorSideRight.Control = Bevel1
|
||||
AnchorSideBottom.Control = Button5
|
||||
Left = 0
|
||||
Height = 339
|
||||
Height = 347
|
||||
Top = 0
|
||||
Width = 230
|
||||
InfoLabelText = 'Color Values:'
|
||||
@ -783,7 +784,7 @@ object Form1: TForm1
|
||||
OnClick = OfficeColorDialogButtonClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object LColorPicker1: TLColorPicker
|
||||
object LVColorPicker2: TLVColorPicker
|
||||
Left = 34
|
||||
Height = 25
|
||||
Top = 265
|
||||
@ -792,12 +793,12 @@ object Form1: TForm1
|
||||
SelectionIndicator = siRect
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
TabOrder = 2
|
||||
Hue = 0
|
||||
Saturation = 240
|
||||
Luminance = 120
|
||||
HintFormat = 'Luminance: %l (selected)'
|
||||
Saturation = 240
|
||||
LHintFormat = 'Luminance: %l (selected)'
|
||||
VHintFormat = 'Value: %v (selected)'
|
||||
end
|
||||
object VColorPicker1: TVColorPicker
|
||||
object LVColorPicker3: TLVColorPicker
|
||||
Left = 34
|
||||
Height = 21
|
||||
Top = 233
|
||||
@ -807,10 +808,9 @@ object Form1: TForm1
|
||||
SelectionIndicator = siRect
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
TabOrder = 3
|
||||
Hue = 0
|
||||
Saturation = 255
|
||||
Value = 255
|
||||
HintFormat = 'Value: %v (selected)'
|
||||
LHintFormat = 'Luminance: %l (selected)'
|
||||
VHintFormat = 'Value: %v (selected)'
|
||||
end
|
||||
object HColorPicker1: THColorPicker
|
||||
Left = 34
|
||||
|
@ -8,14 +8,13 @@ uses
|
||||
Dialogs, HSLColorPicker, ComCtrls, StdCtrls, ExtCtrls, mbColorPreview,
|
||||
HexaColorPicker, mbColorPalette, HSLRingPicker, HSVColorPicker, PalUtils,
|
||||
SLHColorPicker, mbDeskPickerButton, mbOfficeColorDialog, SColorPicker,
|
||||
HColorPicker, LVColorPicker, mbTrackBarPicker, LColorPicker, HRingPicker,
|
||||
SLColorPicker, HSColorPicker, IniFiles, mbColorPickerControl, BColorPicker,
|
||||
GColorPicker, RColorPicker, KColorPicker, YColorPicker, MColorPicker,
|
||||
CColorPicker, CIEBColorPicker, CIEAColorPicker, Typinfo, CIELColorPicker,
|
||||
BAxisColorPicker, GAxisColorPicker, RAxisColorPicker, mbColorTree,
|
||||
mbColorList, mbBasicPicker,
|
||||
HColorPicker, LVColorPicker, mbTrackBarPicker, HRingPicker, SLColorPicker,
|
||||
HSColorPicker, IniFiles, mbColorPickerControl, BColorPicker, GColorPicker,
|
||||
RColorPicker, KColorPicker, YColorPicker, MColorPicker, CColorPicker,
|
||||
CIEBColorPicker, CIEAColorPicker, Typinfo, CIELColorPicker, BAxisColorPicker,
|
||||
GAxisColorPicker, RAxisColorPicker, mbColorTree, mbColorList;
|
||||
|
||||
VColorPicker;
|
||||
{ vmbColorList, mbBasicPicker, }
|
||||
|
||||
type
|
||||
|
||||
@ -58,8 +57,8 @@ type
|
||||
mbDeskPickerButton1: TmbDeskPickerButton;
|
||||
mbOfficeColorDialog1: TmbOfficeColorDialog;
|
||||
OfficeColorDialogButton: TButton;
|
||||
LColorPicker1: TLColorPicker;
|
||||
VColorPicker1: TVColorPicker;
|
||||
LVColorPicker2: TLVColorPicker;
|
||||
LVColorPicker3: TLVColorPicker;
|
||||
HColorPicker1: THColorPicker;
|
||||
SColorPicker1: TSColorPicker;
|
||||
HSColorPicker1: THSColorPicker;
|
||||
@ -426,7 +425,7 @@ begin
|
||||
else if PageControl1.ActivePage = Tabsheet5 then
|
||||
begin
|
||||
HSVColorPicker1.Enabled := CbEnabled.Checked;
|
||||
VColorPicker1.Enabled := CbEnabled.Checked;
|
||||
LVColorPicker1.Enabled := CbEnabled.Checked;
|
||||
end
|
||||
else if PageControl1.ActivePage = Tabsheet6 then
|
||||
SLHColorPicker1.Enabled := CbEnabled.Checked
|
||||
@ -439,8 +438,8 @@ begin
|
||||
begin
|
||||
mbDeskPickerButton1.Enabled := CbEnabled.Checked;
|
||||
OfficeColorDialogButton.Enabled := CbEnabled.Checked;
|
||||
LColorPicker1.Enabled := CbEnabled.Checked;
|
||||
VColorPicker1.Enabled := CbEnabled.Checked;
|
||||
LVColorPicker2.Enabled := CbEnabled.Checked;
|
||||
LVColorPicker3.Enabled := CbEnabled.Checked;
|
||||
HColorPicker1.Enabled := CbEnabled.Checked;
|
||||
SColorPicker1.Enabled := CbEnabled.Checked;
|
||||
end
|
||||
|
@ -14,10 +14,10 @@ object Form1: TForm1
|
||||
Height = 429
|
||||
Top = 0
|
||||
Width = 400
|
||||
ActivePage = tabVertical
|
||||
ActivePage = tabHorizontal
|
||||
Align = alClient
|
||||
Anchors = [akTop, akRight]
|
||||
TabIndex = 0
|
||||
TabIndex = 1
|
||||
TabOrder = 0
|
||||
object tabVertical: TTabSheet
|
||||
Caption = 'vertical'
|
||||
@ -177,37 +177,20 @@ object Form1: TForm1
|
||||
Caption = 'R'
|
||||
ParentColor = False
|
||||
end
|
||||
object VColorPickerV: TVColorPicker
|
||||
AnchorSideTop.Control = HColorPickerV
|
||||
Left = 368
|
||||
Height = 279
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Value: %value'
|
||||
Layout = lyVertical
|
||||
Visible = False
|
||||
TabOrder = 5
|
||||
OnChange = SLVPickerV_Change
|
||||
Hue = 0
|
||||
Saturation = 0
|
||||
Value = 255
|
||||
SelectedColor = clWhite
|
||||
end
|
||||
object LColorPickerV: TLColorPicker
|
||||
object LVColorPickerV: TLVColorPicker
|
||||
AnchorSideTop.Control = HColorPickerV
|
||||
Left = 350
|
||||
Height = 279
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Luminance: %value'
|
||||
SelectedColor = 14869218
|
||||
Layout = lyVertical
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 6
|
||||
TabOrder = 5
|
||||
OnChange = SLVPickerV_Change
|
||||
Hue = 0
|
||||
Saturation = 0
|
||||
Luminance = 226
|
||||
SelectedColor = 14869218
|
||||
LHintFormat = 'Luminance: %l'
|
||||
VHintFormat = 'Value: %v'
|
||||
end
|
||||
object HColorPickerV: THColorPicker
|
||||
AnchorSideTop.Control = LblH
|
||||
@ -216,14 +199,12 @@ object Form1: TForm1
|
||||
Height = 279
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Hue: %value'
|
||||
Layout = lyVertical
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 7
|
||||
TabOrder = 6
|
||||
OnChange = HPickerV_Change
|
||||
Hue = 0
|
||||
Saturation = 255
|
||||
Value = 255
|
||||
Luminance = 128
|
||||
HintFormat = 'Hue: %value'
|
||||
end
|
||||
object KColorPickerV: TKColorPicker
|
||||
AnchorSideTop.Control = CColorPickerV
|
||||
@ -231,13 +212,13 @@ object Form1: TForm1
|
||||
Height = 297
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Black: %value'
|
||||
SelectedColor = 16711422
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 8
|
||||
TabOrder = 7
|
||||
OnChange = CMYKPickerV_Change
|
||||
Cyan = 0
|
||||
Black = 1
|
||||
SelectedColor = 16711422
|
||||
HintFormat = 'Black: %value'
|
||||
end
|
||||
object YColorPickerV: TYColorPicker
|
||||
AnchorSideTop.Control = CColorPickerV
|
||||
@ -245,11 +226,11 @@ object Form1: TForm1
|
||||
Height = 297
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Yellow: %value'
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 9
|
||||
OnChange = CMYKPickerV_Change
|
||||
SelectedColor = clYellow
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 8
|
||||
OnChange = CMYKPickerV_Change
|
||||
HintFormat = 'Yellow: %value'
|
||||
end
|
||||
object MColorPickerV: TMColorPicker
|
||||
AnchorSideTop.Control = CColorPickerV
|
||||
@ -257,11 +238,11 @@ object Form1: TForm1
|
||||
Height = 297
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Magenta: %value'
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 10
|
||||
OnChange = CMYKPickerV_Change
|
||||
SelectedColor = clFuchsia
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 9
|
||||
OnChange = CMYKPickerV_Change
|
||||
HintFormat = 'Magenta: %value'
|
||||
end
|
||||
object CColorPickerV: TCColorPicker
|
||||
AnchorSideTop.Control = LblC
|
||||
@ -270,11 +251,11 @@ object Form1: TForm1
|
||||
Height = 297
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Cyan: %value'
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 11
|
||||
OnChange = CMYKPickerV_Change
|
||||
SelectedColor = clAqua
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 10
|
||||
OnChange = CMYKPickerV_Change
|
||||
HintFormat = 'Cyan: %value'
|
||||
end
|
||||
object RColorPickerV: TRColorPicker
|
||||
AnchorSideTop.Control = LblR
|
||||
@ -283,12 +264,12 @@ object Form1: TForm1
|
||||
Height = 297
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Red: %value'
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 12
|
||||
TabOrder = 11
|
||||
OnChange = RGBPickerV_Change
|
||||
Green = 0
|
||||
Blue = 0
|
||||
HintFormat = 'Red: %value'
|
||||
end
|
||||
object GColorPickerV: TGColorPicker
|
||||
AnchorSideTop.Control = RColorPickerV
|
||||
@ -296,13 +277,13 @@ object Form1: TForm1
|
||||
Height = 297
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Green: %value'
|
||||
SelectedColor = clLime
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 13
|
||||
TabOrder = 12
|
||||
OnChange = RGBPickerV_Change
|
||||
Red = 0
|
||||
Blue = 0
|
||||
SelectedColor = clLime
|
||||
HintFormat = 'Green: %value'
|
||||
end
|
||||
object BColorPickerV: TBColorPicker
|
||||
AnchorSideTop.Control = RColorPickerV
|
||||
@ -310,13 +291,13 @@ object Form1: TForm1
|
||||
Height = 297
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Blue: %value'
|
||||
SelectedColor = clBlue
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 14
|
||||
TabOrder = 13
|
||||
OnChange = RGBPickerV_Change
|
||||
Green = 0
|
||||
Red = 0
|
||||
SelectedColor = clBlue
|
||||
HintFormat = 'Blue: %value'
|
||||
end
|
||||
object SColorPickerV: TSColorPicker
|
||||
AnchorSideTop.Control = HColorPickerV
|
||||
@ -324,14 +305,12 @@ object Form1: TForm1
|
||||
Height = 279
|
||||
Top = 23
|
||||
Width = 22
|
||||
HintFormat = 'Saturation: %value'
|
||||
Layout = lyVertical
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
TabOrder = 15
|
||||
TabOrder = 14
|
||||
OnChange = SLVPickerV_Change
|
||||
Hue = 0
|
||||
Saturation = 255
|
||||
Value = 255
|
||||
Luminance = 128
|
||||
HintFormat = 'Saturation: %value'
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -491,35 +470,19 @@ object Form1: TForm1
|
||||
Caption = 'R'
|
||||
ParentColor = False
|
||||
end
|
||||
object VColorPickerH: TVColorPicker
|
||||
Left = 128
|
||||
Height = 22
|
||||
Top = 373
|
||||
Width = 224
|
||||
BevelInner = bvLowered
|
||||
HintFormat = 'Value: %value'
|
||||
Visible = False
|
||||
TabOrder = 5
|
||||
OnChange = SLVPickerH_Change
|
||||
Hue = 0
|
||||
Saturation = 0
|
||||
Value = 255
|
||||
SelectedColor = clWhite
|
||||
end
|
||||
object LColorPickerH: TLColorPicker
|
||||
object LVColorPickerH: TLVColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 344
|
||||
Width = 301
|
||||
BevelInner = bvLowered
|
||||
HintFormat = 'Luminance: %value'
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 6
|
||||
OnChange = SLVPickerH_Change
|
||||
Hue = 0
|
||||
Saturation = 0
|
||||
Luminance = 226
|
||||
SelectedColor = 14869218
|
||||
BevelInner = bvLowered
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 5
|
||||
OnChange = SLVPickerH_Change
|
||||
Luminance = 226
|
||||
LHintFormat = 'Luminance: %l'
|
||||
VHintFormat = 'Value: %v'
|
||||
end
|
||||
object SColorPickerH: TSColorPicker
|
||||
Left = 24
|
||||
@ -527,13 +490,11 @@ object Form1: TForm1
|
||||
Top = 312
|
||||
Width = 301
|
||||
BevelOuter = bvLowered
|
||||
HintFormat = 'Saturation: %value'
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 7
|
||||
TabOrder = 6
|
||||
OnChange = SLVPickerH_Change
|
||||
Hue = 0
|
||||
Saturation = 255
|
||||
Value = 255
|
||||
Luminance = 128
|
||||
HintFormat = 'Saturation: %value'
|
||||
end
|
||||
object HColorPickerH: THColorPicker
|
||||
Left = 24
|
||||
@ -541,104 +502,102 @@ object Form1: TForm1
|
||||
Top = 282
|
||||
Width = 301
|
||||
BevelOuter = bvLowered
|
||||
HintFormat = 'Hue: %value'
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 8
|
||||
TabOrder = 7
|
||||
OnChange = HPickerH_Change
|
||||
Hue = 0
|
||||
Saturation = 255
|
||||
Value = 255
|
||||
Luminance = 128
|
||||
HintFormat = 'Hue: %value'
|
||||
end
|
||||
object KColorPickerH: TKColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 224
|
||||
Width = 301
|
||||
HintFormat = 'Black: %value'
|
||||
SelectedColor = 16711422
|
||||
Layout = lyHorizontal
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 9
|
||||
TabOrder = 8
|
||||
OnChange = CMYKPickerH_Change
|
||||
Cyan = 0
|
||||
Black = 1
|
||||
SelectedColor = 16711422
|
||||
HintFormat = 'Black: %value'
|
||||
end
|
||||
object MColorPickerH: TMColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 160
|
||||
Width = 301
|
||||
HintFormat = 'Magenta: %value'
|
||||
SelectedColor = clFuchsia
|
||||
Layout = lyHorizontal
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 10
|
||||
TabOrder = 9
|
||||
OnChange = CMYKPickerH_Change
|
||||
SelectedColor = clFuchsia
|
||||
HintFormat = 'Magenta: %value'
|
||||
end
|
||||
object YColorPickerH: TYColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 192
|
||||
Width = 301
|
||||
HintFormat = 'Yellow: %value'
|
||||
SelectedColor = clYellow
|
||||
Layout = lyHorizontal
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 11
|
||||
TabOrder = 10
|
||||
OnChange = CMYKPickerH_Change
|
||||
SelectedColor = clYellow
|
||||
HintFormat = 'Yellow: %value'
|
||||
end
|
||||
object CColorPickerH: TCColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 128
|
||||
Width = 301
|
||||
HintFormat = 'Cyan: %value'
|
||||
SelectedColor = clAqua
|
||||
Layout = lyHorizontal
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 12
|
||||
TabOrder = 11
|
||||
OnChange = CMYKPickerH_Change
|
||||
SelectedColor = clAqua
|
||||
HintFormat = 'Cyan: %value'
|
||||
end
|
||||
object BColorPickerH: TBColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 80
|
||||
Width = 301
|
||||
HintFormat = 'Blue: %value'
|
||||
SelectedColor = clBlue
|
||||
Layout = lyHorizontal
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 13
|
||||
TabOrder = 12
|
||||
OnChange = RGBPickerH_Change
|
||||
Green = 0
|
||||
Red = 0
|
||||
SelectedColor = clBlue
|
||||
HintFormat = 'Blue: %value'
|
||||
end
|
||||
object GColorPickerH: TGColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 48
|
||||
Width = 301
|
||||
HintFormat = 'Green: %value'
|
||||
SelectedColor = clLime
|
||||
Layout = lyHorizontal
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 14
|
||||
TabOrder = 13
|
||||
OnChange = RGBPickerH_Change
|
||||
Red = 0
|
||||
Blue = 0
|
||||
SelectedColor = clLime
|
||||
HintFormat = 'Green: %value'
|
||||
end
|
||||
object RColorPickerH: TRColorPicker
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 16
|
||||
Width = 301
|
||||
HintFormat = 'Red: %value'
|
||||
Layout = lyHorizontal
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 15
|
||||
TabOrder = 14
|
||||
OnChange = RGBPickerH_Change
|
||||
Green = 0
|
||||
Blue = 0
|
||||
HintFormat = 'Red: %value'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
||||
StdCtrls, ExtCtrls, BColorPicker, GColorPicker, RColorPicker, CColorPicker,
|
||||
YColorPicker, MColorPicker, KColorPicker, HColorPicker, SColorPicker,
|
||||
LColorPicker, VColorPicker, mbColorPreview;
|
||||
LVColorPicker, mbColorPreview;
|
||||
|
||||
type
|
||||
|
||||
@ -49,8 +49,6 @@ type
|
||||
Label7: TLabel;
|
||||
LblH: TLabel;
|
||||
Label9: TLabel;
|
||||
LColorPickerH: TLColorPicker;
|
||||
LColorPickerV: TLColorPicker;
|
||||
CMYKh: TmbColorPreview;
|
||||
HSLVh: TmbColorPreview;
|
||||
Panel1: TPanel;
|
||||
@ -72,8 +70,8 @@ type
|
||||
SColorPickerV: TSColorPicker;
|
||||
tabVertical: TTabSheet;
|
||||
tabHorizontal: TTabSheet;
|
||||
VColorPickerH: TVColorPicker;
|
||||
VColorPickerV: TVColorPicker;
|
||||
LVColorPickerH: TLVColorPicker;
|
||||
LVColorPickerV: TLVColorPicker;
|
||||
YColorPickerH: TYColorPicker;
|
||||
YColorPickerV: TYColorPicker;
|
||||
procedure CMYKPickerV_Change(Sender: TObject);
|
||||
@ -96,12 +94,18 @@ type
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
const
|
||||
MaxHue = 360;
|
||||
MaxSat = 255;
|
||||
MaxLum = 255;
|
||||
MaxVal = 255;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
LCLType, LCLIntf, ScanLines, RGBCMYKUtils, RGBHSLUtils, RGBHSVUtils;
|
||||
LCLType, LCLIntf, ScanLines, RGBCMYKUtils, mbColorConv;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
@ -124,8 +128,9 @@ begin
|
||||
'Cyan: %d - Magenta: %d - Yellow: %d - Black: %d'#13 +
|
||||
'Hue: %d - Saturation: %d - Luminance: %d - Value: %d', [
|
||||
GetRValue(c), GetGValue(c), GetBValue(c),
|
||||
GetCValue(c), GetMValue(c), GetYvalue(c), GetKValue(c),
|
||||
GetHValue(c), GetSValue(c), GetLValue(c), GetVValue(c)
|
||||
GetCValue(c), GetMValue(c), GetYValue(c), GetKValue(c),
|
||||
round(GetRelHValue(c)*MaxHue), round(GetRelSValueHSL(c)*MaxSat),
|
||||
round(GetRelLValue(c)*MaxLum), round(GetRelVValue(c)*MaxVal)
|
||||
]);
|
||||
end;
|
||||
|
||||
@ -149,26 +154,13 @@ begin
|
||||
'Hue: %d - Saturation: %d - Luminance: %d - Value: %d', [
|
||||
GetRValue(c), GetGValue(c), GetBValue(c),
|
||||
GetCValue(c), GetMValue(c), GetYvalue(c), GetKValue(c),
|
||||
GetHValue(c), GetSValue(c), GetLValue(c), GetVValue(c)
|
||||
round(GetRelHValue(c)*MaxHue), round(GetRelSValueHSL(c)*MaxSat),
|
||||
round(GetRelLValue(c)*MaxLum), round(GetRelVValue(c)*MaxVal)
|
||||
]);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
MaxHue := 359;
|
||||
MaxSat := 240;
|
||||
MaxLum := 240;
|
||||
|
||||
VColorPickerH.Left := LColorPickerH.Left;
|
||||
VColorPickerH.Top := LColorPickerH.Top;
|
||||
VColorPickerH.Width := LColorPickerH.Width;
|
||||
VColorPickerH.Anchors := [akLeft, akTop, akRight];
|
||||
|
||||
VColorPickerV.Left := LColorPickerV.Left;
|
||||
VColorPickerV.Top := LColorPickerV.Top;
|
||||
VColorPickerV.Height := LColorPickerV.Height;
|
||||
VColorPickerV.Anchors := [akLeft, akTop, akBottom];
|
||||
|
||||
RGBPickerH_Change(nil);
|
||||
CMYKPickerH_Change(nil);
|
||||
SLVPickerH_Change(nil);
|
||||
@ -180,20 +172,21 @@ end;
|
||||
|
||||
procedure TForm1.HPickerH_Change(Sender: TObject);
|
||||
begin
|
||||
exit;
|
||||
if ComponentState <> [] then
|
||||
exit;
|
||||
|
||||
SLVPickerH_Change(nil);
|
||||
SColorPickerH.Hue := HColorPickerH.Hue;
|
||||
LColorPickerH.Hue := HColorPickerH.Hue;
|
||||
VColorPickerH.Hue := HColorPickerH.Hue;
|
||||
LVColorPickerH.Hue := HColorPickerH.Hue;
|
||||
end;
|
||||
|
||||
procedure TForm1.HPickerV_Change(Sender: TObject);
|
||||
begin
|
||||
if ComponentState <> [] then
|
||||
exit;
|
||||
SLVPickerV_Change(nil);
|
||||
SColorPickerV.Hue := HColorPickerV.Hue;
|
||||
LColorPickerV.Hue := HColorPickerV.Hue;
|
||||
VColorPickerV.Hue := HColorPickerV.Hue;
|
||||
LVColorPickerV.Hue := HColorPickerV.Hue;
|
||||
end;
|
||||
|
||||
procedure TForm1.rbHSLv_Change(Sender: TObject);
|
||||
@ -201,14 +194,16 @@ begin
|
||||
if rbHSLv.Checked then
|
||||
begin
|
||||
lblLVv.Caption := 'L';
|
||||
VColorPickerV.Visible := false;
|
||||
LColorPickerV.Visible := true;
|
||||
HColorPickerV.BrightnessMode := bmLuminance;
|
||||
SColorPickerV.BrightnessMode := bmLuminance;
|
||||
LVColorPickerV.BrightnessMode := bmLuminance;
|
||||
end;
|
||||
if rbHSVv.Checked then
|
||||
begin
|
||||
lblLVv.Caption := 'V';
|
||||
LColorPickerV.Visible := false;
|
||||
VColorPickerV.Visible := true;
|
||||
HColorPickerV.BrightnessMode := bmValue;
|
||||
SColorPickerV.BrightnessMode := bmValue;
|
||||
LVColorPickerV.BrightnessMode := bmValue;
|
||||
end;
|
||||
HPickerV_Change(nil);
|
||||
end;
|
||||
@ -218,14 +213,16 @@ begin
|
||||
if rbHSLh.Checked then
|
||||
begin
|
||||
lblLVh.Caption := 'L';
|
||||
VColorPickerH.Visible := false;
|
||||
LColorPickerH.Visible := true;
|
||||
HColorPickerH.BrightnessMode := bmLuminance;
|
||||
SColorPickerH.BrightnessMode := bmLuminance;
|
||||
LVColorPickerH.BrightnessMode := bmLuminance;
|
||||
end;
|
||||
if rbHSVh.Checked then
|
||||
begin
|
||||
lblLVh.Caption := 'V';
|
||||
lColorPickerH.Visible := false;
|
||||
VColorPickerH.Visible := true;
|
||||
HColorPickerH.BrightnessMode := bmValue;
|
||||
SColorPickerH.BrightnessMode := bmValue;
|
||||
LVColorPickerH.BrightnessMode := bmValue;
|
||||
end;
|
||||
HPickerH_Change(nil);
|
||||
end;
|
||||
@ -248,7 +245,8 @@ begin
|
||||
'Hue: %d - Saturation: %d - Luminance: %d - Value: %d', [
|
||||
GetRValue(c), GetGValue(c), GetBValue(c),
|
||||
GetCValue(c), GetMValue(c), GetYvalue(c), GetKValue(c),
|
||||
GetHValue(c), GetSValue(c), GetLValue(c), GetVValue(c)
|
||||
round(GetRelHValue(c)*MaxHue), round(GetRelSValueHSL(c)*MaxSat),
|
||||
round(GetRelLValue(c)*MaxLum), round(GetRelVValue(c)*MaxVal)
|
||||
]);
|
||||
end;
|
||||
|
||||
@ -270,7 +268,8 @@ begin
|
||||
'Hue: %d - Saturation: %d - Luminance: %d - Value: %d', [
|
||||
GetRValue(c), GetGValue(c), GetBValue(c),
|
||||
GetCValue(c), GetMValue(c), GetYvalue(c), GetKValue(c),
|
||||
GetHValue(c), GetSValue(c), GetLValue(c), GetVValue(c)
|
||||
round(GetRelHValue(c)*MaxHue), round(GetRelSValueHSL(c)*MaxSat),
|
||||
round(GetRelLValue(c)*MaxLum), round(GetRelVValue(c)*MaxVal)
|
||||
]);
|
||||
end;
|
||||
|
||||
@ -279,18 +278,16 @@ var
|
||||
triple: TRGBTriple;
|
||||
c: TColor;
|
||||
begin
|
||||
if (HSLVh = nil) or (HColorPickerH = nil) or (SColorPickerH = nil) then
|
||||
if (HSLVh = nil) or (HColorPickerH = nil) or (SColorPickerH = nil) or
|
||||
(LVColorPickerH = nil)
|
||||
then
|
||||
exit;
|
||||
if rbHSLh.Checked then begin
|
||||
if (LColorPickerH = nil) then
|
||||
exit;
|
||||
HSLVh.Color := HSLRangeToRGB(HColorPickerH.Hue, SColorPickerH.Saturation, LColorPickerH.Luminance);
|
||||
end;
|
||||
if rbHSVh.Checked then begin
|
||||
if (VColorPickerH = nil) then
|
||||
exit;
|
||||
HSLVh.Color := HSVRangetoColor(HColorPickerH.Hue, SColorPickerH.Saturation, VColorPickerH.Value);
|
||||
end;
|
||||
|
||||
if rbHSLh.Checked then
|
||||
HSLVh.Color := HSLToColor(HColorPickerH.RelHue, SColorPickerH.RelSaturation, LVColorPickerH.RelLuminance);
|
||||
|
||||
if rbHSVh.Checked then
|
||||
HSLVh.Color := HSVToColor(HColorPickerH.RelHue, SColorPickerH.RelSaturation, LVColorPickerH.RelValue);
|
||||
|
||||
c := HSLVh.Color;
|
||||
HSLVh.Hint := Format('Red: %d - Green: %d - Blue: %d'#13 +
|
||||
@ -298,31 +295,31 @@ begin
|
||||
'Hue: %d - Saturation: %d - Luminance: %d - Value: %d', [
|
||||
GetRValue(c), GetGValue(c), GetBValue(c),
|
||||
GetCValue(c), GetMValue(c), GetYvalue(c), GetKValue(c),
|
||||
GetHValue(c), GetSValue(c), GetLValue(c), GetVValue(c)
|
||||
round(GetRelHValue(c)*MaxHue), round(GetRelSValueHSL(c)*MaxSat),
|
||||
round(GetRelLValue(c)*MaxLum), round(GetRelVValue(c)*MaxVal)
|
||||
]);
|
||||
end;
|
||||
|
||||
procedure TForm1.SLVPickerV_Change(Sender: TObject);
|
||||
var
|
||||
triple: TRGBTriple;
|
||||
c: TColor;
|
||||
begin
|
||||
if (HSLVv = nil) or (HColorPickerV = nil) or (SColorPickerV = nil) then
|
||||
if (HSLVv = nil) or (HColorPickerV = nil) or (SColorPickerV = nil) or
|
||||
(LVColorPickerV = nil)
|
||||
then
|
||||
exit;
|
||||
|
||||
if rbHSLv.Checked then begin
|
||||
if (LColorPickerV = nil) then
|
||||
if (LVColorPickerV = nil) then
|
||||
exit;
|
||||
triple := HSLToRGBTriple(HColorPickerV.Hue, SColorPickerV.Saturation, LColorPickerV.Luminance);
|
||||
HSLVv.Color := RGBTripleToColor(triple);
|
||||
c := HSLToColor(HColorPickerV.RelHue, SColorPickerV.RelSaturation, LVColorPickerV.RelLuminance);
|
||||
HSLVv.Color := c;
|
||||
end;
|
||||
if rbHSVv.Checked then begin
|
||||
if (VColorPickerV = nil) then
|
||||
if (LVColorPickerV = nil) then
|
||||
exit;
|
||||
HSLVv.Color := HSVtoColor(
|
||||
HColorPickerV.Hue/HColorPickerV.MaxHue,
|
||||
SColorPickerV.Saturation/SColorPickerV.MaxSaturation,
|
||||
VColorPickerV.Value/VColorPickerV.MaxValue
|
||||
);
|
||||
c := HSVtoColor(HColorPickerV.RelHue, SColorPickerV.RelSaturation, LVColorPickerV.RelValue);
|
||||
HSLVv.Color := c;
|
||||
end;
|
||||
|
||||
c := HSLVv.Color;
|
||||
@ -331,7 +328,8 @@ begin
|
||||
'Hue: %d - Saturation: %d - Luminance: %d - Value: %d', [
|
||||
GetRValue(c), GetGValue(c), GetBValue(c),
|
||||
GetCValue(c), GetMValue(c), GetYvalue(c), GetKValue(c),
|
||||
GetHValue(c), GetSValue(c), GetLValue(c), GetVValue(c)
|
||||
round(GetRelHValue(c)*MaxHue), round(GetRelSValueHSL(c)*MaxSat),
|
||||
round(GetRelLValue(c)*MaxLum), round(GetRelVValue(c)*MaxVal)
|
||||
]);
|
||||
end;
|
||||
|
||||
|
@ -406,15 +406,6 @@ LazarusResources.Add('TKColorPicker','PNG',[
|
||||
+#220#162#229#255#224#217#143#182'e'#29'y%'#22#197'[r'#31#189#0#0#0#0'IEND'
|
||||
+#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('TLColorPicker','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0'bIDATH'#199#237#146#187
|
||||
+#10#128'0'#12'EO'#193#255#255'=G'#199'tK'#198'nq'#176'R'#199#182'"'#10#230'@'
|
||||
+' !'#185'y@ x'#155#212'Q'#227'w'#244#169's'#17#159#213#166#129'k}R7'#132#255
|
||||
+#244#139'\'#213'Q'#133#156'A'#228'0'#179#230#139#180'\)l@'#6#164#154']'#252
|
||||
+'3^k'#239#229#233#11'b@'#12#8#130'/'#176#3#3#136'% V"'#162#11#0#0#0#0'IEND'
|
||||
+#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('TmbColorList','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#216'IDATH'#199'c`'#160
|
||||
@ -631,21 +622,6 @@ LazarusResources.Add('TSLHColorPicker','PNG',[
|
||||
+'?u'#29#24'c'#240#222#167#23'$/'#242'0'#159#129#23#229#127'l'#134#236#0'N'#26
|
||||
+#216#253'+?'#253'?!R'#213'K'#11'&'#20#141#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('TVColorPicker','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#242'IDATH'#199#237#149
|
||||
+'OJ'#196'0'#28#133#191#252'k'#133#193#201'"'#139#129'\`<J'#151#222#173'wp'
|
||||
+#237#178#7#241#18'n'#132#216#233't'#146#214#137#139#142#168#168#139'*'#130'8'
|
||||
+#253#224#241'H'#8#191'G'#194#131#192#194#191'G'#204'9l'#173#205'!'#4#172#181
|
||||
+'8'#231#216'l6x'#239#241#222'S'#215#245#167#179#244#156#128#16#130#176#214
|
||||
+#230#178',1'#198#160#181'FJ'#245#229#240#217'7xa{'#181#205#235#203'5'#206'9'
|
||||
+#154#166#17#191#242#182'UU'#229'3k'#209#245#205#152'o'#239'zV'#185#133#184
|
||||
+#131#225'q'#242#216'Bj'#223#248#238#253':'#181#144'^'#247#186#135'{'#136'A|h'
|
||||
+#209'p'#156#188'K'#25#210'qR|:i'#132'8@'#26' '#166#147'"'#164#8#233#0#177#135
|
||||
+#212'C'#220#255#172#166#223'a'#9#248'C'#1'FN'#190'*'#4'd'#9'B'#2'j'#146#208
|
||||
+' '#12'H'#3#162#0'Y'#128',A%P'#23#160'F'#208'#'#168#145#238#208'._'#200#185
|
||||
+#241#12'o'#213'fM'#147#161'f;'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('TLVColorPicker','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#163'IDATH'#199#237#149
|
||||
|
@ -19,7 +19,7 @@ uses
|
||||
RAxisColorPicker, GAxisColorPicker, BAxisColorPicker,
|
||||
CColorPicker, MColorPicker, YColorPicker, KColorPicker,
|
||||
HRingPicker,
|
||||
HColorPicker, SColorPicker, LVColorPicker, LColorPicker, VColorPicker,
|
||||
HColorPicker, SColorPicker, LVColorPicker, //LColorPicker, VColorPicker,
|
||||
HSColorPicker, HSVColorPicker, HSLColorPicker, HSLRingPicker,
|
||||
SLColorPicker, SLHColorPicker,
|
||||
CIEAColorPicker, CIEBColorPicker, CIELColorPicker,
|
||||
@ -34,7 +34,7 @@ begin
|
||||
TRAxisColorPicker, TGAxisColorPicker, TBAxisColorPicker,
|
||||
TCColorPicker, TMColorPicker, TYColorPicker, TKColorPicker,
|
||||
THRingPicker,
|
||||
THColorPicker, TSColorPicker, TLVColorPicker, TLColorPicker, TVColorPicker,
|
||||
THColorPicker, TSColorPicker, TLVColorPicker, //TLColorPicker, TVColorPicker,
|
||||
THSColorPicker, THSVColorPicker, THSLColorPicker, THSLRingPicker,
|
||||
TSLColorPicker, TSLHColorPicker,
|
||||
TCIEAColorPicker, TCIEBColorPicker, TCIELColorPicker,
|
||||
|
@ -907,9 +907,18 @@ end;
|
||||
procedure TmbHSLVTrackbarPicker.SetBrightnessMode(AMode: TBrightnessMode);
|
||||
var
|
||||
c: TColor;
|
||||
S, L, V: Double;
|
||||
begin
|
||||
c := HSLVtoColor(FHue, FSat, FLum, FVal);
|
||||
FBrightnessMode := AMode;
|
||||
(*
|
||||
ColorToHSLV(c, FHue, S, L, V);
|
||||
SetRelSat(S);
|
||||
case AMode of
|
||||
bmLuminance: SetRelLum(L);
|
||||
bmValue : SetRelVal(V);
|
||||
end;
|
||||
*)
|
||||
ColorToHSLV(c, FHue, FSat, FLum, FVal);
|
||||
CreateGradient;
|
||||
Invalidate;
|
||||
|
@ -26,6 +26,14 @@ procedure RGBtoHSV(R, G, B: Integer; out H, S, V: Double);
|
||||
function HSVtoColor(H, S, V: Double): TColor;
|
||||
procedure HSVtoRGB(H, S, V: Double; out R, G, B: Integer);
|
||||
|
||||
{ H, S, L, V extraction }
|
||||
|
||||
function GetRelHValue(c: TColor): Double;
|
||||
function GetRelSValueHSL(c: TColor): Double;
|
||||
function GetRelSValueHSV(c: TColor): Double;
|
||||
function GetRelLValue(c: TColor): Double;
|
||||
function GetRelVValue(c: TColor): Double;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
@ -312,5 +320,50 @@ begin
|
||||
V := cmax;
|
||||
end;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// H, S, L, V extraction
|
||||
//==============================================================================
|
||||
|
||||
function GetRelHValue(c: TColor): Double;
|
||||
var
|
||||
H, S, L: Double;
|
||||
begin
|
||||
ColorToHSL(c, H, S, L); // Could also use HSV - H is the same in both models
|
||||
Result := H;
|
||||
end;
|
||||
|
||||
function GetRelSValueHSL(c: TColor): Double;
|
||||
var
|
||||
H, S, L: Double;
|
||||
begin
|
||||
ColorToHSL(c, H, S, L);
|
||||
Result := S;
|
||||
end;
|
||||
|
||||
function GetRelSValueHSV(c: TColor): Double;
|
||||
var
|
||||
H, S, V: Double;
|
||||
begin
|
||||
ColorToHSV(c, H, S, V);
|
||||
Result := S;
|
||||
end;
|
||||
|
||||
function GetRelLValue(c: TColor): Double;
|
||||
var
|
||||
H, S, L: Double;
|
||||
begin
|
||||
ColorToHSL(c, H, S, L);
|
||||
result := L;
|
||||
end;
|
||||
|
||||
function GetRelVValue(c: TColor): Double;
|
||||
var
|
||||
H, S, V: Double;
|
||||
begin
|
||||
ColorToHSV(c, H, S, V);
|
||||
Result := V;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
<Description Value="Comprehensive color selection library with more than 30 components"/>
|
||||
<License Value="License is granted to use, modify and redistribute these units in your applications as you see fit. You are given COMPLETE FREEDOM with the sources found in this pack; you're free to use it in ANY kind of app without even mentioning my name, my site or any other stuff, that depends on your good will and nothing else. I will accept any modifications and incorporate them in this pack if they'll help make it better. You are under NO obligation to pay for these components to neither me nor anyone else trying to sell them in their current form. If you wish to support development of these components you can do so by contributing some source or making a donation, again this solely depends on your good will."/>
|
||||
<Version Major="2" Minor="1"/>
|
||||
<Files Count="48">
|
||||
<Files Count="46">
|
||||
<Item1>
|
||||
<Filename Value="PalUtils.pas"/>
|
||||
<UnitName Value="PalUtils"/>
|
||||
@ -69,147 +69,139 @@
|
||||
<UnitName Value="KColorPicker"/>
|
||||
</Item13>
|
||||
<Item14>
|
||||
<Filename Value="LColorPicker.pas"/>
|
||||
<UnitName Value="LColorPicker"/>
|
||||
</Item14>
|
||||
<Item15>
|
||||
<Filename Value="MColorPicker.pas"/>
|
||||
<UnitName Value="MColorPicker"/>
|
||||
</Item15>
|
||||
<Item16>
|
||||
<Filename Value="VColorPicker.pas"/>
|
||||
<UnitName Value="VColorPicker"/>
|
||||
</Item16>
|
||||
<Item17>
|
||||
</Item14>
|
||||
<Item15>
|
||||
<Filename Value="YColorPicker.pas"/>
|
||||
<UnitName Value="YColorPicker"/>
|
||||
</Item17>
|
||||
<Item18>
|
||||
</Item15>
|
||||
<Item16>
|
||||
<Filename Value="mbColorPreview.pas"/>
|
||||
<UnitName Value="mbColorPreview"/>
|
||||
</Item18>
|
||||
<Item19>
|
||||
</Item16>
|
||||
<Item17>
|
||||
<Filename Value="Scanlines.pas"/>
|
||||
<UnitName Value="Scanlines"/>
|
||||
</Item19>
|
||||
<Item20>
|
||||
</Item17>
|
||||
<Item18>
|
||||
<Filename Value="mbColorPickerControl.pas"/>
|
||||
<UnitName Value="mbColorPickerControl"/>
|
||||
</Item20>
|
||||
<Item21>
|
||||
</Item18>
|
||||
<Item19>
|
||||
<Filename Value="BAxisColorPicker.pas"/>
|
||||
<UnitName Value="BAxisColorPicker"/>
|
||||
</Item21>
|
||||
<Item22>
|
||||
</Item19>
|
||||
<Item20>
|
||||
<Filename Value="GAxisColorPicker.pas"/>
|
||||
<UnitName Value="GAxisColorPicker"/>
|
||||
</Item22>
|
||||
<Item23>
|
||||
</Item20>
|
||||
<Item21>
|
||||
<Filename Value="RAxisColorPicker.pas"/>
|
||||
<UnitName Value="RAxisColorPicker"/>
|
||||
</Item23>
|
||||
<Item24>
|
||||
</Item21>
|
||||
<Item22>
|
||||
<Filename Value="CIEAColorPicker.pas"/>
|
||||
<UnitName Value="CIEAColorPicker"/>
|
||||
</Item24>
|
||||
<Item25>
|
||||
</Item22>
|
||||
<Item23>
|
||||
<Filename Value="CIEBColorPicker.pas"/>
|
||||
<UnitName Value="CIEBColorPicker"/>
|
||||
</Item25>
|
||||
<Item26>
|
||||
</Item23>
|
||||
<Item24>
|
||||
<Filename Value="CIELColorPicker.pas"/>
|
||||
<UnitName Value="CIELColorPicker"/>
|
||||
</Item26>
|
||||
<Item27>
|
||||
</Item24>
|
||||
<Item25>
|
||||
<Filename Value="HRingPicker.pas"/>
|
||||
<UnitName Value="HRingPicker"/>
|
||||
</Item27>
|
||||
<Item28>
|
||||
</Item25>
|
||||
<Item26>
|
||||
<Filename Value="HexaColorPicker.pas"/>
|
||||
<UnitName Value="HexaColorPicker"/>
|
||||
</Item28>
|
||||
<Item29>
|
||||
</Item26>
|
||||
<Item27>
|
||||
<Filename Value="HSColorPicker.pas"/>
|
||||
<UnitName Value="HSColorPicker"/>
|
||||
</Item29>
|
||||
<Item30>
|
||||
</Item27>
|
||||
<Item28>
|
||||
<Filename Value="SLColorPicker.pas"/>
|
||||
<UnitName Value="SLColorPicker"/>
|
||||
</Item30>
|
||||
<Item31>
|
||||
</Item28>
|
||||
<Item29>
|
||||
<Filename Value="SLHColorPicker.pas"/>
|
||||
<UnitName Value="SLHColorPicker"/>
|
||||
</Item31>
|
||||
<Item32>
|
||||
</Item29>
|
||||
<Item30>
|
||||
<Filename Value="HSVColorPicker.pas"/>
|
||||
<UnitName Value="HSVColorPicker"/>
|
||||
</Item32>
|
||||
<Item33>
|
||||
</Item30>
|
||||
<Item31>
|
||||
<Filename Value="SelPropUtils.pas"/>
|
||||
<UnitName Value="SelPropUtils"/>
|
||||
</Item33>
|
||||
<Item34>
|
||||
</Item31>
|
||||
<Item32>
|
||||
<Filename Value="mbOfficeColorDialog.pas"/>
|
||||
<UnitName Value="mbOfficeColorDialog"/>
|
||||
</Item34>
|
||||
<Item35>
|
||||
</Item32>
|
||||
<Item33>
|
||||
<Filename Value="OfficeMoreColorsDialog.pas"/>
|
||||
<UnitName Value="OfficeMoreColorsDialog"/>
|
||||
</Item35>
|
||||
<Item36>
|
||||
</Item33>
|
||||
<Item34>
|
||||
<Filename Value="HSLColorPicker.pas"/>
|
||||
<UnitName Value="HSLColorPicker"/>
|
||||
</Item36>
|
||||
<Item37>
|
||||
</Item34>
|
||||
<Item35>
|
||||
<Filename Value="mbColorPalette.pas"/>
|
||||
<UnitName Value="mbColorPalette"/>
|
||||
</Item37>
|
||||
<Item38>
|
||||
</Item35>
|
||||
<Item36>
|
||||
<Filename Value="CColorPicker.pas"/>
|
||||
<UnitName Value="CColorPicker"/>
|
||||
</Item38>
|
||||
<Item39>
|
||||
</Item36>
|
||||
<Item37>
|
||||
<Filename Value="SColorPicker.pas"/>
|
||||
<UnitName Value="SColorPicker"/>
|
||||
</Item39>
|
||||
<Item40>
|
||||
</Item37>
|
||||
<Item38>
|
||||
<Filename Value="mbDeskPickerButton.pas"/>
|
||||
<UnitName Value="mbDeskPickerButton"/>
|
||||
</Item40>
|
||||
<Item41>
|
||||
</Item38>
|
||||
<Item39>
|
||||
<Filename Value="ScreenWin.pas"/>
|
||||
<UnitName Value="ScreenWin"/>
|
||||
</Item41>
|
||||
<Item42>
|
||||
</Item39>
|
||||
<Item40>
|
||||
<Filename Value="mbColorTree.pas"/>
|
||||
<UnitName Value="mbColorTree"/>
|
||||
</Item42>
|
||||
<Item43>
|
||||
</Item40>
|
||||
<Item41>
|
||||
<Filename Value="HSLRingPicker.pas"/>
|
||||
<UnitName Value="HSLRingPicker"/>
|
||||
</Item43>
|
||||
<Item44>
|
||||
</Item41>
|
||||
<Item42>
|
||||
<Filename Value="mbBasicPicker.pas"/>
|
||||
<UnitName Value="mbBasicPicker"/>
|
||||
</Item44>
|
||||
<Item45>
|
||||
</Item42>
|
||||
<Item43>
|
||||
<Filename Value="mbutils.pas"/>
|
||||
<UnitName Value="mbUtils"/>
|
||||
</Item45>
|
||||
<Item46>
|
||||
</Item43>
|
||||
<Item44>
|
||||
<Filename Value="mbReg.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<AddToUsesPkgSection Value="False"/>
|
||||
<UnitName Value="mbReg"/>
|
||||
</Item46>
|
||||
<Item47>
|
||||
</Item44>
|
||||
<Item45>
|
||||
<Filename Value="mbcolorconv.pas"/>
|
||||
<UnitName Value="mbcolorconv"/>
|
||||
</Item47>
|
||||
<Item48>
|
||||
</Item45>
|
||||
<Item46>
|
||||
<Filename Value="LVColorPicker.pas"/>
|
||||
<UnitName Value="LVColorPicker"/>
|
||||
</Item48>
|
||||
</Item46>
|
||||
</Files>
|
||||
<RequiredPkgs Count="3">
|
||||
<Item1>
|
||||
|
Reference in New Issue
Block a user