get ready :-) mega commit approaching!

well, enough changes to release 2.03c... I think ;)
This commit is contained in:
zueuk 2005-12-30 13:04:49 +00:00
parent da95c740bb
commit 45d5a60086
22 changed files with 2024 additions and 1060 deletions

View File

@ -1866,7 +1866,7 @@ object AboutForm: TAboutForm
object Label1: TLabel
Left = 120
Top = 8
Width = 137
Width = 131
Height = 36
Caption = 'Apophysis'
Font.Charset = ANSI_CHARSET
@ -1877,11 +1877,11 @@ object AboutForm: TAboutForm
ParentFont = False
end
object Label2: TLabel
Left = 260
Left = 268
Top = 24
Width = 65
Width = 58
Height = 13
Caption = 'Version 2.03b'
Caption = 'version 2.03'
end
object Label3: TLabel
Left = 120

View File

@ -4,7 +4,7 @@ object AdjustForm: TAdjustForm
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Adjust'
ClientHeight = 264
ClientHeight = 263
ClientWidth = 390
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@ -172,7 +172,7 @@ object AdjustForm: TAdjustForm
Left = 0
Top = 133
Width = 390
Height = 131
Height = 130
ActivePage = TabSheet1
Align = alBottom
TabOrder = 1
@ -331,13 +331,12 @@ object AdjustForm: TAdjustForm
Caption = 'Rendering'
ImageIndex = 1
object lblContrast: TLabel
Left = 8
Left = 4
Top = 80
Width = 93
Width = 69
Height = 13
Alignment = taRightJustify
AutoSize = False
Caption = 'Background color:'
Caption = 'Background'
end
object btnGamma: TSpeedButton
Left = 4
@ -375,6 +374,13 @@ object AdjustForm: TAdjustForm
ShowHint = True
OnClick = btnVibrancyClick
end
object Label1: TLabel
Left = 236
Top = 80
Width = 62
Height = 13
Caption = 'Master Scale'
end
object scrollGamma: TScrollBar
Left = 72
Top = 7
@ -446,9 +452,9 @@ object AdjustForm: TAdjustForm
OnKeyPress = txtVibrancyKeyPress
end
object ColorPanel: TPanel
Left = 112
Left = 72
Top = 78
Width = 113
Width = 65
Height = 21
Cursor = crHandPoint
BevelOuter = bvLowered
@ -456,31 +462,24 @@ object AdjustForm: TAdjustForm
TabOrder = 6
OnClick = ColorPanelClick
end
object cbColor: TComboBox
Left = 232
Top = 78
Width = 59
Height = 21
Enabled = False
ItemHeight = 13
ItemIndex = 0
TabOrder = 7
Text = '000000'
Visible = False
Items.Strings = (
'000000'
'FFFFFF')
end
object chkTransparent: TCheckBox
Left = 296
Left = 144
Top = 80
Width = 81
Height = 17
Caption = 'Transparent'
Enabled = False
TabOrder = 8
TabOrder = 7
Visible = False
end
object editPPU: TEdit
Left = 304
Top = 76
Width = 75
Height = 21
TabOrder = 8
OnKeyPress = editPPUKeyPress
end
end
object TabSheet3: TTabSheet
Caption = 'Gradient'
@ -674,7 +673,7 @@ object AdjustForm: TAdjustForm
Left = 0
Top = 0
Width = 382
Height = 45
Height = 49
Align = alTop
BevelOuter = bvLowered
Color = clAppWorkSpace
@ -683,7 +682,7 @@ object AdjustForm: TAdjustForm
Left = 1
Top = 1
Width = 380
Height = 43
Height = 47
Cursor = crHandPoint
Align = alClient
PopupMenu = GradientPopup

View File

@ -61,7 +61,6 @@ type
txtVibrancy: TEdit;
ColorPanel: TPanel;
TabSheet3: TTabSheet;
cbColor: TComboBox;
scrollAngle: TScrollBar;
txtAngle: TEdit;
btnZoom: TSpeedButton;
@ -131,6 +130,8 @@ type
Bevel2: TBevel;
N8: TMenuItem;
mnuInstantPreview: TMenuItem;
Label1: TLabel;
editPPU: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
@ -248,6 +249,7 @@ type
procedure btnColorPresetClick(Sender: TObject);
procedure btnApplySizeClick(Sender: TObject);
procedure mnuInstantPreviewClick(Sender: TObject);
procedure editPPUKeyPress(Sender: TObject; var Key: Char);
private
Resetting: boolean;
@ -337,7 +339,7 @@ begin
PreviewImage.Top := 1;
PreviewImage.Left := (pw - PreviewImage.Width) div 2;
end;
AdjustScale(cp, PreviewImage.Width, PreviewImage.Height);
cp.AdjustScale(PreviewImage.Width, PreviewImage.Height);
cp.cmap := MainCp.cmap;
@ -361,7 +363,7 @@ begin
end;
ColorPanel.color := cp.background[2] shl 16 + cp.background[1] shl 8 + cp.background[0];
cbColor.text := IntToHex(integer(ColorPanel.Color), 6);
//cbColor.text := IntToHex(integer(ColorPanel.Color), 6);
GetMainWindowSize;
@ -373,7 +375,7 @@ begin
BackupPal := cp.cmap;
Resetting := False;
editPPU.Text := FloatToStr(cp.pixels_per_unit);
end; //***
DrawPreview;
end;
@ -532,7 +534,14 @@ begin
Preset[i].Width := 512;
Preset[i].Height := 384;
end;
end;
end
else
for i:=1 to 3 do begin
Preset[i].Left := MainForm.Left;
Preset[i].Top := MainForm.Top;
Preset[i].Width := 512;
Preset[i].Height := 384;
end;
Registry.CloseKey;
finally
Registry.Free;
@ -898,7 +907,7 @@ begin
if ColorDialog.Execute then
begin
ColorPanel.Color := ColorDialog.Color;
cbColor.text := IntToHex(integer(ColorDialog.Color), 6);
//cbColor.text := IntToHex(integer(ColorDialog.Color), 6);
col := ColorToRGB(ColorDialog.Color);
cp.background[0] := col and 255;
cp.background[1] := col shr 8 and 255;
@ -1862,7 +1871,7 @@ end;
procedure TAdjustForm.btnColorPresetClick(Sender: TObject);
begin
cmbPalette.ItemIndex := random(701);
cmbPalette.ItemIndex := Random(NRCMAPS);
cmbPaletteChange(Sender);
end;
@ -1876,5 +1885,23 @@ begin
mnuInstantPreview.Checked := not mnuInstantPreview.Checked;
end;
procedure TAdjustForm.editPPUKeyPress(Sender: TObject; var Key: Char);
var
t: double;
begin
if key=#13 then
begin
key := #0;
try
t:=strtofloat(editPPU.Text);
except
exit;
end;
MainForm.UpdateUndo;
cp.pixels_per_unit:=t;
UpdateFlame;
end;
end;
end.

View File

@ -56,7 +56,7 @@ begin
end;
///////////////////////////////////////////////////////////////////////////////
procedure TBaseVariation.prepare;
procedure TBaseVariation.Prepare;
begin
end;

View File

