variation preview depth added

This commit is contained in:
zueuk 2005-10-23 09:19:13 +00:00
parent 147dd59793
commit cf08a74f84
2 changed files with 48 additions and 19 deletions

View File

@ -1,8 +1,8 @@
object EditForm: TEditForm object EditForm: TEditForm
Left = 279 Left = 279
Top = 240 Top = 234
Width = 586 Width = 586
Height = 576 Height = 582
Caption = 'Transform Editor' Caption = 'Transform Editor'
Color = clBtnFace Color = clBtnFace
Constraints.MinHeight = 400 Constraints.MinHeight = 400
@ -54,7 +54,7 @@ object EditForm: TEditForm
TextHeight = 13 TextHeight = 13
object StatusBar: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Top = 527 Top = 539
Width = 578 Width = 578
Height = 15 Height = 15
Panels = < Panels = <
@ -289,14 +289,14 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 24 Top = 24
Width = 578 Width = 578
Height = 503 Height = 515
Align = alClient Align = alClient
TabOrder = 1 TabOrder = 1
object Splitter1: TSplitter object Splitter1: TSplitter
Left = 396 Left = 396
Top = 1 Top = 1
Width = 9 Width = 9
Height = 501 Height = 513
Align = alRight Align = alRight
AutoSnap = False AutoSnap = False
Beveled = True Beveled = True
@ -307,7 +307,7 @@ object EditForm: TEditForm
Left = 1 Left = 1
Top = 1 Top = 1
Width = 395 Width = 395
Height = 501 Height = 513
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
Color = clAppWorkSpace Color = clAppWorkSpace
@ -317,7 +317,7 @@ object EditForm: TEditForm
Left = 405 Left = 405
Top = 1 Top = 1
Width = 172 Width = 172
Height = 501 Height = 513
Align = alRight Align = alRight
Alignment = taLeftJustify Alignment = taLeftJustify
BevelOuter = bvNone BevelOuter = bvNone
@ -356,7 +356,7 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 138 Top = 138
Width = 172 Width = 172
Height = 363 Height = 375
Align = alClient Align = alClient
TabOrder = 0 TabOrder = 0
object lblTransform: TLabel object lblTransform: TLabel
@ -387,10 +387,10 @@ object EditForm: TEditForm
end end
object PageControl: TPageControl object PageControl: TPageControl
Left = 1 Left = 1
Top = 24 Top = 30
Width = 170 Width = 170
Height = 338 Height = 344
ActivePage = tabVariations ActivePage = TriangleTab
Align = alBottom Align = alBottom
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
MultiLine = True MultiLine = True
@ -402,7 +402,7 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 0 Top = 0
Width = 162 Width = 162
Height = 292 Height = 298
HorzScrollBar.Visible = False HorzScrollBar.Visible = False
VertScrollBar.Smooth = True VertScrollBar.Smooth = True
VertScrollBar.Style = ssFlat VertScrollBar.Style = ssFlat
@ -1279,7 +1279,7 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 0 Top = 0
Width = 162 Width = 162
Height = 292 Height = 298
Align = alClient Align = alClient
ScrollBars = ssVertical ScrollBars = ssVertical
TabOrder = 0 TabOrder = 0
@ -1484,7 +1484,7 @@ object EditForm: TEditForm
object trkVarPreviewDensity: TTrackBar object trkVarPreviewDensity: TTrackBar
Left = 8 Left = 8
Top = 184 Top = 184
Width = 129 Width = 65
Height = 25 Height = 25
Max = 5 Max = 5
Min = 1 Min = 1
@ -1504,6 +1504,7 @@ object EditForm: TEditForm
Height = 25 Height = 25
Min = 1 Min = 1
ParentShowHint = False ParentShowHint = False
PageSize = 1
Position = 2 Position = 2
ShowHint = True ShowHint = True
TabOrder = 8 TabOrder = 8
@ -1511,6 +1512,22 @@ object EditForm: TEditForm
ThumbLength = 15 ThumbLength = 15
OnChange = trkVarPreviewRangeChange OnChange = trkVarPreviewRangeChange
end end
object trkVarPreviewDepth: TTrackBar
Left = 72
Top = 184
Width = 65
Height = 25
Max = 5
Min = 1
ParentShowHint = False
PageSize = 1
Position = 1
ShowHint = True
TabOrder = 9
TabStop = False
ThumbLength = 15
OnChange = trkVarPreviewDepthChange
end
end end
end end
end end

View File

