mbColorLib: Move Demo to folder "examples" (renamed as "fulldemo"). Add another example "trackbars".

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5463 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-12-12 00:15:08 +00:00
parent 1accce10f1
commit cecf6d3ca1
13 changed files with 1049 additions and 6 deletions

View File

@ -1,4 +0,0 @@
[InternetShortcut]
URL=http://mxs.bergsoft.net
IconIndex=1
IconFile="D:\Prog_Lazarus\svn\lazarus-ccr\components\mbColorLib\Demo\Demo.exe"

View File

@ -59,6 +59,9 @@
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Demo"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<TextName Value="CompanyName.ProductName.AppName"/>
<TextDesc Value="Your application description."/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="mbColorLibLaz"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="Demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="Demo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,21 @@
program Demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,606 @@
object Form1: TForm1
Left = 280
Height = 429
Top = 130
Width = 400
Caption = 'Form1'
ClientHeight = 429
ClientWidth = 400
OnCreate = FormCreate
ShowHint = True
LCLVersion = '1.7'
object PageControl1: TPageControl
Left = 0
Height = 429
Top = 0
Width = 400
ActivePage = tabHorizontal
Align = alClient
Anchors = [akTop, akRight]
TabIndex = 1
TabOrder = 0
object tabVertical: TTabSheet
Caption = 'vertical'
ClientHeight = 401
ClientWidth = 392
object Panel1: TPanel
Left = 0
Height = 401
Top = 0
Width = 392
Align = alClient
BevelOuter = bvNone
ClientHeight = 401
ClientWidth = 392
Color = clForm
ParentColor = False
TabOrder = 0
object HSLVv: TmbColorPreview
Left = 286
Height = 60
Top = 329
Width = 73
Anchors = [akLeft, akBottom]
end
object Bevel4: TBevel
Left = 264
Height = 469
Top = 8
Width = 8
Anchors = [akTop, akLeft, akRight]
Shape = bsLeftLine
end
object CMYKv: TmbColorPreview
Left = 136
Height = 60
Top = 329
Width = 107
Anchors = [akLeft, akBottom]
end
object Bevel3: TBevel
Left = 112
Height = 469
Top = 8
Width = 8
Anchors = [akTop, akLeft, akRight]
Shape = bsLeftLine
end
object RGBv: TmbColorPreview
Left = 12
Height = 60
Top = 329
Width = 75
Anchors = [akLeft, akBottom]
end
object rbHSVv: TRadioButton
Left = 328
Height = 19
Top = 305
Width = 42
Anchors = [akLeft, akBottom]
Caption = 'HSV'
OnChange = rbHSLv_Change
TabOrder = 3
end
object rbHSLv: TRadioButton
Left = 280
Height = 19
Top = 305
Width = 41
Anchors = [akLeft, akBottom]
Caption = 'HSL'
Checked = True
OnChange = rbHSLv_Change
TabOrder = 4
TabStop = True
end
object lblLVv: TLabel
Left = 352
Height = 15
Top = 8
Width = 6
Caption = 'L'
ParentColor = False
end
object Label9: TLabel
Left = 320
Height = 15
Top = 8
Width = 6
Caption = 'S'
ParentColor = False
end
object Label8: TLabel
Left = 288
Height = 15
Top = 8
Width = 9
Caption = 'H'
ParentColor = False
end
object Label7: TLabel
Left = 232
Height = 15
Top = 8
Width = 7
Caption = 'K'
ParentColor = False
end
object Label6: TLabel
Left = 200
Height = 15
Top = 8
Width = 7
Caption = 'Y'
ParentColor = False
end
object Label5: TLabel
Left = 168
Height = 15
Top = 8
Width = 11
Caption = 'M'
ParentColor = False
end
object Label4: TLabel
Left = 136
Height = 15
Top = 8
Width = 8
Caption = 'C'
ParentColor = False
end
object Label3: TLabel
Left = 77
Height = 15
Top = 8
Width = 7
Caption = 'B'
ParentColor = False
end
object Label2: TLabel
Left = 45
Height = 15
Top = 8
Width = 8
Caption = 'G'
ParentColor = False
end
object Label1: TLabel
Left = 13
Height = 15
Top = 8
Width = 7
Caption = 'R'
ParentColor = False
end
object VColorPickerV: TVColorPicker
Left = 368
Height = 278
Top = 24
Width = 22
HintFormat = 'Value: %value'
Layout = lyVertical
Visible = False
TabOrder = 5
OnChange = SLVPickerV_Change
SelectedColor = clWhite
end
object LColorPickerV: TLColorPicker
Left = 350
Height = 278
Top = 24
Width = 22
HintFormat = 'Luminance: %value'
Layout = lyVertical
Anchors = [akTop, akLeft, akBottom]
TabOrder = 6
OnChange = SLVPickerV_Change
Saturation = 255
Luminance = 127
SelectedColor = 254
end
object HColorPickerV: THColorPicker
Left = 288
Height = 278
Top = 24
Width = 22
HintFormat = 'Hue: %value'
Layout = lyVertical
Anchors = [akTop, akLeft, akBottom]
TabOrder = 7
OnChange = HPickerV_Change
end
object KColorPickerV: TKColorPicker
Left = 232
Height = 296
Top = 24
Width = 22
HintFormat = 'Black: %value'
Anchors = [akTop, akLeft, akBottom]
TabOrder = 8
OnChange = CMYKPickerV_Change
Cyan = 0
Black = 255
SelectedColor = clBlack
end
object YColorPickerV: TYColorPicker
Left = 200
Height = 296
Top = 24
Width = 22
HintFormat = 'Yellow: %value'
Anchors = [akTop, akLeft, akBottom]
TabOrder = 9
OnChange = CMYKPickerV_Change
SelectedColor = clYellow
end
object MColorPickerV: TMColorPicker
Left = 168
Height = 296
Top = 24
Width = 22
HintFormat = 'Magenta: %value'
Anchors = [akTop, akLeft, akBottom]
TabOrder = 10
OnChange = CMYKPickerV_Change
SelectedColor = clFuchsia
end
object CColorPickerV: TCColorPicker
Left = 136
Height = 296
Top = 24
Width = 22
HintFormat = 'Cyan: %value'
Anchors = [akTop, akLeft, akBottom]
TabOrder = 11
OnChange = CMYKPickerV_Change
SelectedColor = clAqua
end
object RColorPickerV: TRColorPicker
Left = 12
Height = 296
Top = 24
Width = 22
HintFormat = 'Red: %value'
Anchors = [akTop, akLeft, akBottom]
TabOrder = 12
OnChange = RGBPickerV_Change
Green = 0
Blue = 0
end
object GColorPickerV: TGColorPicker
Left = 45
Height = 296
Top = 24
Width = 22
HintFormat = 'Green: %value'
Anchors = [akTop, akLeft, akBottom]
TabOrder = 13
OnChange = RGBPickerV_Change
Red = 0
Blue = 0
SelectedColor = clLime
end
object BColorPickerV: TBColorPicker
Left = 76
Height = 296
Top = 24
Width = 22
HintFormat = 'Blue: %value'
Anchors = [akTop, akLeft, akBottom]
TabOrder = 14
OnChange = RGBPickerV_Change
Red = 0
Green = 0
SelectedColor = clBlue
end
object SColorPickerV: TSColorPicker
Left = 318
Height = 278
Top = 24
Width = 22
HintFormat = 'Saturation: %value'
Layout = lyVertical
Anchors = [akTop, akLeft, akBottom]
TabOrder = 15
OnChange = SLVPickerV_Change
end
end
end
object tabHorizontal: TTabSheet
Caption = 'horizontal'
ClientHeight = 401
ClientWidth = 392
object Panel2: TPanel
Left = 0
Height = 401
Top = 0
Width = 392
Align = alClient
BevelOuter = bvNone
ClientHeight = 401
ClientWidth = 392
Color = clForm
ParentColor = False
TabOrder = 0
object Bevel1: TBevel
Left = 1
Height = 11
Top = 114
Width = 386
Anchors = [akTop, akLeft, akRight]
Shape = bsTopLine
end
object Bevel2: TBevel
Left = -1
Height = 11
Top = 256
Width = 386
Anchors = [akTop, akLeft, akRight]
Shape = bsTopLine
end
object rbHSVh: TRadioButton
Left = 72
Height = 19
Top = 376
Width = 42
Caption = 'HSV'
OnChange = rbHSLh_Change
TabOrder = 0
end
object rbHSLh: TRadioButton
Left = 24
Height = 19
Top = 376
Width = 41
Caption = 'HSL'
Checked = True
OnChange = rbHSLh_Change
TabOrder = 1
TabStop = True
end
object HSLVh: TmbColorPreview
Left = 329
Height = 86
Top = 282
Width = 46
Anchors = [akTop, akRight]
end
object CMYKh: TmbColorPreview
Left = 329
Height = 110
Top = 128
Width = 46
Anchors = [akTop, akRight]
end
object RGBh: TmbColorPreview
Left = 329
Height = 77
Top = 16
Width = 46
Anchors = [akTop, akRight]
end
object lblLVh: TLabel
Left = 8
Height = 15
Top = 346
Width = 6
Caption = 'L'
ParentColor = False
end
object Label20: TLabel
Left = 8
Height = 15
Top = 314
Width = 6
Caption = 'S'
ParentColor = False
end
object Label19: TLabel
Left = 8
Height = 15
Top = 282
Width = 9
Caption = 'H'
ParentColor = False
end
object Label18: TLabel
Left = 8
Height = 15
Top = 224
Width = 7
Caption = 'K'
ParentColor = False
end
object Label17: TLabel
Left = 8
Height = 15
Top = 160
Width = 11
Caption = 'M'
ParentColor = False
end
object Label16: TLabel
Left = 7
Height = 15
Top = 192
Width = 7
Caption = 'Y'
ParentColor = False
end
object Label15: TLabel
Left = 8
Height = 15
Top = 128
Width = 8
Caption = 'C'
ParentColor = False
end
object Label14: TLabel
Left = 8
Height = 15
Top = 81
Width = 7
Caption = 'B'
ParentColor = False
end
object Label13: TLabel
Left = 8
Height = 15
Top = 44
Width = 8
Caption = 'G'
ParentColor = False
end
object Label12: TLabel
Left = 8
Height = 15
Top = 15
Width = 7
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
SelectedColor = clWhite
end
object LColorPickerH: TLColorPicker
Left = 24
Height = 22
Top = 344
Width = 301
BevelInner = bvLowered
HintFormat = 'Luminance: %value'
Anchors = [akTop, akLeft, akRight]
TabOrder = 6
OnChange = SLVPickerH_Change
Saturation = 255
Luminance = 127
SelectedColor = 254
end
object SColorPickerH: TSColorPicker
Left = 24
Height = 22
Top = 312
Width = 301
BevelOuter = bvLowered
HintFormat = 'Saturation: %value'
Anchors = [akTop, akLeft, akRight]
TabOrder = 7
OnChange = SLVPickerH_Change
end
object HColorPickerH: THColorPicker
Left = 24
Height = 22
Top = 282
Width = 301
BevelOuter = bvLowered
HintFormat = 'Hue: %value'
Anchors = [akTop, akLeft, akRight]
TabOrder = 8
OnChange = HPickerH_Change
end
object KColorPickerH: TKColorPicker
Left = 24
Height = 22
Top = 224
Width = 301
HintFormat = 'Black: %value'
Layout = lyHorizontal
Anchors = [akTop, akLeft, akRight]
TabOrder = 9
OnChange = CMYKPickerH_Change
Cyan = 0
Black = 255
SelectedColor = clBlack
end
object MColorPickerH: TMColorPicker
Left = 24
Height = 22
Top = 160
Width = 301
HintFormat = 'Magenta: %value'
Layout = lyHorizontal
Anchors = [akTop, akLeft, akRight]
TabOrder = 10
OnChange = CMYKPickerH_Change
SelectedColor = clFuchsia
end
object YColorPickerH: TYColorPicker
Left = 24
Height = 22
Top = 192
Width = 301
HintFormat = 'Yellow: %value'
Layout = lyHorizontal
Anchors = [akTop, akLeft, akRight]
TabOrder = 11
OnChange = CMYKPickerH_Change
SelectedColor = clYellow
end
object CColorPickerH: TCColorPicker
Left = 24
Height = 22
Top = 128
Width = 301
HintFormat = 'Cyan: %value'
Layout = lyHorizontal
Anchors = [akTop, akLeft, akRight]
TabOrder = 12
OnChange = CMYKPickerH_Change
SelectedColor = clAqua
end
object BColorPickerH: TBColorPicker
Left = 24
Height = 22
Top = 80
Width = 301
HintFormat = 'Blue: %value'
Layout = lyHorizontal
Anchors = [akTop, akLeft, akRight]
TabOrder = 13
OnChange = RGBPickerH_Change
Red = 0
Green = 0
SelectedColor = clBlue
end
object GColorPickerH: TGColorPicker
Left = 24
Height = 22
Top = 48
Width = 301
HintFormat = 'Green: %value'
Layout = lyHorizontal
Anchors = [akTop, akLeft, akRight]
TabOrder = 14
OnChange = RGBPickerH_Change
Red = 0
Blue = 0
SelectedColor = clLime
end
object RColorPickerH: TRColorPicker
Left = 24
Height = 22
Top = 16
Width = 301
HintFormat = 'Red: %value'
Layout = lyHorizontal
Anchors = [akTop, akLeft, akRight]
TabOrder = 15
OnChange = RGBPickerH_Change
Green = 0
Blue = 0
end
end
end
end
end