@ -156,11 +156,12 @@ type
// CP-specific functions moved from unit Main
function NumXForms: integer;
function TrianglesFromCP(var Triangles: TTriangles): integer;
procedure GetFromTriangles(const Triangles: TTriangles; const t: integer);
procedure EqualizeWeights;
procedure NormalizeWeights;
procedure RandomizeWeights;
procedure ComputeWeights(Triangles: TTriangles; t: integer);
procedure GetFromTriangles(const Triangles: TTriangles; const t: integer);
procedure AdjustScale(w, h: integer);
constructor Create;
destructor Destroy; override;
@ -272,7 +273,7 @@ begin
end;
LoopValue := 0;
for i := 0 to 1023 do begin
for i := 0 to PROP_TABLE_SIZE-1 do begin
propsum := 0;
j := -1;
repeat
@ -726,6 +727,7 @@ var
CurrentXForm: integer;
i: integer;
OldDecimalSperator: Char;
v: double;
begin
ParseValues := TStringList.Create;
ParseValues.CommaText := AString;
@ -871,7 +873,20 @@ begin
xform[CurrentXForm].c[2, 0] := StrToFloat(ParseValues[ParsePos]);
Inc(ParsePos);
xform[CurrentXForm].c[2, 1] := StrToFloat(ParseValues[ParsePos]);
end else if AnsiCompareText(CurrentToken, 'var') = 0 then begin
end else if AnsiCompareText(CurrentToken, 'post') = 0 then begin
Inc(ParsePos);
xform[CurrentXForm].p[0, 0] := StrToFloat(ParseValues[ParsePos]);
Inc(ParsePos);
xform[CurrentXForm].p[0, 1] := StrToFloat(ParseValues[ParsePos]);
Inc(ParsePos);
xform[CurrentXForm].p[1, 0] := StrToFloat(ParseValues[ParsePos]);
Inc(ParsePos);
xform[CurrentXForm].p[1, 1] := StrToFloat(ParseValues[ParsePos]);
Inc(ParsePos);
xform[CurrentXForm].p[2, 0] := StrToFloat(ParseValues[ParsePos]);
Inc(ParsePos);
xform[CurrentXForm].p[2, 1] := StrToFloat(ParseValues[ParsePos]);
end else if AnsiCompareText(CurrentToken, 'vars') = 0 then begin
for i := 0 to NRVAR - 1 do begin
xform[CurrentXForm].vars[i] := 0;
end;
@ -887,6 +902,24 @@ begin
xform[CurrentXForm].vars[i] := StrToFloat(ParseValues[ParsePos]);
Inc(i);
end;
end else if AnsiCompareText(CurrentToken, 'variables') = 0 then begin
v := 0;
for i:= 0 to GetNrVariableNames-1 do begin
xform[CurrentXForm].SetVariable(GetVariableNameAt(i), v);
end;
i := 0;
while true do begin
if (ParsePos + 1) >= ParseValues.Count then
break;
if ParseValues[ParsePos + 1][1] in ['a'..'z', 'A'..'Z'] then
break;
Inc(ParsePos);
v := StrToFloat(ParseValues[ParsePos]);
xform[CurrentXForm].SetVariable(GetVariableNameAt(i), v);
Inc(i);
end;
end else begin
OutputDebugString(Pchar('Unknown Token: ' + CurrentToken));
@ -1251,13 +1284,14 @@ begin
end;
class function TControlPoint.interpolate(cp1, cp2: TControlPoint; Time: double): TControlPoint;
class function TControlPoint.Interpolate(cp1, cp2: TControlPoint; Time: double): TControlPoint;
var
c0, c1: double;
i, j: integer;
r, s, t: array[0..2] of double;
// totvar: double;
{z,rhtime: double;}
v1, v2: double;
begin
if (cp2.time - cp1.time) > 1E-6 then begin
c0 := (cp2.time - time) / (cp2.time - cp1.time);
@ -1319,9 +1353,18 @@ begin
for i := 0 to NXFORMS - 1 do begin
Result.xform[i].density := c0 * cp1.xform[i].density + c1 * cp2.xform[i].density;
Result.xform[i].color := c0 * cp1.xform[i].color + c1 * cp2.xform[i].color;
for j := 0 to NRVAR - 1 do begin
// for j := 0 to NRVAR - 1 do
// Result.xform[i].vars[j] := c0 * cp1.xform[i].vars[j] + c1 * cp2.xform[i].vars[j];
for j := 0 to NrVar-1 do
begin
Result.xform[i].vars[j] := c0 * cp1.xform[i].vars[j] + c1 * cp2.xform[i].vars[j];
end;
for j:= 0 to GetNrVariableNames-1 do begin
cp1.xform[i].GetVariable(GetVariableNameAt(j), v1);
cp2.xform[i].GetVariable(GetVariableNameAt(j), v2);
v1 := c0 * v1 + c1 * v2;
Result.xform[i].SetVariable(GetVariableNameAt(j), v1);
end;
(*
totvar := 0;
@ -1371,6 +1414,7 @@ var
c0, c1: double;
i, j: integer;
r, s, t: array[0..2] of double;
v1, v2: double;
// totvar: double;
{z,rhtime: double;}
begin
@ -1434,8 +1478,15 @@ begin
Result.xform[i].density := c0 * cp1.xform[i].density + c1 * cp2.xform[i].density;
Result.xform[i].color := c0 * cp1.xform[i].color + c1 * cp2.xform[i].color;
Result.xform[i].symmetry := c0 * cp1.xform[i].symmetry + c1 * cp2.xform[i].symmetry;
for j := 0 to NRVAR - 1 do begin
// for j := 0 to NrVar - 1 do
// Result.xform[i].vars[j] := c0 * cp1.xform[i].vars[j] + c1 * cp2.xform[i].vars[j];
for j := 0 to NrVar-1 do
Result.xform[i].vars[j] := c0 * cp1.xform[i].vars[j] + c1 * cp2.xform[i].vars[j];
for j:= 0 to GetNrVariableNames-1 do begin
cp1.xform[i].GetVariable(GetVariableNameAt(j), v1);
cp2.xform[i].GetVariable(GetVariableNameAt(j), v2);
v1 := c0 * v1 + c1 * v2;
Result.xform[i].SetVariable(GetVariableNameAt(j), v1);
end;
(*
totvar := 0;
@ -1472,9 +1523,10 @@ end;
procedure TControlPoint.SaveToStringlist(sl: TStringlist);
var
i, j: Integer;
i, j, k: Integer;
s: string;
OldDecimalSperator: Char;
v: double;
begin
OldDecimalSperator := DecimalSeparator;
DecimalSeparator := '.';
@ -1495,22 +1547,27 @@ begin
sl.add(format('brightness %f gamma %f vibrancy %f hue_rotation %f cmap_inter %d',
[brightness * BRIGHT_ADJUST, gamma, vibrancy, hue_rotation, cmap_inter]));
for i := 0 to NXFORMS - 1 do begin
if xform[i].density = 0 then
Continue;
for i := 0 to NXFORMS - 1 do
with xform[i] do begin
if density = 0 then continue;
sl.add(format('xform %d density %g color %g symmetry %g', [i, xform[i].density, xform[i].color, xform[i].symmetry]));
s := 'var';
for j := 0 to NRVAR - 1 do begin
s := format('%s %g', [s, xform[i].vars[j]]);
sl.add(format('xform %d density %g color %g symmetry %g', [i, density, color, symmetry]));
s := 'vars';
for j := 0 to NRVAR - 1 do begin
s := format('%s %g', [s, vars[j]]);
end;
sl.add(s);
s := 'variables';
for j:= 0 to GetNrVariableNames-1 do begin
GetVariable(GetVariableNameAt(j), v);
s := format('%s %g', [s, v]);
end;
sl.add(s);
sl.Add(format('coefs %.6f %.6f %.6f %.6f %.6f %.6f',
[c[0][0], c[0][1], c[1][0], c[1][1], c[2][0], c[2][1]]));
sl.Add(format('post %.6f %.6f %.6f %.6f %.6f %.6f',
[p[0][0], p[0][1], p[1][0], p[1][1], p[2][0], p[2][1]]));
end;
sl.add(s);
// sl.Add(format('coefs %f %f %f %f %f %f',
sl.Add(format('coefs %.6f %.6f %.6f %.6f %.6f %.6f',
[xform[i].c[0][0], xform[i].c[0][1],
xform[i].c[1][0], xform[i].c[1][1],
xform[i].c[2][0], xform[i].c[2][1]]));
end;
DecimalSeparator := OldDecimalSperator;
end;
@ -1697,7 +1754,7 @@ begin
if xform[i].density = 0 then
break;
for v := 23 to NrVar - 1 do
for v := NRLOCVAR to NrVar - 1 do
result := Result or (xform[i].vars[v] > 0);
if result then
@ -2007,5 +2064,15 @@ begin
end;
end;
procedure TControlPoint.AdjustScale(w, h: integer);
begin
// if width >= height then
pixels_per_unit := pixels_per_unit * w/width;
// else
// pixels_per_unit := pixels_per_unit * h/height;
width := w;
height := h;
end;
end.

View File

@ -1,8 +1,8 @@
object EditForm: TEditForm
Left = 279
Top = 234
Left = 302
Top = 226
Width = 586
Height = 582
Height = 573
Caption = 'Transform Editor'
Color = clBtnFace
Constraints.MinHeight = 400
@ -54,7 +54,7 @@ object EditForm: TEditForm
TextHeight = 13
object StatusBar: TStatusBar
Left = 0
Top = 539
Top = 530
Width = 578
Height = 15
Panels = <
@ -244,28 +244,8 @@ object EditForm: TEditForm
ShowHint = True
OnClick = mnuFlipVerticalClick
end
object tbFlipAllHorz: TToolButton
Left = 324
Top = 0
Hint = 'Flip all triangles horizontal'
Caption = 'Flip All Horizontal'
ImageIndex = 12
MenuItem = mnuHorizintalFlipAll
ParentShowHint = False
ShowHint = True
end
object tbFlipAllVert: TToolButton
Left = 349
Top = 0
Hint = 'Flip all triangles vertical'
Caption = 'Flip All Vertical '
ImageIndex = 13
MenuItem = mnuVerticalFlipAll
ParentShowHint = False
ShowHint = True
end
object ToolButton2: TToolButton
Left = 374
Left = 324
Top = 0
Width = 8
Caption = 'ToolButton2'
@ -273,7 +253,7 @@ object EditForm: TEditForm
Style = tbsSeparator
end
object tbVarPreview: TToolButton
Left = 382
Left = 332
Top = 0
Hint = 'Show/hide variation preview'
Caption = 'Variation Preview'
@ -289,14 +269,14 @@ object EditForm: TEditForm
Left = 0
Top = 24
Width = 578
Height = 515
Height = 506
Align = alClient
TabOrder = 1
object Splitter1: TSplitter
Left = 396
Top = 1
Width = 9
Height = 513
Height = 504
Align = alRight
AutoSnap = False
Beveled = True
@ -307,7 +287,7 @@ object EditForm: TEditForm
Left = 1
Top = 1
Width = 395
Height = 513
Height = 504
Align = alClient
BevelOuter = bvNone
Color = clAppWorkSpace
@ -317,7 +297,7 @@ object EditForm: TEditForm
Left = 405
Top = 1
Width = 172
Height = 513
Height = 504
Align = alRight
Alignment = taLeftJustify
BevelOuter = bvNone
@ -356,7 +336,7 @@ object EditForm: TEditForm
Left = 0
Top = 138
Width = 172
Height = 375
Height = 366
Align = alClient
TabOrder = 0
object lblTransform: TLabel
@ -389,7 +369,7 @@ object EditForm: TEditForm
Left = 1
Top = 30
Width = 170
Height = 344
Height = 335
ActivePage = TriangleTab
Align = alBottom
Anchors = [akLeft, akTop, akRight, akBottom]
@ -402,7 +382,7 @@ object EditForm: TEditForm
Left = 0
Top = 0
Width = 162
Height = 298
Height = 289
HorzScrollBar.Visible = False
VertScrollBar.Smooth = True
VertScrollBar.Style = ssFlat
@ -416,29 +396,29 @@ object EditForm: TEditForm
Left = 0
Top = 0
Width = 162
Height = 277
Height = 281
BevelOuter = bvNone
TabOrder = 0
object Label9: TLabel
object LabelB: TLabel
Left = 4
Top = 32
Width = 10
Width = 12
Height = 13
Caption = 'B:'
Caption = 'O:'
end
object Label7: TLabel
object LabelA: TLabel
Left = 4
Top = 8
Width = 11
Width = 10
Height = 13
Caption = 'A:'
Caption = 'X:'
end
object Label11: TLabel
object LabelC: TLabel
Left = 4
Top = 56
Width = 11
Width = 10
Height = 13
Caption = 'C:'
Caption = 'Y:'
end
object btTrgRotateRight: TSpeedButton
Left = 106
@ -1016,27 +996,6 @@ object EditForm: TEditForm
OnExit = CornerEditExit
OnKeyPress = CornerEditKeyPress
end
object rgPivot: TRadioGroup
Left = 16
Top = 210
Width = 129
Height = 65
BiDiMode = bdLeftToRight
Caption = 'Triangle Pivot'
Columns = 2
Ctl3D = True
ItemIndex = 1
Items.Strings = (
'A'
'B'
'C'
'Center'
'( 0; 0 )')
ParentBiDiMode = False
ParentCtl3D = False
TabOrder = 6
OnClick = rgPivotClicked
end
object txtTrgMoveValue: TComboBox
Left = 56
Top = 132
@ -1045,7 +1004,7 @@ object EditForm: TEditForm
AutoComplete = False
ItemHeight = 13
ItemIndex = 3
TabOrder = 8
TabOrder = 7
Text = '0.1'
OnExit = txtValidateValue
OnKeyPress = txtValKeyPress
@ -1065,7 +1024,7 @@ object EditForm: TEditForm
Height = 21
AutoComplete = False
ItemHeight = 13
TabOrder = 7
TabOrder = 6
Text = '15'
OnExit = txtValidateValue
OnKeyPress = txtValKeyPress
@ -1087,7 +1046,7 @@ object EditForm: TEditForm
AutoComplete = False
ItemHeight = 13
ItemIndex = 1
TabOrder = 9
TabOrder = 8
Text = '125'
OnExit = txtValidateValue
OnKeyPress = txtValKeyPress
@ -1099,43 +1058,98 @@ object EditForm: TEditForm
'200')
end
end
object chkPreserve: TCheckBox
Left = 30
Top = 280
Width = 105
Height = 17
Caption = 'Preserve weights'
Checked = True
State = cbChecked
object GroupBox3: TGroupBox
Left = 8
Top = 208
Width = 146
Height = 65
Caption = 'Pivot Point'
TabOrder = 1
object btnResetPivot: TSpeedButton
Left = 6
Top = 40
Width = 17
Height = 17
Hint = 'Reset pivot point to (0, 0)'
Caption = 'R'
ParentShowHint = False
ShowHint = True
OnClick = btnResetPivotClick
end
object btnPickPivot: TSpeedButton
Left = 122
Top = 40
Width = 17
Height = 17
Hint = 'Pick pivot point using mouse'
Caption = 'P'
ParentShowHint = False
ShowHint = True
OnClick = btnPickPivotClick
end
object btnPivotMode: TSpeedButton
Left = 24
Top = 40
Width = 97
Height = 17
Hint = 'Toggle pivot point mode'
Caption = 'Local Pivot'
ParentShowHint = False
ShowHint = True
OnClick = btnPivotModeClick
end
object editPivotY: TEdit
Left = 74
Top = 16
Width = 65
Height = 21
Hint = 'Pivot point coordinates in chosen coordinate system'
AutoSelect = False
ParentShowHint = False
ShowHint = True
TabOrder = 1
Text = '0'
OnExit = PivotValidate
OnKeyPress = PivotKeyPress
end
object editPivotX: TEdit
Left = 6
Top = 16
Width = 65
Height = 21
Hint = 'Pivot point coordinates in chosen coordinate system'
AutoSelect = False
ParentShowHint = False
ShowHint = True
TabOrder = 0
Text = '0'
OnExit = PivotValidate
OnKeyPress = PivotKeyPress
end
end
end
end
object tabXForm: TTabSheet
Caption = 'Transform'
object Label6: TLabel
Left = 36
Top = 100
Left = 10
Top = 126
Width = 38
Height = 13
Hint = '"weight" is the probability of this transform to be applied'
Caption = 'Weight:'
end
object Label29: TLabel
Left = 36
Top = 124
Width = 52
Height = 13
Caption = 'Symmetry:'
ParentShowHint = False
ShowHint = True
end
object btnResetCoefs: TSpeedButton
Left = 8
Top = 148
Top = 76
Width = 145
Height = 22
Hint = 'Reset all vectors to default'
Caption = 'Reset Coefs'
Hint = 'Reset all vectors to default position'
Caption = 'Reset transform'
ParentShowHint = False
ShowHint = False
ShowHint = True
OnClick = mnuResetClick
end
object btnXcoefs: TSpeedButton
@ -1143,10 +1157,10 @@ object EditForm: TEditForm
Top = 4
Width = 25
Height = 21
Hint = 'Reset point A'
Hint = 'Reset vector X'
Caption = 'X'
ParentShowHint = False
ShowHint = False
ShowHint = True
OnClick = btnXcoefsClick
end
object btnYcoefs: TSpeedButton
@ -1154,10 +1168,10 @@ object EditForm: TEditForm
Top = 28
Width = 25
Height = 21
Hint = 'Reset point C'
Hint = 'Reset vector Y'
Caption = 'Y'
ParentShowHint = False
ShowHint = False
ShowHint = True
OnClick = btnYcoefsClick
end
object btnOcoefs: TSpeedButton
@ -1165,33 +1179,99 @@ object EditForm: TEditForm
Top = 52
Width = 25
Height = 21
Hint = 'Reset point B'
Hint = 'Reset vector O'
Caption = 'O'
ParentShowHint = False
ShowHint = False
ShowHint = True
OnClick = btnOcoefsClick
end
object btnCoefsRect: TSpeedButton
Left = 8
Top = 76
Top = 101
Width = 71
Height = 17
Hint = 'Show vectors in rectangular (cartesian) coordinates'
GroupIndex = 1
Down = True
Caption = 'Rectangular'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnCoefsModeClick
end
object btnCoefsPolar: TSpeedButton
Left = 82
Top = 76
Top = 101
Width = 71
Height = 17
Hint = 'Show vectors in polar coordinates'
GroupIndex = 1
Caption = 'Polar (deg)'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnCoefsModeClick
end
object btnXpost: TSpeedButton
Left = 8
Top = 188
Width = 25
Height = 21
Hint = 'Reset vector X'
Caption = 'X'
ParentShowHint = False
ShowHint = True
OnClick = btnXpostClick
end
object btnYpost: TSpeedButton
Left = 8
Top = 212
Width = 25
Height = 21
Hint = 'Reset vector Y'
Caption = 'Y'
ParentShowHint = False
ShowHint = True
OnClick = btnYpostClick
end
object btnOpost: TSpeedButton
Left = 8
Top = 236
Width = 25
Height = 21
Hint = 'Reset vector O'
Caption = 'O'
ParentShowHint = False
ShowHint = True
OnClick = btnOpostClick
end
object btnResetPostXForm: TSpeedButton
Left = 8
Top = 164
Width = 145
Height = 22
Hint = 'Reset post-transform vectors to defaults'
Caption = 'Reset post-transform'
ParentShowHint = False
ShowHint = True
OnClick = btnResetPostXFormClick
end
object btnSwapXforms: TSpeedButton
Left = 8
Top = 260
Width = 145
Height = 22
Hint = 'Swap Xform with PostXform'
Caption = '[ Xform <-> PostXform ]'
Flat = True
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
ParentShowHint = False
ShowHint = True
OnClick = btnSwapXformsClick
end
object txtA: TEdit
Left = 36
Top = 4
@ -1254,7 +1334,7 @@ object EditForm: TEditForm
end
object txtP: TEdit
Left = 96
Top = 96
Top = 122
Width = 57
Height = 21
TabOrder = 6
@ -1262,15 +1342,81 @@ object EditForm: TEditForm
OnExit = txtPExit
OnKeyPress = txtPKeyPress
end
object txtSymmetry: TEdit
Left = 96
Top = 120
object chkPreserve: TCheckBox
Left = 8
Top = 145
Width = 145
Height = 17
Hint =
'Keep this checked if you don'#39't want all weights to be recalculat' +
'ed to screw up all your flame :-)'
Alignment = taLeftJustify
Caption = 'Preserve weights'
Checked = True
ParentShowHint = False
ShowHint = True
State = cbChecked
TabOrder = 7
end
object txtPost00: TEdit
Left = 36
Top = 188
Width = 57
Height = 21
TabOrder = 7
TabOrder = 8
Text = '0'
OnExit = txtSymmetryExit
OnKeyPress = txtSymmetryKeyPress
OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress
end
object txtPost01: TEdit
Left = 96
Top = 188
Width = 57
Height = 21
TabOrder = 9
Text = '0'
OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress
end
object txtPost10: TEdit
Left = 36
Top = 212
Width = 57
Height = 21
TabOrder = 10
Text = '0'
OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress
end
object txtPost11: TEdit
Left = 96
Top = 212
Width = 57
Height = 21
TabOrder = 11
Text = '0'
OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress
end
object txtPost20: TEdit
Left = 36
Top = 236
Width = 57
Height = 21
TabOrder = 12
Text = '0'
OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress
end
object txtPost21: TEdit
Left = 96
Top = 236
Width = 57
Height = 21
TabOrder = 13
Text = '0'
OnExit = PostCoefValidate
OnKeyPress = PostCoefKeypress
end
end
object tabVariations: TTabSheet
@ -1279,7 +1425,7 @@ object EditForm: TEditForm
Left = 0
Top = 0
Width = 162
Height = 298
Height = 289
Align = alClient
ScrollBars = ssVertical
TabOrder = 0
@ -1305,7 +1451,7 @@ object EditForm: TEditForm
Left = 0
Top = 0
Width = 162
Height = 298
Height = 289
Align = alClient
ScrollBars = ssVertical
TabOrder = 0
@ -1331,9 +1477,16 @@ object EditForm: TEditForm
Left = 8
Top = 2
Width = 145
Height = 71
Height = 100
Caption = 'Transform color'
TabOrder = 0
object Label29: TLabel
Left = 10
Top = 72
Width = 52
Height = 13
Caption = 'Symmetry:'
end
object scrlXFormColor: TScrollBar
Left = 8
Top = 46
@ -1363,67 +1516,43 @@ object EditForm: TEditForm
OnExit = txtXFormColorExit
OnKeyPress = txtXFormColorKeyPress
end
object txtSymmetry: TComboBox
Left = 80
Top = 70
Width = 57
Height = 21
ItemHeight = 13
ItemIndex = 0
TabOrder = 3
Text = '0'
OnExit = txtSymmetryExit
OnKeyPress = txtSymmetryKeyPress
Items.Strings = (
'0'
'1')
end
end
object GroupBox2: TGroupBox
Left = 8
Top = 77
Top = 108
Width = 145
Height = 212
Height = 137
Caption = 'Graph'
TabOrder = 1
object Label20: TLabel
Left = 8
Top = 56
Width = 56
Height = 13
Caption = 'Background'
end
object Label21: TLabel
Left = 8
Top = 96
Width = 50
Height = 13
Caption = 'Reference'
end
object Label8: TLabel
Left = 75
Top = 56
Width = 50
Height = 13
Caption = 'Grid colors'
end
object Label10: TLabel
Left = 75
Top = 96
Width = 36
Height = 13
Caption = 'Helpers'
end
object Label1: TLabel
Left = 8
Top = 136
Top = 56
Width = 83
Height = 13
Caption = 'Variation preview'
end
object pnlBackColor: TPanel
Left = 8
Top = 72
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clBlack
TabOrder = 0
OnClick = pnlBackColorClick
end
object chkUseXFormColor: TCheckBox
Left = 8
Top = 16
Width = 129
Height = 17
Caption = 'Use transform color'
TabOrder = 1
TabOrder = 0
OnClick = chkUseXFormColorClick
end
object chkHelpers: TCheckBox
@ -1434,56 +1563,12 @@ object EditForm: TEditForm
Caption = 'Helper lines'
Checked = True
State = cbChecked
TabOrder = 2
TabOrder = 1
OnClick = chkHelpersClick
end
object pnlReference: TPanel
Left = 8
Top = 112
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clGray
TabOrder = 3
OnClick = pnlReferenceClick
end
object pnlGridColor1: TPanel
Left = 75
Top = 72
Width = 29
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clBlack
TabOrder = 4
OnClick = pnlGridColor1Click
end
object pnlGridColor2: TPanel
Left = 108
Top = 72
Width = 29
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clBlack
TabOrder = 5
OnClick = pnlGridColor2Click
end
object pnlHelpersColor: TPanel
Left = 75
Top = 112
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clGray
TabOrder = 6
OnClick = pnlHelpersColorClick
end
object trkVarPreviewDensity: TTrackBar
Left = 8
Top = 184
Top = 104
Width = 65
Height = 25
Max = 5
@ -1492,14 +1577,14 @@ object EditForm: TEditForm
PageSize = 1
Position = 2
ShowHint = True
TabOrder = 7
TabOrder = 2
TabStop = False
ThumbLength = 15
OnChange = trkVarPreviewDensityChange
end
object trkVarPreviewRange: TTrackBar
Left = 8
Top = 152
Top = 72
Width = 129
Height = 25
Min = 1
@ -1507,14 +1592,14 @@ object EditForm: TEditForm
PageSize = 1
Position = 2
ShowHint = True
TabOrder = 8
TabOrder = 3
TabStop = False
ThumbLength = 15
OnChange = trkVarPreviewRangeChange
end
object trkVarPreviewDepth: TTrackBar
Left = 72
Top = 184
Top = 104
Width = 65
Height = 25
Max = 5
@ -1523,7 +1608,7 @@ object EditForm: TEditForm
PageSize = 1
Position = 1
ShowHint = True
TabOrder = 9
TabOrder = 4
TabStop = False
ThumbLength = 15
OnChange = trkVarPreviewDepthChange

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ object RenderForm: TRenderForm
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'RenderForm'
ClientHeight = 424
ClientHeight = 416
ClientWidth = 424
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@ -51,7 +51,7 @@ object RenderForm: TRenderForm
TextHeight = 13
object ProgressBar: TProgressBar
Left = 0
Top = 392
Top = 384
Width = 424
Height = 13
Align = alBottom
@ -59,7 +59,7 @@ object RenderForm: TRenderForm
end
object btnRender: TButton
Left = 256
Top = 364
Top = 356
Width = 75
Height = 23
Caption = 'Render'
@ -69,7 +69,7 @@ object RenderForm: TRenderForm
end
object btnCancel: TButton
Left = 344
Top = 362
Top = 354
Width = 75
Height = 25
Caption = 'Close'
@ -140,7 +140,6 @@ object RenderForm: TRenderForm
Width = 281
Height = 21
TabOrder = 0
Text = 'txtFilename'
OnChange = txtFilenameChange
end
end
@ -368,7 +367,7 @@ object RenderForm: TRenderForm
end
object btnPause: TButton
Left = 168
Top = 362
Top = 354
Width = 75
Height = 25
Caption = 'Pause'
@ -377,7 +376,7 @@ object RenderForm: TRenderForm
end
object chkSave: TCheckBox
Left = 8
Top = 330
Top = 322
Width = 113
Height = 17
Caption = 'Save parameters'
@ -439,7 +438,7 @@ object RenderForm: TRenderForm
end
object StatusBar: TStatusBar
Left = 0
Top = 405
Top = 397
Width = 424
Height = 19
Panels = <
@ -455,7 +454,7 @@ object RenderForm: TRenderForm
end
object chkShutdown: TCheckBox
Left = 8
Top = 368
Top = 360
Width = 137
Height = 17
Caption = 'Shutdown on complete'
@ -463,14 +462,14 @@ object RenderForm: TRenderForm
end
object cbPostProcess: TCheckBox
Left = 8
Top = 348
Top = 340
Width = 97
Height = 17
Caption = 'Post render'
TabOrder = 9
end
object SaveDialog: TSaveDialog
Left = 368
Top = 328
Left = 376
Top = 320
end
end

View File

@ -89,8 +89,8 @@ type
procedure cmbPresetChange(Sender: TObject);
procedure chkMaintainClick(Sender: TObject);
private
StartTime: TDateTime;
Remainder: TDateTime;
StartTime, oldElapsed, edt: TDateTime;
oldProg: double;
procedure DoPostProcess;
@ -171,7 +171,7 @@ begin
if not chkLimitMem.Checked and cbPostProcess.checked then
DoPostProcess;
Renderer.SaveImage(RenderForm.FileName);
Renderer.SaveImage(FileName);
Renderer.Free;
Renderer := nil;
@ -192,33 +192,50 @@ end;
procedure TRenderForm.OnProgress(prog: double);
var
Elapsed: TDateTime;
e, r: string;
Elapsed, Remaining, dt: TDateTime;
begin
Elapsed := Now - StartTime;
dt := Elapsed - oldElapsed;
if (prog = 1.0) then begin
StatusBar.Panels[0].text := Format('Elapsed %2.2d:%2.2d:%2.2d.%2.2d',
[Trunc(Elapsed * 24),
Trunc(Elapsed * 24 * 60) mod 60,
Trunc(Elapsed * 24 * 60 * 60) mod 60,
Trunc(Elapsed * 24 * 60 * 60 * 100) mod 100]);
StatusBar.Panels[1].text := 'Remaining 00:00:00.00';
exit;
end;
if (dt < 1/24/60/60/10) then exit;
oldElapsed := Elapsed;
prog := (Renderer.Slice + Prog) / Renderer.NrSlices;
if ShowProgress then ProgressBar.Position := round(100 * prog);
Elapsed := Now - StartTime;
e := Format('Elapsed %2.2d:%2.2d:%2.2d.%2.2d',
StatusBar.Panels[0].text := Format('Elapsed %2.2d:%2.2d:%2.2d.%2.2d',
[Trunc(Elapsed * 24),
Trunc((Elapsed * 24 - Trunc(Elapsed * 24)) * 60),
Trunc((Elapsed * 24 * 60 - Trunc(Elapsed * 24 * 60)) * 60),
Trunc((Elapsed * 24 * 60 * 60 - Trunc(Elapsed * 24 * 60 * 60)) * 100)]);
Trunc(Elapsed * 24 * 60) mod 60,
Trunc(Elapsed * 24 * 60 * 60) mod 60,
Trunc(Elapsed * 24 * 60 * 60 * 100) mod 100]);
if prog > 0 then
Remainder := Min(Remainder, Elapsed * (power(1 / prog, 1.2) - 1));
edt := edt + dt;
if (edt > 1/24/60/60/2) and (prog > 0) then
begin
// Remainder := Min(Remainder, Elapsed * (power(1 / prog, 1.2) - 1)); // --Z-- this power() is weird
// Remaining := Elapsed/prog - Elapsed; // --Z-- should've been like this maybe? ;) too easy anyway...
r := Format('Remaining %2.2d:%2.2d:%2.2d.%2.2d',
[Trunc(Remainder * 24),
Trunc((Remainder * 24 - Trunc(Remainder * 24)) * 60),
Trunc((Remainder * 24 * 60 - Trunc(Remainder * 24 * 60)) * 60),
Trunc((Remainder * 24 * 60 * 60 - Trunc(Remainder * 24 * 60 * 60)) * 100)]);
Remaining := (1 - prog) * edt / (prog - oldProg);
edt := 0;
oldProg := prog;
StatusBar.Panels[0].text := e;
StatusBar.Panels[1].text := r;
StatusBar.Panels[2].text := 'Slice ' + IntToStr(Renderer.Slice + 1) + ' of ' + IntToStr(Renderer.nrSlices);
StatusBar.Panels[1].text := Format('Remaining %2.2d:%2.2d:%2.2d.%2.2d',
[Trunc(Remaining * 24),
Trunc(Remaining * 24 * 60) mod 60,
Trunc(Remaining * 24 * 60 * 60) mod 60,
Trunc(Remaining * 24 * 60 * 60 * 100) mod 100]);
end;
StatusBar.Panels[2].text := 'Slice ' + IntToStr(Renderer.Slice + 1) + ' of ' + IntToStr(Renderer.nrSlices);
end;
procedure TRenderForm.FormCreate(Sender: TObject);
@ -232,9 +249,14 @@ end;
procedure TRenderForm.FormDestroy(Sender: TObject);
begin
if assigned(Renderer) then Renderer.Terminate;
if assigned(Renderer) then Renderer.WaitFor;
if assigned(Renderer) then Renderer.Free;
// if assigned(Renderer) then Renderer.Terminate;
// if assigned(Renderer) then Renderer.WaitFor;
// if assigned(Renderer) then Renderer.Free;
if assigned(Renderer) then begin
Renderer.Terminate;
Renderer.WaitFor;
Renderer.Free;
end;
cp.free;
end;
@ -312,26 +334,31 @@ begin
btnPause.enabled := true;
btnCancel.Caption := 'Stop';
StartTime := Now;
Remainder := 365;
// Remaining := 365;
if Assigned(Renderer) then Renderer.Terminate;
if Assigned(Renderer) then Renderer.WaitFor;
if not Assigned(Renderer) then
begin
// disable screensaver
// disable screensaver
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, nil, 0);
cp.sample_density := Sample_density;
cp.spatial_oversample := Oversample;
cp.spatial_filter_radius := Filter_Radius;
AdjustScale(cp, ImageWidth, ImageHeight);
cp.AdjustScale(ImageWidth, ImageHeight);
renderPath := ExtractFilePath(Filename);
if chkSave.checked then
MainForm.SaveXMLFlame(cp, ExtractFileName(FileName), renderPath + 'renders.flame');
oldProg:=0;
oldElapsed:=0;
edt:=0;
Renderer := TRenderThread.Create;
if chkLimitMem.checked then
Renderer.MaxMem := StrToInt(cbMaxMemory.text);
Renderer.OnProgress := OnProgress;
Renderer.TargetHandle := RenderForm.Handle;
Renderer.TargetHandle := self.Handle;
Renderer.Compatibility := compatibility;
Renderer.SetCP(cp);
Renderer.Priority := tpLower;
@ -354,9 +381,9 @@ begin
if Registry.OpenKey('Software\' + APP_NAME + '\Forms\Render', False) then
begin
if Registry.ValueExists('Left') then
RenderForm.Left := Registry.ReadInteger('Left');
self.Left := Registry.ReadInteger('Left');
if Registry.ValueExists('Top') then
RenderForm.Top := Registry.ReadInteger('Top');
self.Top := Registry.ReadInteger('Top');
end;
Registry.CloseKey;
finally
@ -409,15 +436,26 @@ begin
end;
procedure TRenderForm.txtOversampleChange(Sender: TObject);
var
o: integer;
begin
if StrToInt(txtOversample.Text) > udOversample.Max then
txtOversample.Text := IntToStr(udOversample.Max);
if StrToInt(txtOversample.Text) < udOversample.Min then
txtOversample.Text := IntToStr(udOversample.Min);
try
Oversample := StrToInt(txtOversample.Text);
o := StrToInt(txtOversample.Text);
except
txtOversample.Text := IntToStr(Oversample);
exit;
end;
if o > udOversample.Max then
begin
o := udOversample.Max;
txtOversample.Text := IntToStr(o);
end
else if o < udOversample.Min then
begin
o := udOversample.Min;
txtOversample.Text := IntToStr(o);
end;
Oversample := o;
ShowMemoryStatus;
end;
@ -435,9 +473,11 @@ end;
procedure TRenderForm.btnCancelClick(Sender: TObject);
begin
if Assigned(Renderer) then
Renderer.Terminate
else
close;
begin
Renderer.Terminate;
Renderer.WaitFor; // --?--
end
else close;
end;
procedure TRenderForm.txtDensityChange(Sender: TObject);
@ -476,8 +516,8 @@ begin
Registry.RootKey := HKEY_CURRENT_USER;
if Registry.OpenKey('\Software\' + APP_NAME + '\Forms\Render', True) then
begin
Registry.WriteInteger('Top', RenderForm.Top);
Registry.WriteInteger('Left', RenderForm.Left);
Registry.WriteInteger('Top', Top);
Registry.WriteInteger('Left', Left);
end;
finally
Registry.Free;
@ -504,7 +544,10 @@ begin
CanClose := False
else
begin
if Assigned(Renderer) then Renderer.Terminate;
if Assigned(Renderer) then begin
Renderer.Terminate;
Renderer.WaitFor;
end;
end;
end;
@ -677,7 +720,7 @@ procedure TRenderForm.DoPostProcess;
begin
frmPostProcess.SetRenderer(Renderer.GetRenderer);
frmPostProcess.SetControlPoint(CP);
frmPostProcess.SetImageName(RenderForm.FileName);
frmPostProcess.SetImageName(FileName);
frmPostProcess.Show;
end;

View File

@ -62,7 +62,7 @@ uses Main, Math, Global;
procedure TFullscreenForm.DrawFlame;
begin
AdjustScale(cp, Image.Width, Image.Height);
cp.AdjustScale(Image.Width, Image.Height);
// cp.Zoom := MainForm.Zoom;
// cp.center[0] := MainForm.center[0];
// cp.center[1] := MainForm.center[1];

View File

@ -80,6 +80,10 @@ var
Variation: TVariation; // Current variation
NumTries, TryLength: integer; // Settings for smooth palette
SmoothPaletteFile: string;
{ Editor }
UseFlameBackground, UseTransformColors: boolean;
EditorBkgColor, ReferenceTriangleColor: integer;
GridColor1, GridColor2, HelpersColor: integer;
{ Display }
defSampleDensity, defPreviewDensity: Double;
defGamma, defBrightness, defVibrancy, defFilterRadius: Double;

View File

@ -1,10 +1,12 @@
object MainForm: TMainForm
Left = 387
Top = 166
Width = 605
Height = 635
Left = 400
Top = 157
Width = 731
Height = 530
Caption = 'Apophysis'
Color = clBtnFace
Constraints.MinHeight = 240
Constraints.MinWidth = 320
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
@ -27,12 +29,12 @@ object MainForm: TMainForm
Left = 160
Top = 28
Width = 4
Height = 540
Height = 435
end
object ToolBar: TToolBar
Left = 0
Top = 0
Width = 597
Width = 723
Height = 28
BorderWidth = 1
Flat = True
@ -43,7 +45,7 @@ object MainForm: TMainForm
object btnOpen: TToolButton
Left = 0
Top = 0
Hint = 'Open (Ctrl+O)|Opens parameter files for browsing'
Hint = 'Open (Ctrl+O)|Open a parameter file for browsing'
Caption = 'btnOpen'
ImageIndex = 1
OnClick = mnuOpenClick
@ -131,7 +133,7 @@ object MainForm: TMainForm
object btnFullScreen: TToolButton
Left = 194
Top = 0
Hint = 'Fullscreen View (F3)|Shows full-screen view of the flame'
Hint = 'Fullscreen View (F3)|Show full-screen view of the flame'
Caption = 'btnFullScreen'
ImageIndex = 52
OnClick = mnuFullScreenClick
@ -147,7 +149,7 @@ object MainForm: TMainForm
object btnEditor: TToolButton
Left = 225
Top = 0
Hint = 'Editor (F4)|Shows the Transform Editor'
Hint = 'Editor (F4)|Show Transform Editor'
Caption = 'btnEditor'
ImageIndex = 19
OnClick = mnuEditorClick
@ -155,7 +157,7 @@ object MainForm: TMainForm
object btnAdjust: TToolButton
Left = 248
Top = 0
Hint = 'Adjust (F5)|Shows the Adjust window'
Hint = 'Adjust (F5)|Adjust render-settings'
Caption = 'btnAdjust'
ImageIndex = 18
OnClick = mnuAdjustClick
@ -179,7 +181,7 @@ object MainForm: TMainForm
object btnSize: TToolButton
Left = 317
Top = 0
Hint = 'Image Size (F2)|Shows the Image Size window'
Hint = 'Image Size|Adjust image size'
Caption = 'ma'
ImageIndex = 51
OnClick = mnuImageSizeClick
@ -192,27 +194,29 @@ object MainForm: TMainForm
ImageIndex = 14
Style = tbsSeparator
end
object btnRun: TToolButton
object btnDefine: TToolButton
Left = 348
Top = 0
Hint = 'Run Script|Runs the Default Animation script'
Hint = 'Edit Script (F8)|Open the Script Editor'
Caption = 'btnDefine'
ImageIndex = 42
OnClick = mnuEditScriptClick
end
object btnRun: TToolButton
Left = 371
Top = 0
Hint = 'Run Script|Run Script'
Caption = 'Run'
ImageIndex = 43
OnClick = btnRunClick
end
object btnStop: TToolButton
Left = 371
Top = 0
Caption = 'btnStop'
ImageIndex = 36
OnClick = mnuStopClick
end
object btnDefine: TToolButton
Left = 394
Top = 0
Hint = 'Edit Script (F8)|Opens the Script Editor'
Caption = 'btnDefine'
ImageIndex = 42
OnClick = mnuEditScriptClick
Hint = 'Stop Script|Stop Script'
Caption = 'Stop'
ImageIndex = 36
OnClick = mnuStopClick
end
object ToolButton5: TToolButton
Left = 417
@ -284,7 +288,7 @@ object MainForm: TMainForm
Left = 0
Top = 28
Width = 160
Height = 540
Height = 435
Align = alLeft
Columns = <
item
@ -302,8 +306,8 @@ object MainForm: TMainForm
object BackPanel: TPanel
Left = 164
Top = 28
Width = 433
Height = 540
Width = 559
Height = 435
Align = alClient
BevelInner = bvLowered
BevelOuter = bvNone
@ -313,8 +317,8 @@ object MainForm: TMainForm
object Image: TImage
Left = 1
Top = 1
Width = 431
Height = 538
Width = 557
Height = 433
Align = alClient
AutoSize = True
PopupMenu = DisplayPopup
@ -327,8 +331,8 @@ object MainForm: TMainForm
end
object StatusBar: TStatusBar
Left = 0
Top = 568
Width = 597
Top = 463
Width = 723
Height = 19
Panels = <
item
@ -2668,7 +2672,6 @@ object MainForm: TMainForm
object mnuImageSize: TMenuItem
Caption = 'Image Size'
ImageIndex = 51
ShortCut = 119
OnClick = mnuImageSizeClick
end
object mnuimage: TMenuItem

View File

@ -38,7 +38,7 @@ const
RS_XO = 2;
RS_VO = 3;
AppVersionString = 'Apophysis 2.03b';
AppVersionString = 'Apophysis 2.03c pre-release 5';
type
TMouseMoveState = (msUsual, msZoomWindow, msZoomOutWindow, msZoomWindowMove, msZoomOutWindowMove, msDrag, msDragMove, msRotate, msRotateMove);
@ -352,7 +352,7 @@ function NumXForms(const cp: TControlPoint): integer;
procedure MultMatrix(var s: TMatrix; const m: TMatrix);
procedure ListFlames(FileName: string; sel: integer);
procedure ListIFS(FileName: string; sel: integer);
procedure AdjustScale(var cp1: TControlPoint; width, height: integer);
//procedure AdjustScale(var cp1: TControlPoint; width, height: integer);
procedure NormalizeVariations(var cp1: TControlPoint);
function GetWinVersion: TWin32Version;
@ -418,16 +418,6 @@ begin
end
end;
procedure AdjustScale(var cp1: TControlPoint; width, height: integer);
begin
// if width >= height then
cp1.pixels_per_unit := cp1.pixels_per_unit / (cp1.width / width);
// else
// cp1.pixels_per_unit := cp1.pixels_per_unit / (cp1.height / height);
cp1.width := width;
cp1.height := height;
end;
procedure MultMatrix(var s: TMatrix; const m: TMatrix);
var
a, b, c, d, e, f, g, h: double;
@ -1803,7 +1793,7 @@ begin
begin
if (MainCp.width <> Image.Width) or (MainCp.height <> Image.height) then
begin
AdjustScale(MainCp, Image.width, Image.height);
MainCp.AdjustScale(Image.width, Image.height);
if EditForm.Visible then EditForm.UpdateDisplay(true); // preview only?
end;
if AdjustForm.Visible then AdjustForm.UpdateDisplay(true); // preview only!
@ -3728,7 +3718,8 @@ begin
cp1.spatial_oversample := ExportOversample;
cp1.spatial_filter_radius := ExportFilter;
cp1.nbatches := ExportBatches;
if (cp1.width <> ExportWidth) or (cp1.Height <> ExportHeight) then AdjustScale(cp1, ExportWidth, ExportHeight);
if (cp1.width <> ExportWidth) or (cp1.Height <> ExportHeight) then
cp1.AdjustScale(ExportWidth, ExportHeight);
FileList.Text := FlameToXML(cp1, false);
FileList.SaveToFile(ChangeFileExt(ExportDialog.Filename, '.flame'));
FileList.Clear;
@ -3992,6 +3983,7 @@ begin
try
if TagName = 'xform' then
begin
Parsecp.xform[nxform].Clear;
v := Attributes.Value('weight');
if v <> '' then ParseCp.xform[nxform].density := StrToFloat(v);
v := Attributes.Value('color');
@ -4010,6 +4002,20 @@ begin
c[2][0] := StrToFloat(Tokens[4]);
c[2][1] := StrToFloat(Tokens[5]);
end;
v := Attributes.Value('post');
if v <> '' then begin
GetTokens(v, tokens);
if Tokens.Count < 6 then ShowMessage('Not enough post-cooeficients...crash?');
with Parsecp.xform[nxform] do
begin
p[0][0] := StrToFloat(Tokens[0]);
p[0][1] := StrToFloat(Tokens[1]);
p[1][0] := StrToFloat(Tokens[2]);
p[1][1] := StrToFloat(Tokens[3]);
p[2][0] := StrToFloat(Tokens[4]);
p[2][1] := StrToFloat(Tokens[5]);
end;
end;
for i := 0 to NRVAR - 1 do
begin
@ -4450,4 +4456,5 @@ end;
{$ENDIF}
///////////////////////////////////////////////////////////////////////////////
end.

View File

@ -138,7 +138,7 @@ end;
procedure TMutateForm.UpdateDisplay;
begin
cps[0].copy(MainCp);
AdjustScale(cps[0], Image0.Width, Image0.Height);
cps[0].AdjustScale(Image0.Width, Image0.Height);
cps[0].cmap := MainCp.cmap;
cmap := MainCp.cmap;
name := Maincp.name;
@ -600,7 +600,7 @@ begin
cps[0].width := MainCp.width;
cps[0].height := MainCp.height;
cps[0].pixels_per_unit := MainCp.pixels_per_unit;
AdjustScale(cps[0], Image0.width, Image0.Height);
cps[0].AdjustScale(Image0.width, Image0.Height);
cps[0].zoom := MainCp.zoom;
cps[0].center[0] := MainCp.center[0];
cps[0].center[1] := MainCp.center[1];

View File

@ -51,19 +51,19 @@ object OptionsForm: TOptionsForm
HelpContext = 1
Caption = 'General'
object chkConfirmDel: TCheckBox
Left = 144
Top = 135
Width = 97
Left = 8
Top = 175
Width = 121
Height = 17
HelpContext = 1005
Caption = 'Confirm delete'
TabOrder = 4
TabOrder = 2
end
object JPEG: TGroupBox
Left = 8
Top = 132
Top = 116
Width = 121
Height = 53
Height = 55
Caption = 'JPEG Quality'
TabOrder = 0
object txtJPEGquality: TComboBox
@ -83,23 +83,23 @@ object OptionsForm: TOptionsForm
end
end
object chkResize: TCheckBox
Left = 144
Top = 153
Width = 169
Left = 8
Top = 193
Width = 121
Height = 17
Caption = 'Resize on load'
TabOrder = 5
TabOrder = 3
end
object GroupBox16: TGroupBox
Left = 8
Top = 4
Width = 121
Height = 69
Height = 55
Caption = 'Multithreading'
TabOrder = 1
object cbNrTheads: TComboBox
Left = 16
Top = 24
Top = 20
Width = 89
Height = 21
ItemHeight = 13
@ -113,18 +113,21 @@ object OptionsForm: TOptionsForm
'8')
end
end
object chkShowTransparency: TCheckBox
Left = 144
Top = 171
Width = 169
Height = 17
Caption = 'Show Transparency'
TabOrder = 6
object rgRotationMode: TRadioGroup
Left = 8
Top = 60
Width = 121
Height = 55
Caption = 'Rotation Mode'
Items.Strings = (
'Rotate image'
'Rotate frame')
TabOrder = 4
end
object rgReferenceMode: TRadioGroup
Left = 280
Left = 288
Top = 4
Width = 153
Width = 145
Height = 69
Caption = 'Reference Triangle'
ItemIndex = 0
@ -132,30 +135,116 @@ object OptionsForm: TOptionsForm
'Normal'
'Proportional'
'Wandering (old-style)')
TabOrder = 3
TabOrder = 5
end
object rgTransparency: TRadioGroup
object GroupBox1: TGroupBox
Left = 136
Top = 4
Width = 137
Height = 69
Caption = 'PNG Transparency'
Items.Strings = (
'No transparency'
'Flam3-style'
'Flamesong-style')
TabOrder = 2
end
object rgRotationMode: TRadioGroup
Left = 8
Top = 76
Width = 121
Height = 53
Caption = 'Rotation Mode'
Items.Strings = (
'Rotate image'
'Rotate frame')
TabOrder = 7
Width = 145
Height = 138
Caption = 'Editor Graph'
TabOrder = 6
object Label40: TLabel
Left = 8
Top = 56
Width = 56
Height = 13
Caption = 'Background'
end
object Label41: TLabel
Left = 8
Top = 96
Width = 50
Height = 13
Caption = 'Reference'
end
object Label42: TLabel
Left = 75
Top = 56
Width = 50
Height = 13
Caption = 'Grid colors'
end
object Label43: TLabel
Left = 75
Top = 96
Width = 36
Height = 13
Caption = 'Helpers'
end
object pnlBackColor: TPanel
Left = 8
Top = 72
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clBlack
TabOrder = 0
OnClick = pnlBackColorClick
end
object chkUseXFormColor: TCheckBox
Left = 8
Top = 16
Width = 129
Height = 17
Caption = 'Use transform color'
TabOrder = 1
end
object chkHelpers: TCheckBox
Left = 8
Top = 36
Width = 129
Height = 17
Caption = 'Helper lines'
Checked = True
State = cbChecked
TabOrder = 2
end
object pnlReference: TPanel
Left = 8
Top = 112
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clGray
TabOrder = 3
OnClick = pnlReferenceClick
end
object pnlGridColor1: TPanel
Left = 75
Top = 72
Width = 29
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clBlack
TabOrder = 4
OnClick = pnlGridColor1Click
end
object pnlGridColor2: TPanel
Left = 108
Top = 72
Width = 29
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clBlack
TabOrder = 5
OnClick = pnlGridColor2Click
end
object pnlHelpersColor: TPanel
Left = 75
Top = 112
Width = 62
Height = 17
Cursor = crHandPoint
BevelOuter = bvLowered
Color = clGray
TabOrder = 6
OnClick = pnlHelpersColorClick
end
end
end
object DisplayPage: TTabSheet
@ -311,6 +400,27 @@ object OptionsForm: TOptionsForm
TabOrder = 5
end
end
object chkShowTransparency: TCheckBox
Left = 192
Top = 179
Width = 129
Height = 17
Caption = 'Show Transparency'
TabOrder = 2
end
object rgTransparency: TRadioGroup
Left = 184
Top = 104
Width = 193
Height = 69
Caption = 'PNG Transparency'
ItemIndex = 0
Items.Strings = (
'No transparency'
'Flam3-style'
'Flamesong-style')
TabOrder = 3
end
end
object RandomPage: TTabSheet
Caption = 'Random'
@ -424,7 +534,7 @@ object OptionsForm: TOptionsForm
Height = 21
HelpContext = 1004
TabOrder = 1
Text = '100'
Text = '10'
end
object udBatchSize: TUpDown
Left = 169
@ -434,7 +544,7 @@ object OptionsForm: TOptionsForm
Associate = txtBatchSize
Min = 1
Max = 300
Position = 100
Position = 10
TabOrder = 2
Thousands = False
end
@ -609,8 +719,8 @@ object OptionsForm: TOptionsForm
object clbVarEnabled: TCheckListBox
Left = 12
Top = 16
Width = 309
Height = 201
Width = 317
Height = 206
Columns = 2
ItemHeight = 13
TabOrder = 0
@ -1196,7 +1306,7 @@ object OptionsForm: TOptionsForm
end
end
end
object Paths: TTabSheet
object PathsPage: TTabSheet
Caption = 'Paths'
ImageIndex = 7
object GroupBox10: TGroupBox