@ -157,6 +157,7 @@ type
trkVarPreviewRange: TTrackBar; trkVarPreviewRange: TTrackBar;
ToolButton2: TToolButton; ToolButton2: TToolButton;
tbVarPreview: TToolButton; tbVarPreview: TToolButton;
trkVarPreviewDepth: TTrackBar;
procedure ValidateVariable; procedure ValidateVariable;
procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string); procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string);
procedure vleVariablesKeyPress(Sender: TObject; var Key: Char); procedure vleVariablesKeyPress(Sender: TObject; var Key: Char);
@ -284,6 +285,7 @@ type
procedure tbVarPreviewClick(Sender: TObject); procedure tbVarPreviewClick(Sender: TObject);
procedure trkVarPreviewRangeChange(Sender: TObject); procedure trkVarPreviewRangeChange(Sender: TObject);
procedure trkVarPreviewDensityChange(Sender: TObject); procedure trkVarPreviewDensityChange(Sender: TObject);
procedure trkVarPreviewDepthChange(Sender: TObject);
private private
TriangleView: TCustomDrawControl; TriangleView: TCustomDrawControl;
@ -955,7 +957,7 @@ var
end; end;
end; end;
var var
i, tc: integer; i, n, tc: integer;
d, d1: double; d, d1: double;
tx, ty: double; tx, ty: double;
@ -1072,15 +1074,16 @@ begin
cp.xform[SelectedTriangle].prepare; cp.xform[SelectedTriangle].prepare;
//for i := 0 to Transforms-1 do cp.xform[i].prepare; //for i := 0 to Transforms-1 do cp.xform[i].prepare;
i := trkVarPreviewRange.position * trkVarPreviewDensity.position * 5; n := trkVarPreviewRange.position * trkVarPreviewDensity.position * 5;
d1 := trkVarPreviewDensity.position * 5; d1 := trkVarPreviewDensity.position * 5;
tc := GetTriangleColor(SelectedTriangle); tc := GetTriangleColor(SelectedTriangle);
for ax := -i to i do for ax := -n to n do
for ay := -i to i do for ay := -n to n do
begin begin
tx := ax / d1; tx := ax / d1;
ty := ay / d1; ty := ay / d1;
//cp.xform[random(Transforms)].nextpoint(tx,ty,d); //cp.xform[random(Transforms)].nextpoint(tx,ty,d);
for i := 1 to trkVarPreviewDepth.position do
cp.xform[SelectedTriangle].NextPoint(tx, ty, d); // d used as dummy var cp.xform[SelectedTriangle].NextPoint(tx, ty, d); // d used as dummy var
a := toscreen(tx,-ty); a := toscreen(tx,-ty);
Pixels[a.x, a.Y] := {Pixels[a.x, a.Y] xor} tc;//$ffffff; Pixels[a.x, a.Y] := {Pixels[a.x, a.Y] xor} tc;//$ffffff;
@ -1873,6 +1876,8 @@ begin
trkVarPreviewRange.Position := Registry.ReadInteger('VariationPreviewRange'); trkVarPreviewRange.Position := Registry.ReadInteger('VariationPreviewRange');
if Registry.ValueExists('VariationPreviewDensity') then if Registry.ValueExists('VariationPreviewDensity') then
trkVarPreviewDensity.Position := Registry.ReadInteger('VariationPreviewDensity'); trkVarPreviewDensity.Position := Registry.ReadInteger('VariationPreviewDensity');
if Registry.ValueExists('VariationPreviewDepth') then
trkVarPreviewDepth.Position := Registry.ReadInteger('VariationPreviewDepth');
end end
else begin else begin
UseTransformColors := False; UseTransformColors := False;
@ -2175,6 +2180,7 @@ begin
Registry.WriteBool('VariationPreview', tbVarPreview.Down); Registry.WriteBool('VariationPreview', tbVarPreview.Down);
Registry.WriteInteger('VariationPreviewRange', trkVarPreviewRange.Position); Registry.WriteInteger('VariationPreviewRange', trkVarPreviewRange.Position);
Registry.WriteInteger('VariationPreviewDensity', trkVarPreviewDensity.Position); Registry.WriteInteger('VariationPreviewDensity', trkVarPreviewDensity.Position);
Registry.WriteInteger('VariationPreviewDepth', trkVarPreviewDepth.Position);
{ Size and position } { Size and position }
if EditForm.WindowState <> wsMaximized then begin if EditForm.WindowState <> wsMaximized then begin
Registry.WriteInteger('Top', EditForm.Top); Registry.WriteInteger('Top', EditForm.Top);
@ -3520,5 +3526,11 @@ begin
TriangleView.Invalidate; TriangleView.Invalidate;
end; end;
procedure TEditForm.trkVarPreviewDepthChange(Sender: TObject);
begin
trkVarPreviewDepth.Hint := Format('Depth: %d', [trkVarPreviewDepth.position]);
TriangleView.Invalidate;
end;
end. end.