View File

@ -0,0 +1,332 @@
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
StdCtrls, ExtCtrls, BColorPicker, GColorPicker, RColorPicker, CColorPicker,
YColorPicker, MColorPicker, KColorPicker, HColorPicker, SColorPicker,
LColorPicker, VColorPicker, mbColorPreview;
type
{ TForm1 }
TForm1 = class(TForm)
BColorPickerV: TBColorPicker;
BColorPickerH: TBColorPicker;
Bevel1: TBevel;
Bevel2: TBevel;
Bevel3: TBevel;
Bevel4: TBevel;
CColorPickerH: TCColorPicker;
CColorPickerV: TCColorPicker;
GColorPickerV: TGColorPicker;
GColorPickerH: TGColorPicker;
HColorPickerH: THColorPicker;
HColorPickerV: THColorPicker;
KColorPickerH: TKColorPicker;
KColorPickerV: TKColorPicker;
Label1: TLabel;
lblLVv: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label2: TLabel;
Label20: TLabel;
lblLVh: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
LColorPickerH: TLColorPicker;
LColorPickerV: TLColorPicker;
CMYKh: TmbColorPreview;
HSLVh: TmbColorPreview;
Panel1: TPanel;
Panel2: TPanel;
RGBv: TmbColorPreview;
CMYKv: TmbColorPreview;
HSLVv: TmbColorPreview;
rbHSLv: TRadioButton;
rbHSVv: TRadioButton;
rbHSVh: TRadioButton;
rbHSLh: TRadioButton;
RGBh: TmbColorPreview;
MColorPickerH: TMColorPicker;
MColorPickerV: TMColorPicker;
PageControl1: TPageControl;
RColorPickerV: TRColorPicker;
RColorPickerH: TRColorPicker;
SColorPickerH: TSColorPicker;
SColorPickerV: TSColorPicker;
tabVertical: TTabSheet;
tabHorizontal: TTabSheet;
VColorPickerH: TVColorPicker;
VColorPickerV: TVColorPicker;
YColorPickerH: TYColorPicker;
YColorPickerV: TYColorPicker;
procedure CMYKPickerV_Change(Sender: TObject);
procedure CMYKPickerH_Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure HPickerH_Change(Sender: TObject);
procedure HPickerV_Change(Sender: TObject);
procedure rbHSLv_Change(Sender: TObject);
procedure rbHSLh_Change(Sender: TObject);
procedure RGBPickerH_Change(Sender: TObject);
procedure RGBPickerV_Change(Sender: TObject);
procedure SLVPickerH_Change(Sender: TObject);
procedure SLVPickerV_Change(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses
LCLType, LCLIntf, ScanLines, RGBCMYKUtils, RGBHSLUtils, RGBHSVUtils;
{ TForm1 }
procedure TForm1.CMYKPickerH_Change(Sender: TObject);
var
c: TColor;
begin
if (CColorPickerH = nil) or (YColorPickerH = nil) or (MColorPickerH = nil) or
(KColorPickerH = nil) or (CMYKh = nil) then
exit;
CMYKh.Color := CMYKToTColor(
CColorPickerH.Cyan,
MColorPickerH.Magenta,
YColorPickerH.Yellow,
KColorPickerH.Black
);
c := CMYKh.Color;
CMYKh.Hint := Format('Red: %d - Green: %d - Blue: %d'#13 +
'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)
]);
end;
procedure TForm1.CMYKPickerV_Change(Sender: TObject);
var
c: TColor;
begin
if (CColorPickerV = nil) or (YColorPickerV = nil) or (MColorPickerV = nil) or
(KColorPickerV = nil) or (CMYKv = nil) then
exit;
CMYKv.Color := CMYKToTColor(
CColorPickerV.Cyan,
MColorPickerV.Magenta,
YColorPickerV.Yellow,
KColorPickerV.Black
);
c := CMYKv.Color;
CMYKv.Hint := Format('Red: %d - Green: %d - Blue: %d'#13 +
'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)
]);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
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);
RGBPickerV_Change(nil);
CMYKPickerV_Change(nil);
SLVPickerV_Change(nil);
end;
procedure TForm1.HPickerH_Change(Sender: TObject);
begin
SLVPickerH_Change(nil);
SColorPickerH.Hue := HColorPickerH.Hue;
LColorPickerH.Hue := HColorPickerH.Hue;
VColorPickerH.Hue := HColorPickerH.Hue;
end;
procedure TForm1.HPickerV_Change(Sender: TObject);
begin
SLVPickerV_Change(nil);
SColorPickerV.Hue := HColorPickerV.Hue;
LColorPickerV.Hue := HColorPickerV.Hue;
VColorPickerV.Hue := HColorPickerV.Hue;
end;
procedure TForm1.rbHSLv_Change(Sender: TObject);
begin
if rbHSLv.Checked then
begin
lblLVv.Caption := 'L';
VColorPickerV.Visible := false;
LColorPickerV.Visible := true;
end;
if rbHSVv.Checked then
begin
lblLVv.Caption := 'V';
LColorPickerV.Visible := false;
VColorPickerV.Visible := true;
end;
HPickerV_Change(nil);
end;
procedure TForm1.rbHSLh_Change(Sender: TObject);
begin
if rbHSLh.Checked then
begin
lblLVh.Caption := 'L';
VColorPickerH.Visible := false;
LColorPickerH.Visible := true;
end;
if rbHSVh.Checked then
begin
lblLVh.Caption := 'V';
lColorPickerH.Visible := false;
VColorPickerH.Visible := true;
end;
HPickerH_Change(nil);
end;
procedure TForm1.RGBPickerH_Change(Sender: TObject);
var
c: TColor;
begin
if (RColorPickerH = nil) or (GColorPickerH = nil) or (BColorPickerH = nil) or (RGBh = nil) then
exit;
RGBh.Color := RGBToColor(
RColorPickerH.Red,
GColorPickerH.Green,
BColorPickerH.Blue
);
c := RGBh.Color;
RGBh.Hint := Format('Red: %d - Green: %d - Blue: %d'#13 +
'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)
]);
end;
procedure TForm1.RGBPickerV_Change(Sender: TObject);
var
c: TColor;
begin
if (RColorPickerV = nil) or (GColorPickerV = nil) or (BColorPickerV = nil) or (RGBv = nil) then
exit;
RGBv.Color := RGBToColor(
RColorPickerV.Red,
GColorPickerV.Green,
BColorPickerV.Blue
);
c := RGBv.Color;
RGBv.Hint := Format('Red: %d - Green: %d - Blue: %d'#13 +
'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)
]);
end;
procedure TForm1.SLVPickerH_Change(Sender: TObject);
var
triple: TRGBTriple;
c: TColor;
begin
if (HSLVh = nil) or (HColorPickerH = nil) or (SColorPickerH = nil) then
exit;
if rbHSLh.Checked then begin
if (LColorPickerH = nil) then
exit;
triple := HSLToRGBTriple(HColorPickerH.Hue, SColorPickerH.Saturation, LColorPickerH.Luminance);
HSLVh.Color := RGBTripleToTColor(triple);
// HSLVh.Color := HSLRangetoRGB(HColorPickerH.Hue, SColorPickerH.Saturation, LColorPickerH.Luminance);
end;
if rbHSVh.Checked then begin
if (VColorPickerH = nil) then
exit;
HSLVh.Color := HSVtoColor(HColorPickerH.Hue, SColorPickerH.Saturation, VColorPickerH.Value);
end;
c := HSLVh.Color;
HSLVh.Hint := Format('Red: %d - Green: %d - Blue: %d'#13 +
'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)
]);
end;
procedure TForm1.SLVPickerV_Change(Sender: TObject);
var
triple: TRGBTriple;
c: TColor;
begin
if (HSLVv = nil) or (HColorPickerV = nil) or (SColorPickerV = nil) then
exit;
if rbHSLv.Checked then begin
if (LColorPickerV = nil) then
exit;
triple := HSLToRGBTriple(HColorPickerV.Hue, SColorPickerV.Saturation, LColorPickerV.Luminance);
HSLVv.Color := RGBTripleToTColor(triple);
end;
if rbHSVv.Checked then begin
if (VColorPickerV = nil) then
exit;
HSLVv.Color := HSVtoColor(HColorPickerV.Hue, SColorPickerV.Saturation, VColorPickerV.Value);
end;
c := HSLVv.Color;
HSLVv.Hint := Format('Red: %d - Green: %d - Blue: %d'#13 +
'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)
]);
end;
end.

View File

@ -799,8 +799,8 @@ begin
end;
{ IMPORTANT: If pickers are created at designtime the layout must be set before
defining the picker width and height because using a non-default layout will
flip the bounding rectangle !!! }
defining the picker width and height because changing the layout will flip the
bounding rectangle !!! }
procedure TmbTrackBarPicker.SetLayout(Value: TTrackBarLayout);
begin
if FLayout <> Value then