View File

@ -146,7 +146,7 @@ type
Label17: TLabel;
txtServer: TEdit;
chkResize: TCheckBox;
Paths: TTabSheet;
PathsPage: TTabSheet;
GroupBox10: TGroupBox;
btnDefGradient: TSpeedButton;
Label25: TLabel;
@ -166,15 +166,12 @@ type
clbVarEnabled: TCheckListBox;
GroupBox16: TGroupBox;
cbNrTheads: TComboBox;
chkShowTransparency: TCheckBox;
rgReferenceMode: TRadioGroup;
GroupBox13: TGroupBox;
Label8: TLabel;
Label10: TLabel;
txtNumtries: TEdit;
txtTryLength: TEdit;
txtJPEGquality: TComboBox;
rgTransparency: TRadioGroup;
Label24: TLabel;
txtSymNVars: TEdit;
udSymNVars: TUpDown;
@ -183,6 +180,21 @@ type
udBatchSize: TUpDown;
Label38: TLabel;
Label39: TLabel;
chkShowTransparency: TCheckBox;
rgTransparency: TRadioGroup;
rgReferenceMode: TRadioGroup;
GroupBox1: TGroupBox;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
Label43: TLabel;
pnlBackColor: TPanel;
chkUseXFormColor: TCheckBox;
chkHelpers: TCheckBox;
pnlReference: TPanel;
pnlGridColor1: TPanel;
pnlGridColor2: TPanel;
pnlHelpersColor: TPanel;
procedure btnCancelClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnOKClick(Sender: TObject);
@ -207,6 +219,11 @@ type
procedure btnRendererClick(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure pnlBackColorClick(Sender: TObject);
procedure pnlReferenceClick(Sender: TObject);
procedure pnlGridColor1Click(Sender: TObject);
procedure pnlGridColor2Click(Sender: TObject);
procedure pnlHelpersColorClick(Sender: TObject);
private
{ Private declarations }
public
@ -221,7 +238,7 @@ implementation
{$R *.DFM}
uses
Main, Global, Editor, ControlPoint, XFormMan;
Main, Global, Editor, ControlPoint, XFormMan, Adjust;
procedure TOptionsForm.btnCancelClick(Sender: TObject);
begin
@ -278,6 +295,11 @@ begin
txtMediumQuality.Text := FloatToStr(prevMediumQuality);
txtHighQuality.Text := FloatToStr(prevHighQuality);
pnlBackColor.Color := TColor(EditorBkgColor);
pnlGridColor1.Color := GridColor1;
pnlGridColor2.Color := GridColor2;
pnlReference.color := TColor(ReferenceTriangleColor);
{ Random tab }
udMinXforms.Position := randMinTransforms;
udMaxXforms.Position := randMaxTransforms;
@ -620,5 +642,61 @@ begin
end;
end;
procedure TOptionsForm.pnlBackColorClick(Sender: TObject);
begin
AdjustForm.ColorDialog.Color := pnlBackColor.Color;
if AdjustForm.ColorDialog.Execute then
begin
pnlBackColor.Color := AdjustForm.ColorDialog.Color;
EditorBkgColor := Integer(pnlBackColor.color);
// GrphPnl.Color := BackgroundColor;
// TriangleView.Invalidate;
end;
end;
procedure TOptionsForm.pnlReferenceClick(Sender: TObject);
begin
AdjustForm.ColorDialog.Color := pnlReference.Color;
if AdjustForm.ColorDialog.Execute then
begin
pnlReference.Color := AdjustForm.ColorDialog.Color;
ReferenceTriangleColor := Integer(pnlReference.color);
// TriangleView.Invalidate;
end;
end;
procedure TOptionsForm.pnlGridColor1Click(Sender: TObject);
begin
AdjustForm.ColorDialog.Color := pnlGridColor1.Color;
if AdjustForm.ColorDialog.Execute then
begin
pnlGridColor1.Color := AdjustForm.ColorDialog.Color;
GridColor1 := Integer(pnlGridColor1.color);
// TriangleView.Invalidate;
end;
end;
procedure TOptionsForm.pnlGridColor2Click(Sender: TObject);
begin
AdjustForm.ColorDialog.Color := pnlGridColor2.Color;
if AdjustForm.ColorDialog.Execute then
begin
pnlGridColor2.Color := AdjustForm.ColorDialog.Color;
GridColor2 := Integer(pnlGridColor2.color);
// TriangleView.Invalidate;
end;
end;
procedure TOptionsForm.pnlHelpersColorClick(Sender: TObject);
begin
AdjustForm.ColorDialog.Color := pnlHelpersColor.Color;
if AdjustForm.ColorDialog.Execute then
begin
pnlHelpersColor.Color := AdjustForm.ColorDialog.Color;
HelpersColor := Integer(pnlHelpersColor.color);
// TriangleView.Invalidate;
end;
end;
end.

View File

@ -3,7 +3,7 @@ object ScriptEditor: TScriptEditor
Top = 383
Width = 539
Height = 390
Caption = 'Default Animation'
Caption = 'Script Editor'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
@ -20,7 +20,7 @@ object ScriptEditor: TScriptEditor
TextHeight = 13
object Splitter1: TSplitter
Left = 0
Top = 244
Top = 250
Width = 531
Height = 4
Cursor = crVSplit
@ -30,7 +30,7 @@ object ScriptEditor: TScriptEditor
Left = 508
Top = 0
Width = 23
Height = 244
Height = 250
Align = alRight
AutoSize = True
Caption = 'ToolBar'
@ -96,7 +96,7 @@ object ScriptEditor: TScriptEditor
end
object StatusBar: TStatusBar
Left = 0
Top = 337
Top = 343
Width = 531
Height = 19
Anchors = [akLeft, akRight]
@ -106,7 +106,7 @@ object ScriptEditor: TScriptEditor
Left = 0
Top = 0
Width = 508
Height = 244
Height = 250
Align = alClient
BevelInner = bvLowered
BevelOuter = bvLowered
@ -116,7 +116,7 @@ object ScriptEditor: TScriptEditor
Left = 2
Top = 2
Width = 504
Height = 240
Height = 246
Cursor = crIBeam
PopupMenu = PopupMenu
ActiveLineSettings.ShowActiveLine = False
@ -190,14 +190,14 @@ object ScriptEditor: TScriptEditor
UrlStyle.BkColor = clWhite
UrlStyle.Style = [fsUnderline]
UseStyler = True
Version = '1.6.0.8'
Version = '1.6.0.17'
WordWrap = wwNone
OnChange = EditorChange
end
end
object Console: TMemo
Left = 0
Top = 248
Top = 254
Width = 531
Height = 89
Align = alBottom
@ -389,6 +389,13 @@ object ScriptEditor: TScriptEditor
EventSupport = False
OnCompileError = ScripterCompileError
ShortBooleanEval = False
LibOptions.SearchPath.Strings = (
'$(CURDIR)'
'$(APPDIR)')
LibOptions.SourceFileExt = '.psc'
LibOptions.CompiledFileExt = '.pcu'
LibOptions.UseScriptFiles = False
CallExecHookEvent = False
Left = 360
Top = 32
end

View File

@ -1475,7 +1475,7 @@ begin
if nxform < NXFORMS then
for i := nxform to NXFORMS - 1 do
cp1.xform[i].density := 0;
cp1.NormalizeWeights;
// --?-- cp1.NormalizeWeights;
// Check for symmetry parameter
if cp1.symmetry <> 0 then
begin
@ -1517,7 +1517,7 @@ begin
for i := 0 to NXFORMS - 1 do
if ScriptEditor.cp.xform[i].density = 0 then break;
NumTransforms := i;
ScriptEditor.cp.NormalizeWeights;
// --?-- ScriptEditor.cp.NormalizeWeights;
// FlameName := FileList[index];
finally
IFSStrings.Free;
@ -1589,7 +1589,7 @@ begin
for i := 0 to NXFORMS - 1 do
if ScriptEditor.cp.xform[i].density = 0 then break;
NumTransforms := i;
ScriptEditor.cp.NormalizeWeights;
// --?-- ScriptEditor.cp.NormalizeWeights;
if SavedPal then ScriptEditor.cp.cmap := Palette;
ScriptEditor.cp.name := FileList[index];
finally
@ -1749,9 +1749,9 @@ begin
if NumTransforms > 1 then
begin
AMachine.Paused := True;
ScriptEditor.cp.NormalizeWeights;
// --?-- ScriptEditor.cp.NormalizeWeights;
PreviewForm.cp.Copy(ScriptEditor.cp);
AdjustScale(PreviewForm.cp, PreviewForm.Image.Width, PreviewForm.Image.Height);
PreviewForm.cp.AdjustScale(PreviewForm.Image.Width, PreviewForm.Image.Height);
PreviewForm.Show;
PreviewForm.DrawFlame;
AMachine.Paused := False;
@ -1764,7 +1764,7 @@ procedure TOperationLibrary.RenderProc(AMachine: TatVirtualMachine);
begin
if NumTransforms > 1 then
begin
ScriptEditor.cp.NormalizeWeights;
// --?-- ScriptEditor.cp.NormalizeWeights;
ScriptRenderForm.cp.Copy(ScriptEditor.cp);
ScriptRenderForm.Caption := 'Rendering ' + ScriptEditor.Renderer.Filename; ;
ScriptRenderForm.Show;
@ -2913,7 +2913,7 @@ begin
else
if (LastError = '') and UpdateIt then
begin
cp.NormalizeWeights;
// --?-- cp.NormalizeWeights;
MainForm.UpdateUndo;
MainCp.Copy(cp);
UpdateFlame;
@ -2945,11 +2945,11 @@ procedure TScriptEditor.UpdateFlame;
begin
MainForm.StopThread;
MainForm.UpdateUndo;
cp.NormalizeWeights;
// --?-- cp.NormalizeWeights;
MainCp.Copy(cp);
// MainCp.name := FlameName;
Transforms := MainCp.TrianglesFromCP(MainTriangles);
AdjustScale(MainCp, MainForm.Image.Width, MainForm.Image.Height);
MainCp.AdjustScale(MainForm.Image.Width, MainForm.Image.Height);
if ResetLocation then MainCp.CalcBoundBox else
begin;
MainCp.Zoom := cp.zoom;

View File

@ -21,12 +21,7 @@ interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls, Render, cmap, ControlPoint;
const
WM_THREAD_COMPLETE = WM_APP + 5437;
WM_THREAD_TERMINATE = WM_APP + 5438;
ComCtrls, StdCtrls, RenderThread, cmap, ControlPoint;
type
TScriptRenderForm = class(TForm)
@ -36,11 +31,16 @@ type
procedure FormCreate(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
private
PixelsPerUnit: double;
// PixelsPerUnit: double;
StartTime: TDateTime;
Remainder: TDateTime;
procedure HandleThreadCompletion(var Message: TMessage);
message WM_THREAD_COMPLETE;
procedure HandleThreadTermination(var Message: TMessage);
message WM_THREAD_TERMINATE;
public
Renderer: TRenderer;
Renderer: TRenderThread;
ColorMap: TColorMap;
cp: TControlPoint;
Filename: string;
@ -64,34 +64,44 @@ uses Global, Math, FormRender, ScriptForm;
procedure TScriptRenderForm.SetRenderBounds;
begin
cp.copy(ScriptEditor.cp);
cp.Width := ScriptEditor.Renderer.Width;
cp.Height := ScriptEditor.Renderer.Height;
cp.CalcBoundBox;
//cp.Width := ScriptEditor.Renderer.Width;
//cp.Height := ScriptEditor.Renderer.Height;
cp.AdjustScale(ScriptEditor.Renderer.Width, ScriptEditor.Renderer.Height);
// --?-- cp.CalcBoundBox;
cp.center[0] := ScriptEditor.cp.center[0];
cp.center[1] := ScriptEditor.cp.center[1];
cp.zoom := ScriptEditor.cp.zoom;
PixelsPerUnit := cp.Pixels_per_unit;
//PixelsPerUnit := cp.Pixels_per_unit;
end;
procedure TScriptRenderForm.Render;
begin
assert(not Assigned(Renderer));
Renderer := TRenderThread.Create;
Cancelled := False;
ScriptEditor.Scripter.Paused := True;
StartTime := Now;
Remainder := 1;
cp.copy(ScriptEditor.cp);
Filename := ScriptEditor.Renderer.Filename;
cp.Width := ScriptEditor.Renderer.Width;
cp.Height := ScriptEditor.Renderer.Height;
cp.pixels_per_unit := PixelsPerUnit;
//cp.Width := ScriptEditor.Renderer.Width;
//cp.Height := ScriptEditor.Renderer.Height;
//cp.pixels_per_unit := PixelsPerUnit;
cp.AdjustScale(ScriptEditor.Renderer.Width, ScriptEditor.Renderer.Height);
Renderer.OnProgress := OnProgress;
Renderer.Compatibility := Compatibility;
Renderer.Compatibility := Compatibility;
Renderer.SetCP(cp);
if (ScriptEditor.Renderer.MaxMemory > 0) then
Renderer.RenderMaxMem(ScriptEditor.Renderer.MaxMemory)
else Renderer.Render;
Renderer.SaveImage(FileName);
ScriptEditor.Scripter.Paused := False;
if (ScriptEditor.Renderer.MaxMemory > 0) then Renderer.MaxMem := ScriptEditor.Renderer.MaxMemory;
Renderer.TargetHandle := Handle;
renderPath := ExtractFilePath(ScriptEditor.Renderer.Filename);
Renderer.Priority := tpLower;
Renderer.NrThreads := NrTreads;
Renderer.Resume;
// Renderer.SaveImage(FileName);
// ScriptEditor.Scripter.Paused := False;
end;
procedure TScriptRenderForm.OnProgress(prog: double);
@ -101,20 +111,19 @@ begin
prog := (Renderer.Slice + Prog) / Renderer.NrSlices;
ProgressBar.Position := round(100 * prog);
Elapsed := Now - StartTime;
if prog > 0 then
Remainder := Min(Remainder, Elapsed * (power(1 / prog, 1.2) - 1));
// if prog > 0 then Remainder := Elapsed * (1/prog - 1);
Application.ProcessMessages;
end;
procedure TScriptRenderForm.FormDestroy(Sender: TObject);
begin
cp.free;
Renderer.free;
assert(not Assigned(Renderer)); //if Assigned(Renderer) then Renderer.free;
end;
procedure TScriptRenderForm.FormCreate(Sender: TObject);
begin
Renderer := TRenderer.Create;
//Renderer := TRenderThread.Create;
cp := TControlPoint.Create;
end;
@ -122,9 +131,34 @@ procedure TScriptRenderForm.btnCancelClick(Sender: TObject);
begin
ScriptEditor.Scripter.Halt;
Cancelled := True;
Renderer.Stop;
// Renderer.Stop;
if Assigned(Renderer) then begin
Renderer.Terminate;
Renderer.WaitFor;
Renderer.Free;
Renderer := nil;
end;
LastError := 'Render cancelled';
end;
procedure TScriptRenderForm.HandleThreadCompletion(var Message: TMessage);
begin
Renderer.SaveImage(FileName);
Renderer.Free;
Renderer := nil;
ScriptEditor.Scripter.Paused := False;
end;
procedure TScriptRenderForm.HandleThreadTermination(var Message: TMessage);
begin
if Assigned(Renderer) then
begin
Renderer.Free;
Renderer := nil;
end;
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ uses
BaseVariation;
const
NRLOCVAR = 23;
NRLOCVAR = 27;
function NrVar: integer;
function Varnames(const index: integer): String;
@ -57,7 +57,11 @@ const
'power',
'cosine',
'rings',
'fan'
'fan',
'eyefish',
'bubble',
'cylinder',
'smoke'
);
begin
if Index < NRLOCVAR then

View File

@ -1,8 +1,8 @@
object frmPostProcess: TfrmPostProcess
Left = 0
Top = 0
Width = 434
Height = 320
Left = 38
Top = 43
Width = 640
Height = 534
Caption = 'Post Render'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@ -19,14 +19,14 @@ object frmPostProcess: TfrmPostProcess
object Panel1: TPanel
Left = 0
Top = 0
Width = 426
Height = 149
Width = 632
Height = 71
Align = alTop
BevelOuter = bvLowered
TabOrder = 0
DesignSize = (
426
149)
632
71)
object Label1: TLabel
Left = 12
Top = 12
@ -42,36 +42,36 @@ object frmPostProcess: TfrmPostProcess
Caption = 'Filter'
end
object Label3: TLabel
Left = 12
Top = 52
Left = 172
Top = 12
Width = 35
Height = 13
Caption = 'Gamma'
end
object Label4: TLabel
Left = 12
Top = 72
Left = 332
Top = 32
Width = 45
Height = 13
Caption = 'Vibrancy:'
end
object Label5: TLabel
Left = 12
Top = 92
Left = 332
Top = 12
Width = 42
Height = 13
Caption = 'Contrast'
end
object Label6: TLabel
Left = 12
Top = 112
Left = 172
Top = 32
Width = 50
Height = 13
Caption = 'Brightness'
end
object btnSave: TButton
Left = 340
Top = 36
Left = 552
Top = 30
Width = 75
Height = 25
Anchors = [akTop, akRight]
@ -82,7 +82,7 @@ object frmPostProcess: TfrmPostProcess
object pnlBackColor: TPanel
Left = 104
Top = 8
Width = 97
Width = 57
Height = 21
BevelOuter = bvLowered
TabOrder = 0
@ -90,15 +90,15 @@ object frmPostProcess: TfrmPostProcess
end
object ProgressBar1: TProgressBar
Left = 1
Top = 136
Width = 424
Top = 58
Width = 630
Height = 12
Align = alBottom
TabOrder = 1
end
object btnApply: TButton
Left = 340
Top = 8
Left = 552
Top = 4
Width = 75
Height = 25
Anchors = [akTop, akRight]
@ -110,44 +110,44 @@ object frmPostProcess: TfrmPostProcess
object txtFilterRadius: TEdit
Left = 104
Top = 28
Width = 97
Width = 57
Height = 21
TabOrder = 2
end
object txtGamma: TEdit
Left = 104
Top = 48
Width = 97
Left = 264
Top = 8
Width = 57
Height = 21
TabOrder = 3
end
object txtVib: TEdit
Left = 104
Top = 68
Width = 97
Left = 424
Top = 28
Width = 57
Height = 21
TabOrder = 4
end
object txtContrast: TEdit
Left = 104
Top = 88
Width = 97
Left = 424
Top = 8
Width = 57
Height = 21
TabOrder = 5
end
object txtBrightness: TEdit
Left = 104
Top = 108
Width = 97
Left = 264
Top = 28
Width = 57
Height = 21
TabOrder = 6
end
end
object ScrollBox1: TScrollBox
Left = 0
Top = 149
Width = 426
Height = 137
Top = 71
Width = 632
Height = 435
Align = alClient
TabOrder = 1
object Image: TImage
@ -159,7 +159,7 @@ object frmPostProcess: TfrmPostProcess
end
end
object ColorDialog: TColorDialog
Left = 284
Top = 4
Left = 508
Top = 20
end
end