optimized renderer

added drag-edit controls in forms: editor, adjust, postprocess
This commit is contained in:
zueuk 2006-03-06 15:34:54 +00:00
parent 0fbd6a6ff6
commit b81d9ee0dd
16 changed files with 1475 additions and 1085 deletions

View File

@ -61,6 +61,7 @@ object AdjustForm: TAdjustForm
Top = 5 Top = 5
Width = 23 Width = 23
Height = 22 Height = 22
Hint = 'Undo'
Flat = True Flat = True
Glyph.Data = { Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100 36040000424D3604000000000000360000002800000010000000100000000100
@ -106,6 +107,7 @@ object AdjustForm: TAdjustForm
Top = 5 Top = 5
Width = 23 Width = 23
Height = 22 Height = 22
Hint = 'Redo'
Flat = True Flat = True
Glyph.Data = { Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100 36040000424D3604000000000000360000002800000010000000100000000100
@ -170,62 +172,14 @@ object AdjustForm: TAdjustForm
end end
object PageControl: TPageControl object PageControl: TPageControl
Left = 0 Left = 0
Top = 131 Top = 132
Width = 388 Width = 388
Height = 130 Height = 129
ActivePage = TabSheet1 ActivePage = TabSheet1
Align = alBottom Align = alBottom
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Camera' Caption = 'Camera'
object btnZoom: TSpeedButton
Left = 4
Top = 4
Width = 61
Height = 21
Hint = 'Reset value'
Caption = 'Zoom'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnZoomClick
end
object btnXpos: TSpeedButton
Left = 4
Top = 28
Width = 61
Height = 21
Hint = 'Reset value'
Caption = 'X position'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnXposClick
end
object btnYpos: TSpeedButton
Left = 4
Top = 52
Width = 61
Height = 21
Hint = 'Reset value'
Caption = 'Y position'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnYposClick
end
object btnAngle: TSpeedButton
Left = 4
Top = 76
Width = 61
Height = 21
Hint = 'Reset value'
Caption = 'Rotation'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnAngleClick
end
object scrollZoom: TScrollBar object scrollZoom: TScrollBar
Left = 72 Left = 72
Top = 7 Top = 7
@ -307,8 +261,7 @@ object AdjustForm: TAdjustForm
Width = 257 Width = 257
Height = 15 Height = 15
LargeChange = 1500 LargeChange = 1500
Max = 18000 Max = 36000
Min = -18000
PageSize = 0 PageSize = 0
SmallChange = 100 SmallChange = 100
TabOrder = 6 TabOrder = 6
@ -326,6 +279,74 @@ object AdjustForm: TAdjustForm
OnExit = txtAngleExit OnExit = txtAngleExit
OnKeyPress = txtAngleKeyPress OnKeyPress = txtAngleKeyPress
end end
object pnlZoom: TPanel
Left = 4
Top = 4
Width = 61
Height = 21
Cursor = crHandPoint
Hint = 'Click and drag to change value'
BevelOuter = bvLowered
Caption = 'Zoom'
ParentShowHint = False
ShowHint = True
TabOrder = 8
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object pnlXpos: TPanel
Left = 4
Top = 28
Width = 61
Height = 21
Cursor = crHandPoint
Hint = 'Click and drag to change value'
BevelOuter = bvLowered
Caption = 'X position'
ParentShowHint = False
ShowHint = True
TabOrder = 9
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object pnlYpos: TPanel
Left = 4
Top = 52
Width = 61
Height = 21
Cursor = crHandPoint
Hint = 'Click and drag to change value'
BevelOuter = bvLowered
Caption = 'Y position'
ParentShowHint = False
ShowHint = True
TabOrder = 10
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object pnlAngle: TPanel
Left = 4
Top = 76
Width = 61
Height = 21
Cursor = crHandPoint
Hint = 'Click and drag to change value'
BevelOuter = bvLowered
Caption = 'Rotation'
ParentShowHint = False
ShowHint = True
TabOrder = 11
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'Rendering' Caption = 'Rendering'
@ -338,48 +359,40 @@ object AdjustForm: TAdjustForm
AutoSize = False AutoSize = False
Caption = 'Background' Caption = 'Background'
end end
object btnGamma: TSpeedButton object pnlMasterScale: TPanel
Left = 232
Top = 76
Width = 73
Height = 21
Cursor = crHandPoint
Hint = 'Click and drag to change value'
Alignment = taLeftJustify
BevelOuter = bvLowered
Caption = ' Master Scale'
ParentShowHint = False
ShowHint = True
TabOrder = 9
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object pnlGamma: TPanel
Left = 4 Left = 4
Top = 4 Top = 4
Width = 61 Width = 61
Height = 21 Height = 21
Hint = 'Reset value' Cursor = crHandPoint
Hint = 'Click and drag to change value'
BevelOuter = bvLowered
Caption = 'Gamma' Caption = 'Gamma'
Flat = True
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
OnClick = btnGammaClick TabOrder = 10
end OnDblClick = DragPanelDblClick
object btnBritghtness: TSpeedButton OnMouseDown = DragPanelMouseDown
Left = 4 OnMouseMove = DragPanelMouseMove
Top = 28 OnMouseUp = DragPanelMouseUp
Width = 61
Height = 21
Hint = 'Reset value'
Caption = 'Brightness'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnBritghtnessClick
end
object btnVibrancy: TSpeedButton
Left = 4
Top = 52
Width = 61
Height = 21
Hint = 'Reset value'
Caption = 'Vibrancy'
Flat = True
ParentShowHint = False
ShowHint = True
OnClick = btnVibrancyClick
end
object Label1: TLabel
Left = 236
Top = 80
Width = 62
Height = 13
Caption = 'Master Scale'
end end
object scrollGamma: TScrollBar object scrollGamma: TScrollBar
Left = 72 Left = 72
@ -481,6 +494,40 @@ object AdjustForm: TAdjustForm
OnExit = editPPUValidate OnExit = editPPUValidate
OnKeyPress = editPPUKeyPress OnKeyPress = editPPUKeyPress
end end
object pnlBrightness: TPanel
Left = 4
Top = 28
Width = 61
Height = 21
Cursor = crHandPoint
Hint = 'Click and drag to change value'
BevelOuter = bvLowered
Caption = 'Brightness'
ParentShowHint = False
ShowHint = True
TabOrder = 11
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object pnlVibrancy: TPanel
Left = 4
Top = 52
Width = 61
Height = 21
Cursor = crHandPoint
Hint = 'Click and drag to change value'
BevelOuter = bvLowered
Caption = 'Vibrancy'
ParentShowHint = False
ShowHint = True
TabOrder = 12
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
end end
object TabSheet3: TTabSheet object TabSheet3: TTabSheet
Caption = 'Gradient' Caption = 'Gradient'
@ -499,7 +546,6 @@ object AdjustForm: TAdjustForm
Height = 21 Height = 21
Hint = 'Click for menu' Hint = 'Click for menu'
Caption = 'Rotate' Caption = 'Rotate'
Flat = True
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
OnClick = btnMenuClick OnClick = btnMenuClick
@ -682,7 +728,7 @@ object AdjustForm: TAdjustForm
object GradientImage: TImage object GradientImage: TImage
Left = 1 Left = 1
Top = 1 Top = 1
Width = 380 Width = 378
Height = 47 Height = 47
Cursor = crHandPoint Cursor = crHandPoint
Align = alClient Align = alClient

View File

@ -63,13 +63,6 @@ type
TabSheet3: TTabSheet; TabSheet3: TTabSheet;
scrollAngle: TScrollBar; scrollAngle: TScrollBar;
txtAngle: TEdit; txtAngle: TEdit;
btnZoom: TSpeedButton;
btnXpos: TSpeedButton;
btnYpos: TSpeedButton;
btnAngle: TSpeedButton;
btnGamma: TSpeedButton;
btnBritghtness: TSpeedButton;
btnVibrancy: TSpeedButton;
GradientPnl: TPanel; GradientPnl: TPanel;
GradientImage: TImage; GradientImage: TImage;
lblVal: TLabel; lblVal: TLabel;
@ -130,8 +123,15 @@ type
Bevel2: TBevel; Bevel2: TBevel;
N8: TMenuItem; N8: TMenuItem;
mnuInstantPreview: TMenuItem; mnuInstantPreview: TMenuItem;
Label1: TLabel;
editPPU: TEdit; editPPU: TEdit;
pnlMasterScale: TPanel;
pnlZoom: TPanel;
pnlXpos: TPanel;
pnlYpos: TPanel;
pnlAngle: TPanel;
pnlGamma: TPanel;
pnlBrightness: TPanel;
pnlVibrancy: TPanel;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@ -188,13 +188,6 @@ type
procedure txtAngleEnter(Sender: TObject); procedure txtAngleEnter(Sender: TObject);
procedure txtAngleExit(Sender: TObject); procedure txtAngleExit(Sender: TObject);
procedure txtAngleKeyPress(Sender: TObject; var Key: Char); procedure txtAngleKeyPress(Sender: TObject; var Key: Char);
procedure btnZoomClick(Sender: TObject);
procedure btnXposClick(Sender: TObject);
procedure btnYposClick(Sender: TObject);
procedure btnAngleClick(Sender: TObject);
procedure btnGammaClick(Sender: TObject);
procedure btnBritghtnessClick(Sender: TObject);
procedure btnVibrancyClick(Sender: TObject);
// --Z-- // gradient functions // --Z-- // gradient functions
procedure cmbPaletteChange(Sender: TObject); procedure cmbPaletteChange(Sender: TObject);
@ -252,6 +245,14 @@ type
procedure editPPUKeyPress(Sender: TObject; var Key: Char); procedure editPPUKeyPress(Sender: TObject; var Key: Char);
procedure editPPUValidate(Sender: TObject); procedure editPPUValidate(Sender: TObject);
procedure DragPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DragPanelMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure DragPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DragPanelDblClick(Sender: TObject);
private private
Resetting: boolean; Resetting: boolean;
Render: TRenderer; Render: TRenderer;
@ -260,6 +261,11 @@ type
cp: TControlPoint; cp: TControlPoint;
pnlDragMode, pnlDragged, pnlMM: boolean;
pnlDragPos, pnlDragOld: integer;
pnlDragValue: double;
mousepos: TPoint;
private // gradient stuff private // gradient stuff
Palette, BackupPal: TColorMap; Palette, BackupPal: TColorMap;
tmpBackupPal: TColorMap; tmpBackupPal: TColorMap;
@ -353,7 +359,8 @@ begin
scrollBrightness.Position := trunc(cp.Brightness * 100); scrollBrightness.Position := trunc(cp.Brightness * 100);
scrollVibrancy.Position := trunc(cp.vibrancy * 100); scrollVibrancy.Position := trunc(cp.vibrancy * 100);
scrollZoom.Position := trunc(cp.zoom * 1000); scrollZoom.Position := trunc(cp.zoom * 1000);
ScrollAngle.Position := Trunc(cp.FAngle * 18000.0 / PI) mod scrollAngle.Max; // ScrollAngle.Position := Trunc(cp.FAngle * 18000.0 / PI) mod scrollAngle.Max;
scrollAngle.Position := Trunc((cp.FAngle + pi)* 18000.0 / PI) mod 36000;
if (abs(cp.Center[0]) < 1000) and (abs(cp.Center[1]) < 1000) then begin if (abs(cp.Center[0]) < 1000) and (abs(cp.Center[1]) < 1000) then begin
scrollCenterX.Position := trunc(cp.Center[0] * 1000); scrollCenterX.Position := trunc(cp.Center[0] * 1000);
@ -926,7 +933,7 @@ end;
procedure TAdjustForm.scrollAngleChange(Sender: TObject); procedure TAdjustForm.scrollAngleChange(Sender: TObject);
begin begin
cp.FAngle := scrollAngle.Position * PI / 18000.0; cp.FAngle := (scrollAngle.Position - 18000) * PI / 18000.0;
txtAngle.text := FloatToStr(cp.FAngle * 180 / PI); txtAngle.text := FloatToStr(cp.FAngle * 180 / PI);
DrawPreview; DrawPreview;
end; end;
@ -950,9 +957,9 @@ begin
begin begin
key := #0; key := #0;
try try
v := Trunc(StrToFloat(txtAngle.Text) * 100) mod (scrollAngle.Max*2); v := Trunc(StrToFloat(txtAngle.Text) * 100) mod scrollAngle.Max - 18000;
if v > scrollAngle.Max then v := v - scrollAngle.Max*2 //if v > scrollAngle.Max then v := v - scrollAngle.Max*2
else if v < scrollAngle.Min then v := v + scrollAngle.Max*2; if v < scrollAngle.Min then v := v + scrollAngle.Max;
ScrollAngle.Position := v; ScrollAngle.Position := v;
UpdateFlame; UpdateFlame;
EditBoxValue := txtAngle.Text; EditBoxValue := txtAngle.Text;
@ -977,48 +984,6 @@ begin
end; end;
end; end;
procedure TAdjustForm.btnZoomClick(Sender: TObject);
begin
scrollZoom.Position := 0;
UpdateFlame;
end;
procedure TAdjustForm.btnXposClick(Sender: TObject);
begin
scrollCenterX.Position := 0;
UpdateFlame;
end;
procedure TAdjustForm.btnYposClick(Sender: TObject);
begin
scrollCenterY.Position := 0;
UpdateFlame;
end;
procedure TAdjustForm.btnAngleClick(Sender: TObject);
begin
scrollAngle.Position := 0;
UpdateFlame;
end;
procedure TAdjustForm.btnGammaClick(Sender: TObject);
begin
scrollGamma.Position := 400;
UpdateFlame;
end;
procedure TAdjustForm.btnBritghtnessClick(Sender: TObject);
begin
scrollBrightness.Position := 400;
UpdateFlame;
end;
procedure TAdjustForm.btnVibrancyClick(Sender: TObject);
begin
scrollVibrancy.Position := 100;
UpdateFlame;
end;
// --Z-- // gradient stuff implementation -------------------------------------- // --Z-- // gradient stuff implementation --------------------------------------
procedure TAdjustForm.Apply; procedure TAdjustForm.Apply;
@ -1909,5 +1874,169 @@ begin
UpdateFlame; UpdateFlame;
end; end;
// -----------------------------------------------------------------------------
procedure TAdjustForm.DragPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button <> mbLeft then exit;
if (Sender = pnlMasterScale) then
pnlDragValue := cp.pixels_per_unit / 10
else if (Sender = pnlZoom) then
pnlDragValue := cp.zoom
else if (Sender = pnlXpos) then
pnlDragValue := cp.Center[0]
else if (Sender = pnlYpos) then
pnlDragValue := cp.Center[1]
else if (Sender = pnlAngle) then
pnlDragValue := cp.FAngle
else if (Sender = pnlGamma) then
pnlDragValue := cp.gamma
else if (Sender = pnlBrightness) then
pnlDragValue := cp.brightness
else if (Sender = pnlVibrancy) then
pnlDragValue := cp.vibrancy
else assert(false);
pnlDragMode := true;
pnlDragPos := 0;
pnlDragOld := x;
pnlMM := false;
SetCaptureControl(TControl(Sender));
Screen.Cursor := crHSplit;
GetCursorPos(mousepos); // hmmm
pnlDragged := false;
end;
procedure TAdjustForm.DragPanelMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
v: double;
begin
if pnlMM then // hack: to skip MouseMove event
begin
pnlMM:=false;
end
else
if pnlDragMode and (x <> pnlDragOld) then
begin
Inc(pnlDragPos, x - pnlDragOld);
if GetKeyState(VK_MENU) < 0 then v := 100000
else if GetKeyState(VK_CONTROL) < 0 then v := 10000
else if GetKeyState(VK_SHIFT) < 0 then v := 100
else v := 1000;
v := Round6(pnlDragValue + pnlDragPos / v);
SetCursorPos(MousePos.x, MousePos.y); // hmmm
pnlMM:=true;
if (Sender = pnlMasterScale) then
begin
v := v * 10;
if v <= 0.1 then v := 0.1;
cp.pixels_per_unit := v;
editPPU.Text := FloatToStr(v);
end
else if (Sender = pnlZoom) then
begin
scrollZoom.Position := trunc(v * 1000);
end
else if (Sender = pnlXpos) then
begin
scrollCenterX.Position := trunc(v * 1000);
end
else if (Sender = pnlYpos) then
begin
scrollCenterY.Position := trunc(v * 1000);
end
else if (Sender = pnlAngle) then
begin
scrollAngle.Position := Trunc((v + pi)* 18000.0 / PI) mod 36000;
end
else if (Sender = pnlGamma) then
begin
scrollGamma.Position := trunc(v * 100);
end
else if (Sender = pnlBrightness) then
begin
scrollBrightness.Position := trunc(v * 100);
end
else if (Sender = pnlVibrancy) then
begin
scrollVibrancy.Position := trunc(v * 100);
end;
//pEdit^.Text := FloatToStr(v);
//pEdit.Refresh;
pnlDragged := True;
DrawPreview;
end;
end;
procedure TAdjustForm.DragPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button <> mbLeft then exit;
if pnlDragMode then
begin
SetCaptureControl(nil);
pnlDragMode := false;
Screen.Cursor := crDefault;
if pnlDragged then
begin
UpdateFlame;
pnlDragged := False;
end;
end;
end;
procedure TAdjustForm.DragPanelDblClick(Sender: TObject);
var
pValue: ^double;
begin
if (Sender = pnlMasterScale) then
begin
pValue := @cp.pixels_per_unit;
if pValue^ = 32 then exit;
pValue^ := 32;
editPPU.Text := FloatToStr(pValue^);
end
else if (Sender = pnlZoom) then
begin
scrollZoom.Position := 0;
end
else if (Sender = pnlXpos) then
begin
scrollCenterX.Position := 0;
end
else if (Sender = pnlYpos) then
begin
scrollCenterY.Position := 0;
end
else if (Sender = pnlAngle) then
begin
scrollAngle.Position := 18000;
end
else if (Sender = pnlGamma) then
begin
scrollGamma.Position := 400;
end
else if (Sender = pnlBrightness) then
begin
scrollBrightness.Position := 400;
end
else if (Sender = pnlVibrancy) then
begin
scrollVibrancy.Position := 100;
end
else assert(false);
UpdateFlame;
end;
end. end.

View File

@ -15,15 +15,7 @@ type
nrbatches: integer; nrbatches: integer;
batchcounter: Pinteger; batchcounter: Pinteger;
BucketWidth: Int64; BucketWidth, BucketHeight: integer;
BucketHeight: Int64;
{
bounds: array[0..3] of extended;
size: array[0..1] of extended;
RotationCenter: array[0..1] of extended;
}
FinalXform: ^TXform;
UseFinalXform: boolean;
camX0, camY0, camW, camH, camX0, camY0, camW, camH,
bws, bhs, cosa, sina, rcX, rcY: double; bws, bhs, cosa, sina, rcX, rcY: double;
@ -37,10 +29,8 @@ type
procedure Execute; override; procedure Execute; override;
procedure AddPointsToBuckets(const points: TPointsArray); procedure AddPointsToBuckets(const points: TPointsArray);
procedure AddPointsToBucketsAngle(const points: TPointsArray); procedure AddPointsToBucketsAngle(const points: TPointsArray);
procedure AddPointsWithFX(const points: TPointsArray);
procedure AddPointsWithAngleFX(const points: TPointsArray);
end; end;
implementation implementation
@ -75,36 +65,6 @@ begin
end; end;
end; end;
procedure TBucketFillerThread.AddPointsWithFX(const points: TPointsArray);
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
px := points[i].x - camX0;
if (px < 0) or (px > camW) then continue;
py := points[i].y - camY0;
if (py < 0) or (py > camH) then continue;
Bucket := @TBucketArray(buckets^)[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TBucketFillerThread.AddPointsToBucketsAngle(const points: TPointsArray); procedure TBucketFillerThread.AddPointsToBucketsAngle(const points: TPointsArray);
var var
@ -131,38 +91,10 @@ begin
end; end;
end; end;
procedure TBucketFillerThread.AddPointsWithAngleFX(const points: TPointsArray);
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do
begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
px := points[i].x * cosa + points[i].y * sina + rcX;
if (px < 0) or (px > camW) then continue;
py := points[i].y * cosa - points[i].x * sina + rcY;
if (py < 0) or (py > camH) then continue;
Bucket := @TBucketArray(buckets^)[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
constructor TBucketFillerThread.Create(cp: TControlPoint); constructor TBucketFillerThread.Create(cp: TControlPoint);
var
i, n: integer;
begin begin
inherited Create(True); inherited Create(True);
Self.FreeOnTerminate := True; Self.FreeOnTerminate := True;
@ -171,8 +103,7 @@ begin
SetLength(Points, SUB_BATCH_SIZE); SetLength(Points, SUB_BATCH_SIZE);
FinalXForm := @fcp.xform[fcp.NumXForms]; fcp.Prepare;
UseFinalXForm := fcp.finalXformEnabled and fcp.HasFinalXform;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -191,18 +122,10 @@ var
begin begin
inherited; inherited;
if FCP.FAngle = 0 then begin if FCP.FAngle = 0 then
if UseFinalXForm then AddPointsProc := AddPointsToBuckets
AddPointsProc := AddPointsWithFX else
else AddPointsProc := AddPointsToBucketsAngle;
AddPointsProc := AddPointsToBuckets;
end
else begin
if UseFinalXForm then
AddPointsProc := AddPointsWithAngleFX
else
AddPointsProc := AddPointsToBucketsAngle;
end;
bc := 0; bc := 0;
while (not Terminated) and (bc < Nrbatches) do begin while (not Terminated) and (bc < Nrbatches) do begin

View File

@ -24,8 +24,6 @@ uses
Classes, Windows, Cmap, XForm, XFormMan; Classes, Windows, Cmap, XForm, XFormMan;
const const
EPS = 1E-10;
NXFORMS = 100; NXFORMS = 100;
SUB_BATCH_SIZE = 10000; SUB_BATCH_SIZE = 10000;
@ -84,17 +82,15 @@ type
TPointsArray = array of TCPpoint; TPointsArray = array of TCPpoint;
TPointsXYArray = array of TXYpoint; TPointsXYArray = array of TXYpoint;
T2Cpoint = record
x, y, c1, c2: double;
end;
P2Cpoint = ^T2Cpoint; P2Cpoint = ^T2Cpoint;
T2CPointsArray = array of T2Cpoint; T2CPointsArray = array of T2Cpoint;
TControlPoint = class TControlPoint = class
public public
xform: array[0..NXFORMS] of TXForm; xform: array[0..NXFORMS] of TXForm;
// finalxform: TXForm; finalXform: ^TXForm;
finalXformEnabled: boolean; finalXformEnabled: boolean;
useFinalXform: boolean;
variation: TVariation; variation: TVariation;
cmap: TColorMap; cmap: TColorMap;
cmapindex: integer; cmapindex: integer;
@ -129,7 +125,6 @@ type
FAngle: Double; FAngle: Double;
FTwoColorDimensions: Boolean; FTwoColorDimensions: Boolean;
private private
procedure PreparePropTable;
function getppux: double; function getppux: double;
function getppuy: double; function getppuy: double;
@ -154,7 +149,8 @@ type
procedure IterateXYC(NrPoints: integer; var Points: TPointsArray); procedure IterateXYC(NrPoints: integer; var Points: TPointsArray);
procedure IterateXYCC(NrPoints: integer; var Points: T2CPointsArray); procedure IterateXYCC(NrPoints: integer; var Points: T2CPointsArray);
procedure Testiterate(NrPoints: integer; var Points: TPointsArray); procedure Prepare;
// procedure Testiterate(NrPoints: integer; var Points: TPointsArray);
function Clone: TControlPoint; function Clone: TControlPoint;
procedure Copy(cp1: TControlPoint); procedure Copy(cp1: TControlPoint);
@ -215,7 +211,6 @@ begin
for i := 0 to NXFORMS do begin for i := 0 to NXFORMS do begin
xform[i] := TXForm.Create; xform[i] := TXForm.Create;
end; end;
// finalxform := TXForm.Create;
pulse[0][0] := 0; pulse[0][0] := 0;
pulse[0][1] := 60; pulse[0][1] := 60;
@ -255,6 +250,8 @@ begin
white_level := 200; white_level := 200;
FTwoColorDimensions := False; FTwoColorDimensions := False;
finalXformEnabled := false;
end; end;
destructor TControlPoint.Destroy; destructor TControlPoint.Destroy;
@ -263,14 +260,13 @@ var
begin begin
for i := 0 to NXFORMS - 1 do for i := 0 to NXFORMS - 1 do
xform[i].Free; xform[i].Free;
// finalxform.Free;
inherited; inherited;
end; end;
procedure TControlPoint.PreparePropTable; procedure TControlPoint.Prepare;
var var
i: Integer; i, n: Integer;
propsum: double; propsum: double;
LoopValue: double; LoopValue: double;
j: integer; j: integer;
@ -279,7 +275,12 @@ begin
SetLength(PropTable, PROP_TABLE_SIZE); SetLength(PropTable, PROP_TABLE_SIZE);
totValue := 0; totValue := 0;
for i := 0 to NXFORMS - 1 do begin n := NumXforms;
finalXform := @xform[n];
finalXform.Prepare;
useFinalXform := FinalXformEnabled and HasFinalXform;
for i := 0 to n - 1 do begin
xform[i].Prepare;
totValue := totValue + xform[i].density; totValue := totValue + xform[i].density;
end; end;
@ -290,10 +291,11 @@ begin
repeat repeat
inc(j); inc(j);
propsum := propsum + xform[j].density; propsum := propsum + xform[j].density;
until (propsum > LoopValue) or (j = NXFORMS - 1); until (propsum > LoopValue) or (j = n - 1);
PropTable[i] := @xform[j]; PropTable[i] := @xform[j];
LoopValue := LoopValue + TotValue / PROP_TABLE_SIZE; LoopValue := LoopValue + TotValue / PROP_TABLE_SIZE;
end; end;
end; end;
(* (*
@ -534,25 +536,33 @@ procedure TControlPoint.IterateXY(NrPoints: integer; var Points: TPointsXYArray)
var var
i: Integer; i: Integer;
px, py: double; px, py: double;
CurrentPoint: PXYPoint; pPoint: PXYPoint;
begin begin
px := 2 * random - 1; px := 2 * random - 1;
py := 2 * random - 1; py := 2 * random - 1;
PreparePropTable; // PreparePropTable;
// for i := 0 to NXFORMS do xform[i].prepare;
for i := 0 to NXFORMS - 1 do
xform[i].prepare;
try try
for i := 0 to FUSE do for i := 0 to FUSE do
PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
pPoint := @Points[0];
if UseFinalXform then
for i := 0 to NrPoints - 1 do begin for i := 0 to NrPoints - 1 do begin
PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
CurrentPoint := @Points[i]; pPoint^.X := px;
CurrentPoint.X := px; pPoint^.Y := py;
CurrentPoint.Y := py; finalXform^.NextPointXY(pPoint^.X, pPoint^.y);
Inc(pPoint);
end
else
for i := 0 to NrPoints - 1 do begin
PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
pPoint.X := px;
pPoint.Y := py;
Inc(pPoint);
end end
except except
on EMathError do begin on EMathError do begin
@ -562,31 +572,53 @@ begin
end; end;
procedure TControlPoint.IterateXYC(NrPoints: integer; var Points: TPointsArray); procedure TControlPoint.IterateXYC(NrPoints: integer; var Points: TPointsArray);
{ Variations for Draves conpatibility }
var var
i: Integer; i: Integer;
px, py, pc: double; p: TCPPoint;
CurrentPoint: PCPPoint; pPoint: PCPPoint;
begin begin
px := 2 * random - 1; {$if false}
py := 2 * random - 1; p.x := 2 * random - 1;
pc := random; p.y := 2 * random - 1;
p.c := random;
{$else}
asm
fld1
call System.@RandExt
fadd st, st
fsub st, st(1)
fstp qword ptr [p.x]
call System.@RandExt
fadd st, st
fsubrp st(1), st
fstp qword ptr [p.y]
call System.@RandExt
fstp qword ptr [p.c]
end;
{$ifend}
PreparePropTable; // PreparePropTable;
// for i := 0 to NXFORMS do xform[i].prepare;
for i := 0 to NXFORMS - 1 do
xform[i].prepare;
try try
for i := 0 to FUSE do for i := 0 to FUSE do
PropTable[Random(PROP_TABLE_SIZE)].NextPoint(px,py,pc); PropTable[Random(PROP_TABLE_SIZE)].NextPoint(p);
pPoint := @Points[0];
if UseFinalXform then
for i := 0 to NrPoints - 1 do begin for i := 0 to NrPoints - 1 do begin
PropTable[Random(PROP_TABLE_SIZE)].NextPoint(px,py,pc); PropTable[Random(PROP_TABLE_SIZE)].NextPoint(p);
CurrentPoint := @Points[i]; finalXform^.NextPointTo(p, pPoint^);
CurrentPoint.X := px; Inc(pPoint);
CurrentPoint.Y := py; end
CurrentPoint.C := pc; else
for i := 0 to NrPoints - 1 do begin
PropTable[Random(PROP_TABLE_SIZE)].NextPoint(p);
pPoint^.x := p.x;
pPoint^.y := p.y;
pPoint^.c := p.c;
Inc(pPoint);
end end
except except
on EMathError do begin on EMathError do begin
@ -596,6 +628,7 @@ begin
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
{
procedure TControlPoint.Testiterate(NrPoints: integer; var Points: TPointsArray); procedure TControlPoint.Testiterate(NrPoints: integer; var Points: TPointsArray);
var var
i: Integer; i: Integer;
@ -640,35 +673,46 @@ begin
end end
end; end;
end; end;
}
procedure TControlPoint.IterateXYCC(NrPoints: integer; var Points: T2CPointsArray); procedure TControlPoint.IterateXYCC(NrPoints: integer; var Points: T2CPointsArray);
var var
i: Integer; i: Integer;
px, py, pc1, pc2: double; //px, py, pc1, pc2: double;
p: T2CPoint;
CurrentPoint: P2Cpoint; CurrentPoint: P2Cpoint;
begin begin
px := 2 * random - 1; p.x := 2 * random - 1;
py := 2 * random - 1; p.y := 2 * random - 1;
pc1 := random; p.c1 := random;
pc2 := random; p.c2 := random;
PreparePropTable; // PreparePropTable;
// for i := 0 to NXFORMS do xform[i].prepare;
for i := 0 to NXFORMS - 1 do
xform[i].prepare;
try try
for i := 0 to FUSE do for i := 0 to FUSE do
PropTable[Random(PROP_TABLE_SIZE)].NextPoint2C(px, py, pc1, pc2); PropTable[Random(PROP_TABLE_SIZE)].NextPoint2C(p);//px, py, pc1, pc2);
CurrentPoint := @Points[0];
if UseFinalXform then
for i := 0 to NrPoints - 1 do begin for i := 0 to NrPoints - 1 do begin
PropTable[Random(PROP_TABLE_SIZE)].NextPoint2C(px, py, pc1, pc2); PropTable[Random(PROP_TABLE_SIZE)].NextPoint2C(p);//px, py, pc1, pc2);
CurrentPoint := @Points[i]; CurrentPoint.X := p.x;
CurrentPoint.X := px; CurrentPoint.Y := p.y;
CurrentPoint.Y := py; CurrentPoint.C1 := p.c1;
CurrentPoint.C1 := pc1; CurrentPoint.C2 := p.c2;
CurrentPoint.C2 := pc2; finalXform^.NextPoint2C(CurrentPoint^);
Inc(CurrentPoint);
end
else
for i := 0 to NrPoints - 1 do begin
PropTable[Random(PROP_TABLE_SIZE)].NextPoint2C(p);
CurrentPoint.X := p.x;
CurrentPoint.Y := p.y;
CurrentPoint.C1 := p.c1;
CurrentPoint.C2 := p.c2;
Inc(CurrentPoint);
end end
except except
on EMathError do begin on EMathError do begin
@ -680,7 +724,7 @@ end;
function TControlPoint.BlowsUp(NrPoints: integer): boolean; function TControlPoint.BlowsUp(NrPoints: integer): boolean;
var var
i: Integer; i, n: Integer;
px, py: double; px, py: double;
minx, maxx, miny, maxy: double; minx, maxx, miny, maxy: double;
Points: TPointsXYArray; Points: TPointsXYArray;
@ -688,25 +732,25 @@ var
begin begin
Result := false; Result := false;
SetLength(Points, SUB_BATCH_SIZE); n := min(SUB_BATCH_SIZE, NrPoints);
SetLength(Points, n);
px := 2 * random - 1; px := 2 * random - 1;
py := 2 * random - 1; py := 2 * random - 1;
PreparePropTable; Prepare;
for i := 0 to NXFORMS - 1 do
xform[i].prepare;
try try
for i := 0 to FUSE do for i := 0 to FUSE do
PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
for i := 0 to NrPoints - 1 do begin CurrentPoint := @Points[0];
for i := 0 to n-1 do begin
PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py); PropTable[Random(PROP_TABLE_SIZE)].NextPointXY(px,py);
CurrentPoint := @Points[i];
CurrentPoint.X := px; CurrentPoint.X := px;
CurrentPoint.Y := py; CurrentPoint.Y := py;
Inc(CurrentPoint);
// random CPs don't use finalXform...
end; end;
except except
on EMathError do begin on EMathError do begin
@ -720,7 +764,7 @@ begin
maxx := -1E10; maxx := -1E10;
miny := 1E10; miny := 1E10;
maxy := -1E10; maxy := -1E10;
for i := 0 to SUB_BATCH_SIZE - 1 do begin for i := 0 to n-1 do begin
minx := min(minx, Points[i].x); minx := min(minx, Points[i].x);
maxx := max(maxx, Points[i].x); maxx := max(maxx, Points[i].x);
miny := min(miny, Points[i].y); miny := min(miny, Points[i].y);
@ -1085,7 +1129,7 @@ end;
procedure TControlPoint.CalcBoundbox; procedure TControlPoint.CalcBoundbox;
var var
Points: TPointsArray; Points: TPointsXYArray;
i, j: integer; i, j: integer;
deltax, minx, maxx: double; deltax, minx, maxx: double;
cntminx, cntmaxx: integer; cntminx, cntmaxx: integer;
@ -1108,7 +1152,18 @@ begin
1: iterateXYC(SUB_BATCH_SIZE, points); 1: iterateXYC(SUB_BATCH_SIZE, points);
end; end;
} }
IterateXYC(SUB_BATCH_SIZE, points); Prepare;
IterateXY(SUB_BATCH_SIZE, points);
{ if finalXformEnabled and HasFinalXform then begin
try
finalXform := @xform[NumXforms];
for i := 0 to SUB_BATCH_SIZE - 1 do
finalXform.NextPoint(points[i]);
except
end
end;}
LimitOutSidePoints := Round(0.05 * SUB_BATCH_SIZE); LimitOutSidePoints := Round(0.05 * SUB_BATCH_SIZE);
@ -1678,12 +1733,9 @@ begin
begin begin
Result := (c[0,0]<>1) or (c[0,1]<>0) or(c[1,0]<>0) or (c[1,1]<>1) or (c[2,0]<>0) or (c[2,1]<>0) or Result := (c[0,0]<>1) or (c[0,1]<>0) or(c[1,0]<>0) or (c[1,1]<>1) or (c[2,0]<>0) or (c[2,1]<>0) or
(p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) or (p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) or
(symmetry <> 1); (symmetry <> 1) or (vars[0] <> 1);
if Result = false then if Result = false then
begin
Result := Result or (vars[0] <> 1);
for i := 1 to NRVAR-1 do Result := Result or (vars[i] <> 0); for i := 1 to NRVAR-1 do Result := Result or (vars[i] <> 0);
end
end; end;
end; end;

View File

@ -96,7 +96,7 @@ object EditForm: TEditForm
Left = 0 Left = 0
Top = 0 Top = 0
Hint = 'New blank flame' Hint = 'New blank flame'
Caption = 'Reset All' Caption = 'New blank flame'
ImageIndex = 0 ImageIndex = 0
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -252,16 +252,16 @@ object EditForm: TEditForm
ImageIndex = 14 ImageIndex = 14
Style = tbsSeparator Style = tbsSeparator
end end
object tbEnableFinalXform: TToolButton object tbVarPreview: TToolButton
Left = 332 Left = 332
Top = 0 Top = 0
Hint = 'Enable final transform' Hint = 'Show/hide variation preview'
Caption = 'Show Final Xform' Caption = 'Variation Preview'
ImageIndex = 15 ImageIndex = 14
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Style = tbsCheck Style = tbsCheck
OnClick = tbEnableFinalXformClick OnClick = tbVarPreviewClick
end end
object ToolButton3: TToolButton object ToolButton3: TToolButton
Left = 357 Left = 357
@ -271,16 +271,16 @@ object EditForm: TEditForm
ImageIndex = 16 ImageIndex = 16
Style = tbsSeparator Style = tbsSeparator
end end
object tbVarPreview: TToolButton object tbEnableFinalXform: TToolButton
Left = 365 Left = 365
Top = 0 Top = 0
Hint = 'Show/hide variation preview' Hint = 'Enable final transform'
Caption = 'Variation Preview' Caption = 'Show Final Xform'
ImageIndex = 14 ImageIndex = 15
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Style = tbsCheck Style = tbsCheck
OnClick = tbVarPreviewClick OnClick = tbEnableFinalXformClick
end end
end end
end end
@ -1153,16 +1153,6 @@ object EditForm: TEditForm
end end
object tabXForm: TTabSheet object tabXForm: TTabSheet
Caption = 'Transform' Caption = 'Transform'
object lblWeight: TLabel
Left = 10
Top = 126
Width = 38
Height = 13
Hint = '"weight" is the probability of this transform to be applied'
Caption = 'Weight:'
ParentShowHint = False
ShowHint = True
end
object btnResetCoefs: TSpeedButton object btnResetCoefs: TSpeedButton
Left = 8 Left = 8
Top = 76 Top = 76
@ -1294,6 +1284,24 @@ object EditForm: TEditForm
ShowHint = True ShowHint = True
OnClick = btnSwapXformsClick OnClick = btnSwapXformsClick
end end
object pnlWeight: TPanel
Left = 8
Top = 122
Width = 88
Height = 21
Cursor = crHandPoint
Hint = '"Weight" is the probability of this transform to be applied'
Alignment = taLeftJustify
BevelOuter = bvLowered
Caption = ' Weight:'
ParentShowHint = False
ShowHint = True
TabOrder = 14
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object txtA: TEdit object txtA: TEdit
Left = 36 Left = 36
Top = 4 Top = 4
@ -1503,12 +1511,23 @@ object EditForm: TEditForm
Height = 100 Height = 100
Caption = 'Transform color' Caption = 'Transform color'
TabOrder = 0 TabOrder = 0
object Label29: TLabel object pnlSymmetry: TPanel
Left = 10 Left = 8
Top = 72 Top = 70
Width = 52 Width = 73
Height = 13 Height = 21
Caption = 'Symmetry:' Cursor = crHandPoint
Hint = 'Symmetry'
Alignment = taLeftJustify
BevelOuter = bvLowered
Caption = ' Symmetry:'
ParentShowHint = False
ShowHint = True
TabOrder = 3
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end end
object scrlXFormColor: TScrollBar object scrlXFormColor: TScrollBar
Left = 8 Left = 8
@ -1525,10 +1544,15 @@ object EditForm: TEditForm
object pnlXFormColor: TPanel object pnlXFormColor: TPanel
Left = 8 Left = 8
Top = 16 Top = 16
Width = 65 Width = 73
Height = 21 Height = 21
Cursor = crHandPoint
BevelOuter = bvLowered BevelOuter = bvLowered
TabOrder = 1 TabOrder = 1
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end end
object txtXFormColor: TEdit object txtXFormColor: TEdit
Left = 80 Left = 80
@ -1539,21 +1563,15 @@ object EditForm: TEditForm
OnExit = txtXFormColorExit OnExit = txtXFormColorExit
OnKeyPress = txtXFormColorKeyPress OnKeyPress = txtXFormColorKeyPress
end end
object txtSymmetry: TComboBox object txtSymmetry: TEdit
Left = 80 Left = 80
Top = 70 Top = 70
Width = 57 Width = 57
Height = 21 Height = 21
ItemHeight = 13 TabOrder = 4
ItemIndex = 0
TabOrder = 3
Text = '0' Text = '0'
OnExit = txtSymmetrySet OnExit = txtSymmetrySet
OnKeyPress = txtSymmetryKeyPress OnKeyPress = txtSymmetrKeyPress
OnSelect = txtSymmetrySet
Items.Strings = (
'0'
'1')
end end
end end
object GroupBox2: TGroupBox object GroupBox2: TGroupBox
@ -1648,65 +1666,6 @@ object EditForm: TEditForm
Images = EditorTB Images = EditorTB
Left = 352 Left = 352
Top = 40 Top = 40
object mnuAutoZoom: TMenuItem
Caption = 'Auto Zoom'
Hint = 'Zoom to fit all triangles'
OnClick = mnuAutoZoomClick
end
object N1: TMenuItem
Caption = '-'
end
object mnuDelete: TMenuItem
Caption = 'Delete'
Hint = 'Delete selected triangle'
ImageIndex = 3
OnClick = mnuDeleteClick
end
object mnuDuplicate: TMenuItem
Caption = 'Duplicate'
Hint = 'Duplicate selected triangle'
ImageIndex = 2
OnClick = mnuDupClick
end
object mnuAdd: TMenuItem
Caption = 'Add'
Hint = 'Add new triangle'
ImageIndex = 1
OnClick = mnuAddClick
end
object N4: TMenuItem
Caption = '-'
end
object mnuFlipVertical: TMenuItem
Caption = 'Flip Vertical'
Hint = 'Flip triangle vertical'
ImageIndex = 11
OnClick = mnuFlipVerticalClick
end
object mnuFlipHorizontal: TMenuItem
Caption = 'Flip Horizontal'
Hint = 'Flip triangle horizontal'
ImageIndex = 10
OnClick = mnuFlipHorizontalClick
end
object N5: TMenuItem
Caption = '-'
end
object mnuVerticalFlipAll: TMenuItem
Caption = 'Flip All Vertical '
Hint = 'Flip all triangles vertical'
ImageIndex = 13
OnClick = mnuVerticalFlipAllClick
end
object mnuHorizintalFlipAll: TMenuItem
Caption = 'Flip All Horizontal'
Hint = 'Flip all triangles horizontal'
ImageIndex = 12
OnClick = mnuHorizintalFlipAllClick
end
object MenuItem1: TMenuItem
Caption = '-'
end
object mnuUndo: TMenuItem object mnuUndo: TMenuItem
Caption = 'Undo' Caption = 'Undo'
Enabled = False Enabled = False
@ -1723,6 +1682,45 @@ object EditForm: TEditForm
ShortCut = 16473 ShortCut = 16473
OnClick = mnuRedoClick OnClick = mnuRedoClick
end end
object N1: TMenuItem
Caption = '-'
end
object mnuAutoZoom: TMenuItem
Caption = 'Auto Zoom'
Hint = 'Zoom to fit all triangles'
ImageIndex = 20
OnClick = mnuAutoZoomClick
end
object mnuShowVarPreview: TMenuItem
Caption = 'Show Variation Preview'
Hint = 'Show/hide variation preview'
ImageIndex = 14
OnClick = tbVarPreviewClick
end
object N4: TMenuItem
Caption = '-'
end
object mnuAdd: TMenuItem
Caption = 'Add'
Hint = 'Add new triangle'
ImageIndex = 1
OnClick = mnuAddClick
end
object N5: TMenuItem
Caption = '-'
end
object mnuVerticalFlipAll: TMenuItem
Caption = 'Flip All Vertical '
Hint = 'Flip all triangles vertical'
ImageIndex = 13
OnClick = mnuVerticalFlipAllClick
end
object mnuHorizintalFlipAll: TMenuItem
Caption = 'Flip All Horizontal'
Hint = 'Flip all triangles horizontal'
ImageIndex = 12
OnClick = mnuHorizintalFlipAllClick
end
end end
object QualityPopup: TPopupMenu object QualityPopup: TPopupMenu
Images = MainForm.Buttons Images = MainForm.Buttons
@ -1754,11 +1752,11 @@ object EditForm: TEditForm
end end
end end
object EditorTB: TImageList object EditorTB: TImageList
Left = 353 Left = 313
Top = 80 Top = 40
Bitmap = { Bitmap = {
494C010110001300040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 494C010115001800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000005000000001002000000000000050 0000000000003600000028000000400000006000000001002000000000000060
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -1808,6 +1806,7 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000054545400000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -1815,6 +1814,7 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000005454540000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -1822,6 +1822,7 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000545454000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -1829,6 +1830,7 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000054545400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -1888,6 +1890,130 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000002424
2400242424002424240000000000000000000000000000000000242424002424
2400242424000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000002424
2400000000002424240000000000000000000000000000000000242424000000
0000242424000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000002424
2400000000002424240000000000000000000000000000000000242424000000
0000242424000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF00FFFF
FF00FFFFFF00000000000000000000000000000000000000000000000000FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000024242400000000000000000000000000000000002424
2400000000002424240000000000000000000000000000000000242424000000
0000242424000000000000000000000000000000000024242400000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000002424240024242400000000000000000000000000000000002424
2400000000002424240000000000000000000000000000000000242424000000
0000242424000000000000000000000000000000000024242400242424000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000242424002424240024242400000000000000000000000000000000002424
2400000000002424240000000000000000000000000000000000242424000000
0000242424000000000000000000000000000000000024242400242424002424
2400000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000002424
2400242424000000000024242400000000000000000000000000000000002424
2400000000002424240000000000000000000000000000000000242424000000
0000242424000000000000000000000000000000000024242400000000002424
2400242424000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000242424002424
2400000000000000000024242400242424002424240024242400242424002424
2400000000002424240000000000000000000000000000000000242424000000
0000242424002424240024242400242424002424240024242400000000000000
0000242424002424240000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000005454
5400000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000024242400242424000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000002424240000000000000000000000000000000000242424000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000002424240024242400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000545454000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000242424002424
2400000000000000000024242400242424002424240024242400242424002424
2400242424002424240000000000000000000000000000000000242424002424
2400242424002424240024242400242424002424240024242400000000000000
0000242424002424240000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000054545400000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000FFFFFF00C0C0C000C0C0C000FFFFFF00000000000000
0000000000000000000000000000000000000000000000000000000000002424
2400242424000000000024242400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000024242400000000002424
2400242424000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000005454540000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000242424002424240024242400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000024242400242424002424
2400000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FFFFFF00FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF00FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000002424240024242400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000024242400242424000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000FFFFFF00C0C0C000C0C0C000FFFFFF00000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000024242400000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000024242400000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000 0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -1901,8 +2027,96 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000 0000000000000000000049004B00000000000000000049004B00000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
000000000000000000000000000049004B000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000FFFFFF00FFFF
FF00FFFFFF00000000000000000000000000000000000000000000000000FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000049004B000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000049004B0000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
00000000000000000000EBEBEB00A0A0A000A0A0A000EBEBEB00000000000000
000000000000000000000000000049004B000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000EBEBEB00EBEBEB00EBEBEB000000000000000000EBEBEB00EBEBEB00EBEB
EB00000000000000000000000000000000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000008000800080008000800080008000
8000000000000000000080008000800080008000800080008000800080008000
8000800080008000800080008000800080000000000000000000000000000000
0000EBEBEB00EBEBEB00EBEBEB000000000000000000EBEBEB00EBEBEB00EBEB
EB00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
00000000000000000000EBEBEB00A0A0A000A0A0A000EBEBEB00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000049004B000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000049004B0000000000000000000000000000000000000000000000
0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000080000000800000008000000080000000800000008000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000 0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -1910,103 +2124,15 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000004900 0000000000000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000 4B00000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000000000 000049004B000000000000000000000000000000000000000000000000000000
0000000000000080000000800000008000000080000000800000008000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000049004B000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000049004B0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
00000000000000000000EBEBEB00A0A0A000A0A0A000EBEBEB00000000000000
000000000000000000000000000049004B000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000EBEBEB00EBEBEB00EBEBEB000000000000000000EBEBEB00EBEBEB00EBEB
EB00000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000008000800080008000800080008000
8000000000000000000080008000800080008000800080008000800080008000
8000800080008000800080008000800080000000000000000000000000000000
0000EBEBEB00EBEBEB00EBEBEB000000000000000000EBEBEB00EBEBEB00EBEB
EB00000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
00000000000000000000EBEBEB00A0A0A000A0A0A000EBEBEB00000000000000
000000000000000000000000000049004B000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000049004B000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000049004B0000000000000000000000000000000000FFFFFF00FFFF
FF00FFFFFF00000000000000000000000000000000000000000000000000FFFF
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000049004B0000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000
000000000000000000000000000049004B000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000004900
4B00000000000000000000000000000000000000000000000000000000000000
000049004B000000000000000000000000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000 0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000049004B00000000000000000049004B00000000000000 0000000000000000000049004B00000000000000000049004B00000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000008000800000000000000000000000 0000000000000000000000000000000000008000800000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -2014,7 +2140,7 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
@ -2400,16 +2526,20 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000 000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000500000000100010000000000800200000000000000000000 2800000040000000600000000100010000000000000300000000000000000000
000000000000000000000000FFFFFF0000000000000000000000000000000000 000000000000000000000000FFFFFF00FFFF000000000000AAAB000000000000
0000000000000000000000000000000000000000000000000000000000000000 FFFD000000000000BFFF000000000000FFFD000000000000B80F000000000000
0000000000000000000000000000000000000000000000000000000000000000 FB9D000000000000BB3F000000000000FA7D000000000000B8FF000000000000
0000000000000000000000000000000000000000000000000000000000000000 F9FD000000000000BBFF000000000000FFFD000000000000BFFF000000000000
00000000000000000000000000000000FF7FFFFFFFFFFFFFFF7FFFFFFDBFE1B7 D555000000000000FFFF0000000000008F11FFFFFFFFFFFF8F11FFE3C7FFFEFF
FF7FFFFFEFF7EDA7E00FF3E77DBEED97E007E1E7F7EFE1B7FF63C0E7DC3BFFFF 8F11FFE3C7FFFFFF8383FFE3C7FFFEFF83C7FDE3C7BFFFFF8383F9E3C79FFEFF
FF73F3E7700E8F11FF73F3E7E0078F11FB730000E0078F11F363F3E7700E8383 8111F1E3C78FFFFF8111E1E3C787AA028111C003C003FEE7FFFF8003C001FECF
E007F3E7DC3B83C7E00FF1C7F7EF8383F37FF80F7DBE8111FB7FFC1FEFF78111 FC3FC003C003FE9FF00FE1FFFF87FE3FE007F1FFFF8FFE7FE007F9FFFF9FFEFF
FF7FFFFFFDBF8111FF7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0070001FEFF8003 F00FFDFFFFBFFFFFFC3FFFFFFFFFFEFFFF7FFFFFFFFF8F11FF7FFFFFFDBF8F11
FF7FFFFFEFF78F11E00FF3E77DBE8383E007E1E7F7EF83C7FF63C0E7DC3B8383
FF73F3E7700E8111FF73F3E7E0078111FB730000E0078111F363F3E7700EFFFF
E007F3E7DC3BFE7FE00FF1C7F7EFFE7FF37FF80F7DBEF81FFB7FFC1FEFF7F81F
FF7FFFFFFDBFFE7FFF7FFFFFFFFFFE7FFFFFFFFFFFFFFFFFF0070001FEFF8003
F9F79FFD7FFDCFE7FCF7C8053EF9E7CFF277E4F51FF1F39FEF37F2754EE5F93F F9F79FFD7FFDCFE7FCF7C8053EF9E7CFF277E4F51FF1F39FEF37F2754EE5F93F
EF97F93567CDFC7FDFC7FC95729DFEFFDFE7FE45793D5555DFF7FF25729DFEFF EF97F93567CDFC7FDFC7FC95729DFEFFDFE7FE45793D5555DFF7FF25729DFEFF
DFFFFF9567CDFC7FEFC3FFCD4EE5F93FEFF3FFE51FF1F39FF3CBFFF13EF9E7CF DFFFFF9567CDFC7FEFC3FFCD4EE5F93FEFF3FFE51FF1F39FF3CBFFF13EF9E7CF
@ -2424,4 +2554,62 @@ object EditForm: TEditForm
C03FF3FFFFCFDFDFFFFFF3FFFFEFFFFF00000000000000000000000000000000 C03FF3FFFFCFDFDFFFFFF3FFFFEFFFFF00000000000000000000000000000000
000000000000} 000000000000}
end end
object TrianglePopup: TPopupMenu
AutoPopup = False
Images = EditorTB
Left = 353
Top = 73
object mnuReset: TMenuItem
Caption = 'Reset'
Hint = 'Reset triangle position'
ImageIndex = 19
OnClick = mnuResetClick
end
object N6: TMenuItem
Caption = '-'
end
object mnuDuplicate: TMenuItem
Caption = 'Duplicate'
Hint = 'Duplicate selected triangle'
ImageIndex = 2
OnClick = mnuDupClick
end
object mnuDelete: TMenuItem
Caption = 'Delete'
Hint = 'Delete selected triangle'
ImageIndex = 3
OnClick = mnuDeleteClick
end
object mnuAdd1: TMenuItem
Caption = 'Add'
Hint = 'Add new triangle'
ImageIndex = 1
OnClick = mnuAddClick
end
object N2: TMenuItem
Caption = '-'
end
object Rotatetriangle90CCW1: TMenuItem
Caption = 'Rotate triangle 90'#176' CCW'
ImageIndex = 17
OnClick = btTrgRotateLeft90Click
end
object Rotatetriangle90CCW2: TMenuItem
Caption = 'Rotate triangle 90'#176' CW'
ImageIndex = 18
OnClick = btTrgRotateRight90Click
end
object mnuFlipHorizontal: TMenuItem
Caption = 'Flip Horizontal'
Hint = 'Flip triangle horizontal'
ImageIndex = 10
OnClick = mnuFlipHorizontalClick
end
object mnuFlipVertical: TMenuItem
Caption = 'Flip Vertical'
Hint = 'Flip triangle vertical'
ImageIndex = 11
OnClick = mnuFlipVerticalClick
end
end
end end

View File

@ -1,5 +1,6 @@
{ {
Apophysis Copyright (C) 2001-2004 Mark Townsend Apophysis Copyright (C) 2001-2004 Mark Townsend
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Boris, Peter Sdobnov
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -24,7 +25,7 @@ uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, Math, Menus, ToolWin, Registry, ExtCtrls, StdCtrls, ComCtrls, Math, Menus, ToolWin, Registry,
ControlPoint, Render, cmap, Grids, ValEdit, Buttons, ImgList, CustomDrawControl, ControlPoint, Render, cmap, Grids, ValEdit, Buttons, ImgList, CustomDrawControl,
Types, xform; Types, XForm;
const const
// PixelCountMax = 32768; // PixelCountMax = 32768;
@ -35,7 +36,6 @@ const
crEditRotate = 22; crEditRotate = 22;
crEditScale = 23; crEditScale = 23;
type PXForm = ^TXForm;
type type
TEditForm = class(TForm) TEditForm = class(TForm)
GrphPnl: TPanel; GrphPnl: TPanel;
@ -45,9 +45,6 @@ type
PrevPnl: TPanel; PrevPnl: TPanel;
PreviewImage: TImage; PreviewImage: TImage;
EditPopup: TPopupMenu; EditPopup: TPopupMenu;
MenuItem1: TMenuItem;
mnuDelete: TMenuItem;
mnuDuplicate: TMenuItem;
mnuAdd: TMenuItem; mnuAdd: TMenuItem;
mnuAutoZoom: TMenuItem; mnuAutoZoom: TMenuItem;
N1: TMenuItem; N1: TMenuItem;
@ -66,7 +63,6 @@ type
PageControl: TPageControl; PageControl: TPageControl;
TriangleTab: TTabSheet; TriangleTab: TTabSheet;
tabXForm: TTabSheet; tabXForm: TTabSheet;
lblWeight: TLabel;
txtA: TEdit; txtA: TEdit;
txtB: TEdit; txtB: TEdit;
txtC: TEdit; txtC: TEdit;
@ -144,7 +140,6 @@ type
ToolButton2: TToolButton; ToolButton2: TToolButton;
tbVarPreview: TToolButton; tbVarPreview: TToolButton;
trkVarPreviewDepth: TTrackBar; trkVarPreviewDepth: TTrackBar;
Label29: TLabel;
chkPreserve: TCheckBox; chkPreserve: TCheckBox;
btnXpost: TSpeedButton; btnXpost: TSpeedButton;
btnYpost: TSpeedButton; btnYpost: TSpeedButton;
@ -157,7 +152,6 @@ type
txtPost21: TEdit; txtPost21: TEdit;
btnResetPostXForm: TSpeedButton; btnResetPostXForm: TSpeedButton;
btnSwapXforms: TSpeedButton; btnSwapXforms: TSpeedButton;
txtSymmetry: TComboBox;
GroupBox3: TGroupBox; GroupBox3: TGroupBox;
editPivotY: TEdit; editPivotY: TEdit;
editPivotX: TEdit; editPivotX: TEdit;
@ -167,6 +161,19 @@ type
tbEnableFinalXform: TToolButton; tbEnableFinalXform: TToolButton;
chkUseXFormColor: TCheckBox; chkUseXFormColor: TCheckBox;
ToolButton3: TToolButton; ToolButton3: TToolButton;
TrianglePopup: TPopupMenu;
mnuDuplicate: TMenuItem;
mnuDelete: TMenuItem;
mnuAdd1: TMenuItem;
N2: TMenuItem;
mnuShowVarPreview: TMenuItem;
mnuReset: TMenuItem;
N6: TMenuItem;
Rotatetriangle90CCW1: TMenuItem;
Rotatetriangle90CCW2: TMenuItem;
txtSymmetry: TEdit;
pnlWeight: TPanel;
pnlSymmetry: TPanel;
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);
@ -226,7 +233,7 @@ type
procedure txtXFormColorExit(Sender: TObject); procedure txtXFormColorExit(Sender: TObject);
procedure txtXFormColorKeyPress(Sender: TObject; var Key: Char); procedure txtXFormColorKeyPress(Sender: TObject; var Key: Char);
procedure txtSymmetrySet(Sender: TObject); procedure txtSymmetrySet(Sender: TObject);
procedure txtSymmetryKeyPress(Sender: TObject; var Key: Char); procedure txtSymmetrKeyPress(Sender: TObject; var Key: Char);
procedure btTrgRotateLeftClick(Sender: TObject); procedure btTrgRotateLeftClick(Sender: TObject);
procedure btTrgRotateRightClick(Sender: TObject); procedure btTrgRotateRightClick(Sender: TObject);
@ -296,6 +303,13 @@ type
procedure VEVarsDrawCell(Sender: TObject; ACol, ARow: Integer; procedure VEVarsDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState); Rect: TRect; State: TGridDrawState);
procedure tbEnableFinalXformClick(Sender: TObject); procedure tbEnableFinalXformClick(Sender: TObject);
procedure DragPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DragPanelMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure DragPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DragPanelDblClick(Sender: TObject);
private private
TriangleView: TCustomDrawControl; TriangleView: TCustomDrawControl;
@ -314,17 +328,12 @@ type
mouseOverPos: TSPoint; mouseOverPos: TSPoint;
varDragMode: boolean; varDragMode: boolean;
varDragIndex :integer; varDragIndex: integer;
varDragValue: double; varDragValue: double;
varDragPos, varDragOld: integer; varDragPos, varDragOld: integer;
varMM: boolean; //hack? varMM: boolean; //hack?
{ showVarPreview: boolean;
spinnerMode: boolean;
spinnerOld, spinnerPos: integer;
spinnerValue: double;
SpinnerAssoc: TEdit;
}
// --Z-- variables moved from outside // --Z-- variables moved from outside
GraphZoom: double; GraphZoom: double;
@ -340,8 +349,9 @@ type
PivotMode: (pivotLocal, pivotWorld); PivotMode: (pivotLocal, pivotWorld);
VarsCache: array[0..64] of double; // hack: to prevent slow valuelist redraw VarsCache: array[0..64] of double; // hack: to prevent slow valuelist redraw
colorDrag, colorChanged: boolean; pnlDragMode: boolean;
colorDragX, colorOldX: integer; pnlDragPos, pnlDragOld: integer;
pnlDragValue: double;
(* (*
{ Options } { Options }
@ -405,10 +415,6 @@ implementation
uses uses
Main, Global, Adjust, Mutate, XformMan; Main, Global, Adjust, Mutate, XformMan;
const
SUB_BATCH_SIZE = 1000;
SC_MyMenuItem1 = WM_USER + 1;
var var
oldTriangle: TTriangle; oldTriangle: TTriangle;
gCenterX: double; gCenterX: double;
@ -587,7 +593,6 @@ procedure TEditForm.UpdateDisplay(PreviewOnly: boolean = false);
var var
i: integer; i: integer;
// pw, ph: integer; // pw, ph: integer;
r: double;
begin begin
// currently EditForm does not really know if we select another // currently EditForm does not really know if we select another
// flame in the Main Window - which is not good... // flame in the Main Window - which is not good...
@ -602,7 +607,7 @@ begin
if SelectedTriangle > LastTriangle{???} then//NumXForms(cp) then if SelectedTriangle > LastTriangle{???} then//NumXForms(cp) then
begin begin
SelectedTriangle := NumXForms(cp)-1; SelectedTriangle := cp.NumXForms-1;
mouseOverTriangle := -1; mouseOverTriangle := -1;
end; end;
@ -625,6 +630,7 @@ begin
HasChanged := false; HasChanged := false;
viewDragMode := false; viewDragMode := false;
varDragMode := false; varDragMode := false;
pnlDragMode := false;
CornerCaught := false; CornerCaught := false;
TriangleCaught := false; TriangleCaught := false;
@ -658,35 +664,6 @@ begin
PreviewImage.refresh; PreviewImage.refresh;
end; end;
(*
procedure TEditForm.ReadjustWeights(var cp: TControlPoint);
{ Thanks to Rudy...code from Chaos }
// --Z-- and thanks to me for removing this! ;-)
var
total, othertotals, excess: double;
t, i: integer;
begin
t := NumXForms(cp);
{ /* First determine the excess. */ }
total := 0.0;
othertotals := 0.0;
for i := 0 to T - 1 do
if cp.xform[i].density <> 0.0 then
begin
total := total + cp.xform[i].density;
if (i <> SelectedTriangle) then
othertotals := othertotals + cp.xform[i].density;
end;
{ /* Now we need to fix'em */ }
//z excess := total - 1.0;
excess := 1.0 - (total - 1.0)/othertotals; // --Z--
for i := 0 to T - 1 do
if (i <> SelectedTriangle) and (cp.xform[i].density <> 0) then
//z cp.xform[i].density := cp.xform[i].density - cp.xform[i].density / othertotals * excess;
cp.xform[i].density := cp.xform[i].density * excess; // --Z--
end;
*)
procedure TEditForm.ShowSelectedInfo; procedure TEditForm.ShowSelectedInfo;
var var
i: integer; i: integer;
@ -783,8 +760,6 @@ begin
editPivotY.Text := Format('%.6g', [WorldPivot.y]); editPivotY.Text := Format('%.6g', [WorldPivot.y]);
end; end;
if cp.finalXformEnabled then tbEnableFinalXform.Down := true;
PageControl.Refresh; PageControl.Refresh;
end; end;
@ -881,11 +856,11 @@ end;
procedure TEditForm.DeleteTriangle(t: integer); procedure TEditForm.DeleteTriangle(t: integer);
var var
i, j: integer; i: integer;
begin begin
if (t = Transforms ) then if (t = Transforms) then
begin begin
assert(cp.HasFinalXForm); assert(EnableFinalXform);
MainForm.UpdateUndo; MainForm.UpdateUndo;
EnableFinalXform := false; EnableFinalXform := false;
cp.finalXformEnabled := false; cp.finalXformEnabled := false;
@ -903,6 +878,7 @@ begin
if t = (Transforms - 1) then if t = (Transforms - 1) then
begin begin
MainTriangles[t] := MainTriangles[Transforms]; MainTriangles[t] := MainTriangles[Transforms];
cp.xform[t].Assign(cp.xform[Transforms]);
Dec(SelectedTriangle); Dec(SelectedTriangle);
end end
else begin else begin
@ -1145,7 +1121,7 @@ end;
TextOut(b.x+2, b.y+1, 'O'); TextOut(b.x+2, b.y+1, 'O');
end; end;
if tbVarPreview.Down then if showVarPreview then
begin begin
assert(trkVarPreviewRange.position > 0); assert(trkVarPreviewRange.position > 0);
assert(trkVarPreviewDensity.position > 0); assert(trkVarPreviewDensity.position > 0);
@ -1910,7 +1886,13 @@ begin
if viewDragged=false then // haven't dragged - popup menu then if viewDragged=false then // haven't dragged - popup menu then
begin begin
GetCursorPos(mousepos); // hmmm GetCursorPos(mousepos); // hmmm
EditPopup.Popup(mousepos.x, mousepos.y); if mouseOverTriangle < 0 then
EditPopup.Popup(mousepos.x, mousepos.y)
else begin
SelectedTriangle := mouseOverTriangle;
TriangleView.Refresh;
TrianglePopup.Popup(mousepos.x, mousepos.y)
end;
end end
else viewDragged := false; else viewDragged := false;
Screen.Cursor := crDefault; Screen.Cursor := crDefault;
@ -1957,12 +1939,18 @@ begin
end end
else else
begin begin
HelpersEnabled := False; HelpersEnabled := true;
end; end;
if Registry.ValueExists('VariationPreview') then if Registry.ValueExists('VariationPreview') then
tbVarPreview.Down := Registry.ReadBool('VariationPreview') begin
else tbVarPreview.Down := false; showVarPreview := Registry.ReadBool('VariationPreview');
tbVarPreview.Down := showVarPreview;
end
else begin
showVarPreview := false;
tbVarPreview.Down := false;
end;
if Registry.ValueExists('VariationPreviewRange') then if Registry.ValueExists('VariationPreviewRange') then
trkVarPreviewRange.Position := Registry.ReadInteger('VariationPreviewRange'); trkVarPreviewRange.Position := Registry.ReadInteger('VariationPreviewRange');
if Registry.ValueExists('VariationPreviewDensity') then if Registry.ValueExists('VariationPreviewDensity') then
@ -2193,8 +2181,8 @@ begin
end; end;
end; end;
NewVal := Round6(StrToFloat(TEdit(Sender).Text)); NewVal := Round6(StrToFloat(TEdit(Sender).Text));
if NewVal < 0 then NewVal := 0; if NewVal < 0.000001 then NewVal := 0.000001;
if NewVal > 0.99 then NewVal := 0.99; if NewVal > 100 then NewVal := 100;
{ If it's not the same as the old value and it was valid } { If it's not the same as the old value and it was valid }
TEdit(Sender).Text := Format('%.6g', [NewVal]); TEdit(Sender).Text := Format('%.6g', [NewVal]);
if (OldVal <> NewVal) and Allow then if (OldVal <> NewVal) and Allow then
@ -2225,8 +2213,8 @@ begin
end; end;
end; end;
NewVal := Round6(StrToFloat(TEdit(Sender).Text)); NewVal := Round6(StrToFloat(TEdit(Sender).Text));
if NewVal < 0 then NewVal := 0; if NewVal < 0.000001 then NewVal := 0.000001;
if NewVal > 0.99 then NewVal := 0.99; if NewVal > 100 then NewVal := 100;
{ If it's not the same as the old value and it was valid } { If it's not the same as the old value and it was valid }
TEdit(Sender).Text := Format('%.6g', [NewVal]); TEdit(Sender).Text := Format('%.6g', [NewVal]);
if (OldVal <> NewVal) and Allow then if (OldVal <> NewVal) and Allow then
@ -2262,7 +2250,8 @@ begin
Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor); Registry.WriteInteger('ReferenceTriangleColor', ReferenceTriangleColor);
} }
Registry.WriteBool('ResetLocation', mnuResetLoc.checked); Registry.WriteBool('ResetLocation', mnuResetLoc.checked);
Registry.WriteBool('VariationPreview', tbVarPreview.Down); Registry.WriteBool('VariationPreview', showVarPreview);
Registry.WriteBool('HelpersEnabled', HelpersEnabled);
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); Registry.WriteInteger('VariationPreviewDepth', trkVarPreviewDepth.Position);
@ -2534,11 +2523,14 @@ begin
end; end;
procedure TEditForm.scrlXFormColorChange(Sender: TObject); procedure TEditForm.scrlXFormColorChange(Sender: TObject);
var
v: double;
begin begin
cp.xform[SelectedTriangle].color := (scrlXFormColor.Position) / scrlXFormColor.Max; v := (scrlXFormColor.Position) / scrlXFormColor.Max;
txtXFormColor.Text := Format('%1.3f', [cp.xform[SelectedTriangle].color]); cp.xform[SelectedTriangle].color := v;
pnlXFormColor.color := ColorValToColor(MainCp.cmap, v);
txtXFormColor.Text := Format('%1.3f', [v]);
txtXFormColor.Refresh; txtXFormColor.Refresh;
pnlXFormColor.color := ColorValToColor(MainCp.cmap, cp.xform[SelectedTriangle].color);
DrawPreview; DrawPreview;
end; end;
@ -2555,64 +2547,6 @@ begin
TriangleView.Invalidate; TriangleView.Invalidate;
end; end;
(*
procedure TEditForm.pnlBackColorClick(Sender: TObject);
begin
AdjustForm.ColorDialog.Color := EditorBkgColor; //pnlBackColor.Color;
if AdjustForm.ColorDialog.Execute then
begin
pnlBackColor.Color := AdjustForm.ColorDialog.Color;
BackgroundColor := Integer(pnlBackColor.color);
GrphPnl.Color := BackgroundColor;
TriangleView.Invalidate;
end;
end;
procedure TEditForm.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 TEditForm.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 TEditForm.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 TEditForm.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;
*)
procedure TEditForm.txtXFormColorExit(Sender: TObject); procedure TEditForm.txtXFormColorExit(Sender: TObject);
var var
v: double; v: double;
@ -2689,7 +2623,7 @@ begin
end; end;
end; end;
procedure TEditForm.txtSymmetryKeyPress(Sender: TObject; var Key: Char); procedure TEditForm.txtSymmetrKeyPress(Sender: TObject; var Key: Char);
var var
Allow: boolean; Allow: boolean;
NewVal, OldVal: double; NewVal, OldVal: double;
@ -2837,6 +2771,7 @@ begin
varDragMode:=true; varDragMode:=true;
varDragPos:=0; varDragPos:=0;
varMM := false;
SetCaptureControl(TValueListEditor(Sender)); SetCaptureControl(TValueListEditor(Sender));
if Sender = VEVars then if Sender = VEVars then
varDragValue := cp.xform[SelectedTriangle].vars[varDragIndex] varDragValue := cp.xform[SelectedTriangle].vars[varDragIndex]
@ -2883,11 +2818,11 @@ begin
if Sender = VEVars then if Sender = VEVars then
begin begin
cp.xform[SelectedTriangle].vars[varDragIndex] := v; cp.xform[SelectedTriangle].vars[varDragIndex] := v;
TValueListEditor(Sender).Values[VarNames(varDragIndex)] := Format('%.6g', [v]); TValueListEditor(Sender).Values[VarNames(varDragIndex)] := FloatToStr(v); //Format('%.6g', [v]);
end end
else begin else begin
cp.xform[SelectedTriangle].SetVariable(vleVariables.Keys[varDragIndex+1], v); cp.xform[SelectedTriangle].SetVariable(vleVariables.Keys[varDragIndex+1], v);
vleVariables.Values[vleVariables.Keys[varDragIndex+1]] := Format('%.6g', [v]); vleVariables.Values[vleVariables.Keys[varDragIndex+1]] := FloatToStr(v); //Format('%.6g', [v]);
end; end;
HasChanged := True; HasChanged := True;
@ -3453,12 +3388,22 @@ var
i: integer; i: integer;
begin begin
MainForm.UpdateUndo; MainForm.UpdateUndo;
for i := 2 to Transforms-1 do cp.xform[i].density := 0; for i := 0 to Transforms-1 do cp.xform[i].Clear;//density := 0;
cp.xform[0].vars[0] := 1;
cp.xform[0].density := 0.5;
cp.xform[1].vars[0] := 1;
cp.xform[1].density := 0.5;
cp.xform[1].color := 1;
cp.xform[2].symmetry := 1;
Transforms := 2; Transforms := 2;
SelectedTriangle := 1; SelectedTriangle := 1;
MainTriangles[0] := MainTriangles[-1]; MainTriangles[0] := MainTriangles[-1];
with cp.xform[0] do begin MainTriangles[1] := MainTriangles[-1];
MainTriangles[2] := MainTriangles[-1];
assert(cp.HasFinalXForm = false);
{ with cp.xform[0] do begin
density := 0.5; density := 0.5;
color := 0; color := 0;
symmetry := 0; symmetry := 0;
@ -3470,7 +3415,6 @@ begin
p[2, 0] := 0; p[2, 0] := 0;
p[2, 1] := 0; p[2, 1] := 0;
end; end;
MainTriangles[1] := MainTriangles[-1];
with cp.xform[1] do begin with cp.xform[1] do begin
density := 0.5; density := 0.5;
color := 1; color := 1;
@ -3488,7 +3432,7 @@ begin
cp.xform[0].vars[i] := 0; cp.xform[0].vars[i] := 0;
cp.xform[1].vars[i] := 0; cp.xform[1].vars[i] := 0;
end; end;
}
cbTransforms.clear; cbTransforms.clear;
cbTransforms.Items.Add('1'); cbTransforms.Items.Add('1');
cbTransforms.Items.Add('2'); cbTransforms.Items.Add('2');
@ -3543,6 +3487,8 @@ end;
procedure TEditForm.tbVarPreviewClick(Sender: TObject); procedure TEditForm.tbVarPreviewClick(Sender: TObject);
begin begin
showVarPreview := not showVarPreview;
tbVarPreview.Down := showVarPreview;
TriangleView.Invalidate; TriangleView.Invalidate;
end; end;
@ -3809,25 +3755,20 @@ begin
ShowSelectedInfo; ShowSelectedInfo;
UpdateFlame(true); UpdateFlame(true);
end; end;
// .............................................................................
procedure TEditForm.VEVarsDrawCell(Sender: TObject; ACol, ARow: Integer; procedure TEditForm.VEVarsDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState); Rect: TRect; State: TGridDrawState);
var
c: TColor;
begin begin
// if ARow = 0 then exit; if (ARow > NRLOCVAR) and not (gdSelected in State) then
if (ARow > NRLOCVAR) then
begin begin
// if ARow and 1 = 1 then c := c shr 1;
VEVars.canvas.brush.Color := $ffe0e0; VEVars.canvas.brush.Color := $ffe0e0;
VEVars.canvas.fillRect(Rect); VEVars.canvas.fillRect(Rect);
VEVars.canvas.TextOut(Rect.Left+2, Rect.Top, VEVars.Cells[ACol,ARow]); VEVars.canvas.TextOut(Rect.Left+2, Rect.Top+2, VEVars.Cells[ACol,ARow]);
end; end;
end; end;
procedure TEditForm.tbEnableFinalXformClick(Sender: TObject); procedure TEditForm.tbEnableFinalXformClick(Sender: TObject);
var
i: integer;
begin begin
MainForm.UpdateUndo; MainForm.UpdateUndo;
EnableFinalXform := tbEnableFinalXform.Down; EnableFinalXform := tbEnableFinalXform.Down;
@ -3835,15 +3776,11 @@ begin
begin begin
if (EnableFinalXform = true) then if (EnableFinalXform = true) then
begin begin
//cp.xform[Transforms].Clear;
//cp.xform[Transforms].Symmetry := 1;
cbTransforms.Items.Add('Final'); cbTransforms.Items.Add('Final');
SelectedTriangle := Transforms; SelectedTriangle := Transforms;
if (mouseOverTriangle > LastTriangle) then mouseOverTriangle := -1; if (mouseOverTriangle > LastTriangle) then mouseOverTriangle := -1;
end end
else begin else begin
//cp.xform[Transforms].Clear;
//cp.xform[Transforms].Symmetry := 1;
if cbTransforms.Items.Count = Transforms+1 then if cbTransforms.Items.Count = Transforms+1 then
cbTransforms.Items.Delete(Transforms); cbTransforms.Items.Delete(Transforms);
if SelectedTriangle >= Transforms then SelectedTriangle := Transforms-1; if SelectedTriangle >= Transforms then SelectedTriangle := Transforms-1;
@ -3854,5 +3791,141 @@ begin
TriangleView.Invalidate; TriangleView.Invalidate;
end; end;
procedure TEditForm.DragPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button <> mbLeft then exit;
//assert(pnlDragMode = false);
if (Sender = pnlWeight) then
if SelectedTriangle < Transforms then
pnlDragValue := cp.xform[SelectedTriangle].density
else exit
else if (Sender = pnlSymmetry) then
pnlDragValue := cp.xform[SelectedTriangle].symmetry
else if (Sender = pnlXformColor) then
pnlDragValue := cp.xform[SelectedTriangle].color
else assert(false);
pnlDragMode := true;
pnlDragPos := 0;
pnlDragOld := x;
varMM := false;
SetCaptureControl(TControl(Sender));
Screen.Cursor := crHSplit;
GetCursorPos(mousepos); // hmmm
HasChanged := false;
end;
procedure TEditForm.DragPanelMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
v: double;
pEdit: ^TEdit;
begin
if varMM then // hack: to skip MouseMove event
begin
varMM:=false;
end
else
if pnlDragMode and (x <> pnlDragOld) then
begin
Inc(pnlDragPos, x - pnlDragOld);
if GetKeyState(VK_MENU) < 0 then v := 100000
else if GetKeyState(VK_CONTROL) < 0 then v := 10000
else if GetKeyState(VK_SHIFT) < 0 then v := 100
else v := 1000;
v := Round6(pnlDragValue + pnlDragPos / v);
SetCursorPos(MousePos.x, MousePos.y); // hmmm
varMM:=true;
if (Sender = pnlWeight) then
begin
if v <= 0.000001 then v := 0.000001;
cp.xform[SelectedTriangle].density := v;
pEdit := @txtP;
end
else if (Sender = pnlSymmetry) then
begin
if v < -1 then v := -1
else if v > 1 then v := 1;
cp.xform[SelectedTriangle].symmetry := v;
pEdit := @txtSymmetry;
end
else if (Sender = pnlXformColor) then
begin
if v < 0 then v := 0
else if v > 1 then v := 1;
cp.xform[SelectedTriangle].color := v;
pnlXFormColor.Color := ColorValToColor(cp.cmap, v);
scrlXformColor.Position := round(v*1000);
pEdit := @txtXformColor;
end;
pEdit^.Text := FloatToStr(v); // Format('%.6g', [v])
//pEdit.Refresh;
HasChanged := True;
DrawPreview;
end;
end;
procedure TEditForm.DragPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button <> mbLeft then exit;
if pnlDragMode then
begin
SetCaptureControl(nil);
pnlDragMode := false;
Screen.Cursor := crDefault;
if HasChanged then
begin
MainForm.UpdateUndo;
UpdateFlame(true);
HasChanged := False;
end;
end;
end;
procedure TEditForm.DragPanelDblClick(Sender: TObject);
var
pValue: ^double;
pEdit: ^TEdit;
begin
if (Sender = pnlWeight) then
begin
if SelectedTriangle = LastTriangle then exit; // hmm
pValue := @cp.xform[SelectedTriangle].density;
if pValue^ = 0.5 then exit;
pValue^ := 0.5;
pEdit := @txtP;
end
else if (Sender = pnlSymmetry) then
begin
pValue := @cp.xform[SelectedTriangle].symmetry;
if pValue^ = 0 then exit;
pValue^ := 0;
pEdit := @txtSymmetry;
end
else if (Sender = pnlXformColor) then
begin
pValue := @cp.xform[SelectedTriangle].color;
if pValue^ = 0 then exit;
pValue^ := 0;
pEdit := @txtXformColor;
end
else assert(false);
MainForm.UpdateUndo;
pEdit^.Text := FloatToStr(pValue^);
UpdateFlame(true);
end;
end. end.

View File

@ -33,7 +33,7 @@ type
procedure FormKeyPress(Sender: TObject; var Key: Char); procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure ImageDblClick(Sender: TObject); procedure ImageDblClick(Sender: TObject);
private private
Remainder, StartTime, Now: Extended; Remainder, StartTime, t: double;
Renderer: TRenderThread; Renderer: TRenderThread;
procedure showTaskbar; procedure showTaskbar;
procedure hideTaskbar; procedure hideTaskbar;
@ -68,15 +68,17 @@ begin
// cp.center[1] := MainForm.center[1]; // cp.center[1] := MainForm.center[1];
cp.sample_density := defSampleDensity; cp.sample_density := defSampleDensity;
StartTime := Now; StartTime := Now;
t := now;
Remainder := 1; Remainder := 1;
if Assigned(Renderer) then Renderer.Terminate; if Assigned(Renderer) then Renderer.Terminate;
if Assigned(Renderer) then Renderer.WaitFor; if Assigned(Renderer) then Renderer.WaitFor;
assert(not assigned(renderer));
if not Assigned(Renderer) then if not Assigned(Renderer) then
begin begin
Renderer := TRenderThread.Create; Renderer := TRenderThread.Create;
Renderer.TargetHandle := Handle; Renderer.TargetHandle := Handle;
Renderer.OnProgress := OnProgress; Renderer.OnProgress := OnProgress;
Renderer.Compatibility := Compatibility; Renderer.Compatibility := Compatibility;
Renderer.SetCP(cp); Renderer.SetCP(cp);
Renderer.Resume; Renderer.Resume;
end; end;
@ -90,7 +92,7 @@ begin
begin begin
bm := TBitmap.Create; bm := TBitmap.Create;
bm.assign(Renderer.GetImage); bm.assign(Renderer.GetImage);
Image.Picture.Graphic := bm; Image.Picture.Graphic := bm;
// Canvas.StretchDraw(Rect(0, 0, ClientWidth, ClientHeight), bm); // Canvas.StretchDraw(Rect(0, 0, ClientWidth, ClientHeight), bm);
Renderer.Free; Renderer.Free;
@ -100,11 +102,18 @@ begin
end; end;
procedure TFullscreenForm.HandleThreadTermination(var Message: TMessage); procedure TFullscreenForm.HandleThreadTermination(var Message: TMessage);
//var
// bm: TBitmap;
begin begin
if Assigned(Renderer) then if Assigned(Renderer) then
begin begin
// bm := TBitmap.Create;
// bm.assign(Renderer.GetImage);
// Image.Picture.Graphic := bm;
Renderer.Free; Renderer.Free;
Renderer := nil; Renderer := nil;
// bm.Free;
end; end;
end; end;

View File

@ -17,7 +17,7 @@ type
FTransparentImage: TBitmap; FTransparentImage: TBitmap;
Fcp: Tcontrolpoint; Fcp: Tcontrolpoint;
FBucketWidth: Int64; FBucketWidth: integer;
FBuckets: TBucketArray; FBuckets: TBucketArray;
FOnProgress: TOnProgress; FOnProgress: TOnProgress;
@ -39,7 +39,7 @@ type
procedure SetCP(CP: TControlPoint); procedure SetCP(CP: TControlPoint);
procedure Init; procedure Init;
procedure SetBucketData(const Buckets: TBucketArray; const BucketWidth: int64); procedure SetBucketData(const Buckets: TBucketArray; const BucketWidth: integer);
function GetFilterSize: Integer; function GetFilterSize: Integer;
@ -174,7 +174,7 @@ begin
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TImageMaker.SetBucketData(const Buckets: TBucketArray; const BucketWidth: int64); procedure TImageMaker.SetBucketData(const Buckets: TBucketArray; const BucketWidth: integer);
begin begin
FBuckets := Buckets; FBuckets := Buckets;
FBucketWidth := BucketWidth; FBucketWidth := BucketWidth;

View File

@ -586,7 +586,7 @@ begin
{ Editor } // --Z-- moved from EditForm { Editor } // --Z-- moved from EditForm
if Registry.OpenKey('Software\' + APP_NAME + '\Forms\Editor', False) then if Registry.OpenKey('Software\' + APP_NAME + '\Forms\Editor', False) then
begin begin
if Registry.ValueExists('UseTransformColors') then { if Registry.ValueExists('UseTransformColors') then
begin begin
UseTransformColors := Registry.ReadBool('UseTransformColors'); UseTransformColors := Registry.ReadBool('UseTransformColors');
end end
@ -602,6 +602,7 @@ begin
begin begin
UseFlameBackground := False; UseFlameBackground := False;
end; end;
}
if Registry.ValueExists('BackgroundColor') then if Registry.ValueExists('BackgroundColor') then
EditorBkgColor := Registry.ReadInteger('BackgroundColor') EditorBkgColor := Registry.ReadInteger('BackgroundColor')
else else

View File

@ -40,9 +40,6 @@ type
Buckets: TBucketArray; Buckets: TBucketArray;
ColorMap: TColorMapArray; ColorMap: TColorMapArray;
FinalXform: ^TXform;
UseFinalXform: boolean;
camX0, camX1, camY0, camY1, // camera bounds camX0, camX1, camY0, camY1, // camera bounds
camW, camH, // camera sizes camW, camH, // camera sizes
bws, bhs, cosa, sina, rcX, rcY: double; bws, bhs, cosa, sina, rcX, rcY: double;
@ -59,8 +56,6 @@ type
procedure AddPointsToBuckets(const points: TPointsArray); procedure AddPointsToBuckets(const points: TPointsArray);
procedure AddPointsToBucketsAngle(const points: TPointsArray); procedure AddPointsToBucketsAngle(const points: TPointsArray);
procedure AddPointsWithFX(const points: TPointsArray);
procedure AddPointsWithAngleFX(const points: TPointsArray);
procedure SetPixels; procedure SetPixels;
public public
@ -215,14 +210,15 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.InitValues; procedure TRenderer64.InitValues;
var
i, n: integer;
begin begin
InitBuffers; InitBuffers;
CreateCamera; CreateCamera;
CreateColorMap; CreateColorMap;
FinalXForm := @fcp.xform[fcp.NumXForms]; fcp.Prepare;
UseFinalXForm := fcp.finalXformEnabled and fcp.HasFinalXform;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -251,86 +247,6 @@ begin
end; end;
end; end;
procedure TRenderer64.AddPointsWithFX(const points: TPointsArray);
const
const255: single = 255;
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
{$if true}
px := points[i].x - camX0;
if (px < 0) or (px > camW) then continue;
py := points[i].y - camY0;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
{$else}
asm
mov eax, [points]
lea edx, [eax + edi*8] // assert: "i" in edi
// fld qword ptr [edx + edi*8] // assert: "i" in edi
fld qword ptr [edx]
fsub qword ptr [bx]
fldz
fcomp st(1), st
fnstsw ax
sahf
jb @skip1
fld qword ptr [wx]
fcomp
fnstsw ax
sahf
jnbe @skip1
fld qword ptr [edx + 8]
fsub qword ptr [by]
fldz
fcomp
fnstsw ax
sahf
jb @skip2
fld qword ptr [wy]
fcomp
fnstsw ax
sahf
jnbe @skip2
fmul qword ptr [bhs]
fimul [BucketWidth]
fld qword ptr [edx + 16]
fmul dword ptr [const255]
sub esp, 4
fistp dword ptr [esp]
pop eax
@skip2:
fstp st
@skip1:
fstp st
@continue:
end;
{$ifend}
end
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.AddPointsToBucketsAngle(const points: TPointsArray); procedure TRenderer64.AddPointsToBucketsAngle(const points: TPointsArray);
var var
@ -357,36 +273,6 @@ begin
end; end;
end; end;
procedure TRenderer64.AddPointsWithAngleFX(const points: TPointsArray);
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do
begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
px := points[i].x * cosa + points[i].y * sina + rcX;
if (px < 0) or (px > camW) then continue;
py := points[i].y * cosa - points[i].x * sina + rcY;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRenderer64.SetPixels; procedure TRenderer64.SetPixels;
var var
@ -401,18 +287,10 @@ begin
// AssignFile(F, 'c:\temp\flame.txt'); // AssignFile(F, 'c:\temp\flame.txt');
// Rewrite(F); // Rewrite(F);
if FCP.FAngle = 0 then begin if FCP.FAngle = 0 then
if UseFinalXForm then AddPointsProc := AddPointsToBuckets
AddPointsProc := AddPointsWithFX else
else AddPointsProc := AddPointsToBucketsAngle;
AddPointsProc := AddPointsToBuckets;
end
else begin
if UseFinalXForm then
AddPointsProc := AddPointsWithAngleFX
else
AddPointsProc := AddPointsToBucketsAngle;
end;
SetLength(Points, SUB_BATCH_SIZE); SetLength(Points, SUB_BATCH_SIZE);

View File

@ -42,9 +42,6 @@ type
Buckets: TBucketArray; Buckets: TBucketArray;
ColorMap: TColorMapArray; ColorMap: TColorMapArray;
FinalXform: ^TXform;
UseFinalXform: boolean;
camX0, camX1, camY0, camY1, // camera bounds camX0, camX1, camY0, camY1, // camera bounds
camW, camH, // camera sizes camW, camH, // camera sizes
Xsize, Ysize: double; Xsize, Ysize: double;
@ -239,6 +236,8 @@ begin
CreateCamera; CreateCamera;
CreateColorMap; CreateColorMap;
fcp.Prepare;
end; end;

View File

@ -41,9 +41,6 @@ type
Buckets: TBucketArray; Buckets: TBucketArray;
ColorMap: TColorMapArray; ColorMap: TColorMapArray;
FinalXform: ^TXform;
UseFinalXform: boolean;
camX0, camX1, camY0, camY1, // camera bounds camX0, camX1, camY0, camY1, // camera bounds
camW, camH, // camera sizes camW, camH, // camera sizes
bws, bhs, cosa, sina, rcX, rcY: double; bws, bhs, cosa, sina, rcX, rcY: double;
@ -64,8 +61,6 @@ type
procedure AddPointsToBuckets(const points: TPointsArray); procedure AddPointsToBuckets(const points: TPointsArray);
procedure AddPointsToBucketsAngle(const points: TPointsArray); procedure AddPointsToBucketsAngle(const points: TPointsArray);
procedure AddPointsWithFX(const points: TPointsArray);
procedure AddPointsWithAngleFX(const points: TPointsArray);
procedure SetPixels; procedure SetPixels;
protected protected
@ -213,6 +208,8 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64.InitValues; procedure TRendererMM64.InitValues;
var
i: integer;
begin begin
image_height := fcp.Height; image_height := fcp.Height;
image_Width := fcp.Width; image_Width := fcp.Width;
@ -223,8 +220,7 @@ begin
CreateColorMap; CreateColorMap;
FinalXForm := @fcp.xform[fcp.NumXForms]; fcp.Prepare;
UseFinalXForm := fcp.finalXformEnabled and fcp.HasFinalXform;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -255,36 +251,6 @@ begin
end; end;
end; end;
procedure TRendererMM64.AddPointsWithFX(const points: TPointsArray);
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
px := points[i].x - camX0;
if (px < 0) or (px > camW) then continue;
py := points[i].y - camY0;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64.AddPointsToBucketsAngle(const points: TPointsArray); procedure TRendererMM64.AddPointsToBucketsAngle(const points: TPointsArray);
var var
@ -311,36 +277,6 @@ begin
end; end;
end; end;
procedure TRendererMM64.AddPointsWithAngleFX(const points: TPointsArray);
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do
begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
px := points[i].x * cosa + points[i].y * sina + rcX;
if (px < 0) or (px > camW) then continue;
py := points[i].y * cosa - points[i].x * sina + rcY;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64.SetPixels; procedure TRendererMM64.SetPixels;
var var

View File

@ -39,9 +39,6 @@ type
Buckets: TBucketArray; Buckets: TBucketArray;
ColorMap: TColorMapArray; ColorMap: TColorMapArray;
FinalXform: ^TXform;
UseFinalXform: boolean;
camX0, camX1, camY0, camY1, // camera bounds camX0, camX1, camY0, camY1, // camera bounds
camW, camH, // camera sizes camW, camH, // camera sizes
bws, bhs, cosa, sina, rcX, rcY: double; bws, bhs, cosa, sina, rcX, rcY: double;
@ -69,8 +66,6 @@ type
procedure AddPointsToBuckets(const points: TPointsArray); procedure AddPointsToBuckets(const points: TPointsArray);
procedure AddPointsToBucketsAngle(const points: TPointsArray); procedure AddPointsToBucketsAngle(const points: TPointsArray);
procedure AddPointsWithFX(const points: TPointsArray);
procedure AddPointsWithAngleFX(const points: TPointsArray);
procedure SetPixels; procedure SetPixels;
procedure SetPixelsMT; procedure SetPixelsMT;
@ -225,6 +220,8 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64_MT.InitValues; procedure TRendererMM64_MT.InitValues;
var
i, n: integer;
begin begin
image_height := fcp.Height; image_height := fcp.Height;
image_Width := fcp.Width; image_Width := fcp.Width;
@ -235,8 +232,7 @@ begin
CreateColorMap; CreateColorMap;
FinalXForm := @fcp.xform[fcp.NumXForms]; fcp.Prepare;
UseFinalXForm := fcp.finalXformEnabled and fcp.HasFinalXform;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -267,36 +263,6 @@ begin
end; end;
end; end;
procedure TRendererMM64_MT.AddPointsWithFX(const points: TPointsArray);
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
px := points[i].x - camX0;
if (px < 0) or (px > camW) then continue;
py := points[i].y - camY0;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64_MT.AddPointsToBucketsAngle(const points: TPointsArray); procedure TRendererMM64_MT.AddPointsToBucketsAngle(const points: TPointsArray);
var var
@ -323,36 +289,6 @@ begin
end; end;
end; end;
procedure TRendererMM64_MT.AddPointsWithAngleFX(const points: TPointsArray);
var
i: integer;
px, py: double;
Bucket: PBucket;
MapColor: PColorMapColor;
begin
try
for i := SUB_BATCH_SIZE - 1 downto 0 do
begin
// if FStop then Exit;
FinalXform.NextPoint(points[i]);
px := points[i].x * cosa + points[i].y * sina + rcX;
if (px < 0) or (px > camW) then continue;
py := points[i].y * cosa - points[i].x * sina + rcY;
if (py < 0) or (py > camH) then continue;
Bucket := @buckets[Round(bws * px) + Round(bhs * py) * BucketWidth];
MapColor := @ColorMap[Round(points[i].c * 255)];
Inc(Bucket.Red, MapColor.Red);
Inc(Bucket.Green, MapColor.Green);
Inc(Bucket.Blue, MapColor.Blue);
Inc(Bucket.Count);
end;
except
end
end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TRendererMM64_MT.SetPixels; procedure TRendererMM64_MT.SetPixels;
var var
@ -362,18 +298,10 @@ var
points: TPointsArray; points: TPointsArray;
AddPointsProc: procedure (const points: TPointsArray) of object; AddPointsProc: procedure (const points: TPointsArray) of object;
begin begin
if FCP.FAngle = 0 then begin if FCP.FAngle = 0 then
if UseFinalXForm then AddPointsProc := AddPointsToBuckets
AddPointsProc := AddPointsWithFX else
else AddPointsProc := AddPointsToBucketsAngle;
AddPointsProc := AddPointsToBuckets;
end
else begin
if UseFinalXForm then
AddPointsProc := AddPointsWithAngleFX
else
AddPointsProc := AddPointsToBucketsAngle;
end;
SetLength(Points, SUB_BATCH_SIZE); SetLength(Points, SUB_BATCH_SIZE);

View File

@ -19,6 +19,10 @@ type
end; end;
PXYpoint = ^TXYpoint; PXYpoint = ^TXYpoint;
T2Cpoint = record
x, y, c1, c2: double;
end;
TMatrix = array[0..2, 0..2] of double; TMatrix = array[0..2, 0..2] of double;
{$define _ASM_} {$define _ASM_}
@ -36,13 +40,14 @@ type
FSinA: double; FSinA: double;
FCosA: double; FCosA: double;
FLength: double; FLength: double;
// CalculateAngle, CalculateLength, CalculateSinCos: boolean;
colorC1, colorC2: double; colorC1, colorC2: double;
// precalculated constants for some variations
waves_f1, waves_f2, waves_f1, waves_f2,
rings_dx, rings_dx,
fan_dx, fan_dx2, fan_dx, fan_dx2,
cosine_var2: double; // precalc... cosine_var2,
polar_vpi: double;
FRegVariations: array of TBaseVariation; FRegVariations: array of TBaseVariation;
@ -111,9 +116,10 @@ type
procedure NextPoint(var px, py, pc: double); overload; procedure NextPoint(var px, py, pc: double); overload;
procedure NextPoint(var CPpoint: TCPpoint); overload; procedure NextPoint(var CPpoint: TCPpoint); overload;
procedure NextPointTo(var CPpoint, ToPoint: TCPpoint);
// procedure NextPoint(var px, py, pz, pc: double); overload; // procedure NextPoint(var px, py, pz, pc: double); overload;
procedure NextPointXY(var px, py: double); procedure NextPointXY(var px, py: double);
procedure NextPoint2C(var px, py, pc1, pc2: double); procedure NextPoint2C(var p: T2CPoint);
procedure Rotate(const degrees: double); procedure Rotate(const degrees: double);
procedure Translate(const x, y: double); procedure Translate(const x, y: double);
@ -243,6 +249,8 @@ begin
cosine_var2 := vars[20]/2; cosine_var2 := vars[20]/2;
polar_vpi := vars[5]/pi;
if (p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) then if (p[0,0]<>1) or (p[0,1]<>0) or(p[1,0]<>0) or (p[1,1]<>1) or (p[2,0]<>0) or (p[2,1]<>0) then
begin begin
p00 := p[0][0]; p00 := p[0][0];
@ -308,9 +316,7 @@ asm
fmul st, st fmul st, st
faddp faddp
fsqrt fsqrt
fadd qword ptr [EPS] // avoid divide by zero...(?)
fadd qword ptr [EPS] // test...
fdiv st(1), st fdiv st(1), st
fdiv st(2), st fdiv st(2), st
fstp qword ptr [eax + FLength] fstp qword ptr [eax + FLength]
@ -333,9 +339,7 @@ asm
fmul st, st fmul st, st
faddp faddp
fsqrt fsqrt
fadd qword ptr [EPS] // avoid divide by zero...(?)
fadd qword ptr [EPS] // test...
fdiv st(1), st fdiv st(1), st
fdiv st(2), st fdiv st(2), st
fstp qword ptr [eax + FLength] fstp qword ptr [eax + FLength]
@ -546,16 +550,12 @@ begin
FPy := FPy + vars[5] * ny; FPy := FPy + vars[5] * ny;
} }
begin begin
FPx := FPx + vars[5] * FAngle / PI; FPx := FPx + polar_vpi * FAngle; //vars[5] * FAngle / PI;
FPy := FPy + vars[5] * (sqrt(sqr(FTx) + sqr(FTy)) - 1.0); FPy := FPy + vars[5] * (sqrt(sqr(FTx) + sqr(FTy)) - 1.0);
{$else} {$else}
asm asm
mov edx, [eax + vars]
fld qword ptr [edx + 5*8]
fld qword ptr [eax + FAngle] fld qword ptr [eax + FAngle]
fldpi fmul qword ptr [eax + polar_vpi]
fdivp st(1), st
fmul st, st(1)
fadd qword ptr [eax + FPx] fadd qword ptr [eax + FPx]
fstp qword ptr [eax + FPx] fstp qword ptr [eax + FPx]
fld qword ptr [eax + FTx] fld qword ptr [eax + FTx]
@ -566,7 +566,8 @@ asm
fsqrt fsqrt
fld1 fld1
fsubp st(1), st fsubp st(1), st
fmulp mov edx, [eax + vars]
fmul qword ptr [edx + 5*8]
fadd qword ptr [eax + FPy] fadd qword ptr [eax + FPy]
fstp qword ptr [eax + FPy] fstp qword ptr [eax + FPy]
fwait fwait
@ -648,14 +649,8 @@ end;
procedure TXForm.Disc; procedure TXForm.Disc;
{$ifndef _ASM_} {$ifndef _ASM_}
var var
// nx, ny: double;
r, sinr, cosr: double; r, sinr, cosr: double;
begin begin
// --Z-- ????? - calculating PI^2 to get square root from it, hmm?
// nx := FTx * PI;
// ny := FTy * PI;
// r := sqrt(nx * nx + ny * ny);
SinCos(PI * sqrt(sqr(FTx) + sqr(FTy)), sinr, cosr); SinCos(PI * sqrt(sqr(FTx) + sqr(FTy)), sinr, cosr);
r := vars[8] * FAngle / PI; r := vars[8] * FAngle / PI;
FPx := FPx + sinr * r; FPx := FPx + sinr * r;
@ -841,17 +836,12 @@ end;
procedure TXForm.Julia; procedure TXForm.Julia;
{$ifndef _ASM_} {$ifndef _ASM_}
var var
a, r: double; r, sina, cosa: double;
sinr, cosr: double;
begin begin
if random(2) <> 0 then SinCos(FAngle/2 + pi*random(2), sina, cosa);
a := FAngle/2 + PI
else
a := FAngle/2;
SinCos(a, sinr, cosr);
r := vars[13] * sqrt(sqrt(sqr(FTx) + sqr(FTy))); r := vars[13] * sqrt(sqrt(sqr(FTx) + sqr(FTy)));
FPx := FPx + r * cosr; FPx := FPx + r * cosa;
FPy := FPy + r * sinr; FPy := FPy + r * sina;
{$else} {$else}
asm asm
fld qword ptr [ebx + FAngle] // assert: self is in ebx fld qword ptr [ebx + FAngle] // assert: self is in ebx
@ -862,11 +852,12 @@ asm
xor eax, eax // hmm... xor eax, eax // hmm...
add eax, $02 // hmmm.... add eax, $02 // hmmm....
call System.@RandInt // hmmmm..... call System.@RandInt // hmmmm.....
test al, al push eax
jnz @skip fild dword ptr [esp]
add esp, 4
fldpi fldpi
fmulp
faddp faddp
@skip:
fsincos fsincos
fld qword ptr [ebx + FTx] fld qword ptr [ebx + FTx]
fmul st, st fmul st, st
@ -965,25 +956,25 @@ begin
FPy := FPy + vars[15] * (FTy + c11 * sin(FTx * waves_f2)); FPy := FPy + vars[15] * (FTy + c11 * sin(FTx * waves_f2));
{$else} {$else}
asm asm
mov edx, [ebx + vars] mov edx, [eax + vars]
fld qword ptr [edx + 15*8] fld qword ptr [edx + 15*8]
fld qword ptr [ebx + FTy] fld qword ptr [eax + FTy]
fld qword ptr [ebx + FTx] fld qword ptr [eax + FTx]
fld st(1) fld st(1)
fmul qword ptr [ebx + waves_f1] fmul qword ptr [eax + waves_f1]
fsin fsin
fmul qword ptr [ebx + c10] fmul qword ptr [eax + c10]
fadd st, st(1) fadd st, st(1)
fmul st, st(3) fmul st, st(3)
fadd qword ptr [ebx + FPx] fadd qword ptr [eax + FPx]
fstp qword ptr [ebx + FPx] fstp qword ptr [eax + FPx]
fmul qword ptr [ebx + waves_f2] fmul qword ptr [eax + waves_f2]
fsin fsin
fmul qword ptr [ebx + c11] fmul qword ptr [eax + c11]
faddp faddp
fmulp fmulp
fadd qword ptr [ebx + FPy] fadd qword ptr [eax + FPy]
fstp qword ptr [ebx + FPy] fstp qword ptr [eax + FPy]
fwait fwait
{$endif} {$endif}
end; end;
@ -1009,11 +1000,11 @@ begin
FPy := FPy + r * FTx; FPy := FPy + r * FTx;
{$else} {$else}
asm asm
mov edx, [ebx + vars] mov edx, [eax + vars]
fld qword ptr [edx + 16*8] fld qword ptr [edx + 16*8]
fadd st, st fadd st, st
fld qword ptr [ebx + FTx] fld qword ptr [eax + FTx]
fld qword ptr [ebx + FTy] fld qword ptr [eax + FTy]
fld st(1) fld st(1)
fmul st, st fmul st, st
fld st(1) fld st(1)
@ -1024,11 +1015,11 @@ asm
faddp faddp
fdivp st(3), st fdivp st(3), st
fmul st, st(2) fmul st, st(2)
fadd qword ptr [ebx + FPx] fadd qword ptr [eax + FPx]
fstp qword ptr [ebx + FPx] fstp qword ptr [eax + FPx]
fmulp fmulp
fadd qword ptr [ebx + FPy] fadd qword ptr [eax + FPy]
fstp qword ptr [ebx + FPy] fstp qword ptr [eax + FPy]
fwait fwait
{$endif} {$endif}
end; end;
@ -1371,11 +1362,11 @@ begin
FPy := FPy + r * FTy; FPy := FPy + r * FTy;
{$else} {$else}
asm asm
mov edx, [ebx + vars] mov edx, [eax + vars]
fld qword ptr [edx + 23*8] fld qword ptr [edx + 23*8]
fadd st, st fadd st, st
fld qword ptr [ebx + FTy] fld qword ptr [eax + FTy]
fld qword ptr [ebx + FTx] fld qword ptr [eax + FTx]
fld st(1) fld st(1)
fmul st, st fmul st, st
fld st(1) fld st(1)
@ -1386,11 +1377,11 @@ asm
faddp faddp
fdivp st(3), st fdivp st(3), st
fmul st, st(2) fmul st, st(2)
fadd qword ptr [ebx + FPx] fadd qword ptr [eax + FPx]
fstp qword ptr [ebx + FPx] fstp qword ptr [eax + FPx]
fmulp fmulp
fadd qword ptr [ebx + FPy] fadd qword ptr [eax + FPy]
fstp qword ptr [ebx + FPy] fstp qword ptr [eax + FPy]
fwait fwait
{$endif} {$endif}
end; end;
@ -1407,8 +1398,8 @@ begin
FPy := FPy + r * FTy; FPy := FPy + r * FTy;
{$else} {$else}
asm asm
fld qword ptr [ebx + FTy] fld qword ptr [eax + FTy]
fld qword ptr [ebx + FTx] fld qword ptr [eax + FTx]
fld st(1) fld st(1)
fmul st, st fmul st, st
fld st(1) fld st(1)
@ -1420,14 +1411,14 @@ asm
fdivp st(1), st fdivp st(1), st
fld1 fld1
fadd fadd
mov edx, [ebx + vars] mov edx, [eax + vars]
fdivr qword ptr [edx + 24*8] fdivr qword ptr [edx + 24*8]
fmul st(2), st fmul st(2), st
fmulp fmulp
fadd qword ptr [ebx + FPx] fadd qword ptr [eax + FPx]
fstp qword ptr [ebx + FPx] fstp qword ptr [eax + FPx]
fadd qword ptr [ebx + FPy] fadd qword ptr [eax + FPy]
fstp qword ptr [ebx + FPy] fstp qword ptr [eax + FPy]
fwait fwait
{$endif} {$endif}
end; end;
@ -1440,17 +1431,17 @@ begin
FPy := FPy + vars[25] * FTy; FPy := FPy + vars[25] * FTy;
{$else} {$else}
asm asm
mov edx, [ebx + vars] mov edx, [eax + vars]
fld qword ptr [edx + 25*8] fld qword ptr [edx + 25*8]
fld qword ptr [ebx + FTx] fld qword ptr [eax + FTx]
fsin fsin
fld qword ptr [ebx + FTy] fld qword ptr [eax + FTy]
fmul st, st(2) fmul st, st(2)
fadd qword ptr [ebx + FPy] fadd qword ptr [eax + FPy]
fstp qword ptr [ebx + FPy] fstp qword ptr [eax + FPy]
fmulp fmulp
fadd qword ptr [ebx + FPx] fadd qword ptr [eax + FPx]
fstp qword ptr [ebx + FPx] fstp qword ptr [eax + FPx]
fwait fwait
{$endif} {$endif}
end; end;
@ -1465,27 +1456,27 @@ begin
FPy := FPy + vars[26] * (FTy + amplitude * sin(FTx * pi)); FPy := FPy + vars[26] * (FTy + amplitude * sin(FTx * pi));
{$else} {$else}
asm asm
mov edx, [ebx + vars] mov edx, [eax + vars]
fld qword ptr [edx + 26*8] fld qword ptr [edx + 26*8]
fld dword ptr [amplitude] fld dword ptr [amplitude]
fld qword ptr [ebx + FTy] fld qword ptr [eax + FTy]
fldpi fldpi
fld qword ptr [ebx + FTx] fld qword ptr [eax + FTx]
fld st(2) fld st(2)
fmul st, st(2) fmul st, st(2)
fsin fsin
fmul st, st(4) fmul st, st(4)
fadd st, st(1) fadd st, st(1)
fmul st, st(5) fmul st, st(5)
fadd qword ptr [ebx + FPx] fadd qword ptr [eax + FPx]
fstp qword ptr [ebx + FPx] fstp qword ptr [eax + FPx]
fmulp fmulp
fsin fsin
fmulp st(2), st fmulp st(2), st
faddp faddp
fmulp fmulp
fadd qword ptr [ebx + FPy] fadd qword ptr [eax + FPy]
fstp qword ptr [ebx + FPy] fstp qword ptr [eax + FPy]
fwait fwait
{$endif} {$endif}
end; end;
@ -1580,6 +1571,24 @@ begin
// CPpoint.y := p[0,1] * FPx + p[1,1] * FPy + p[2,1]; // CPpoint.y := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
end; end;
procedure TXForm.NextPointTo(var CPpoint, ToPoint: TCPpoint);
var
i: Integer;
begin
ToPoint.c := CPpoint.c * colorC1 + colorC2;
FTx := c00 * CPpoint.x + c10 * CPpoint.y + c20;
FTy := c01 * CPpoint.x + c11 * CPpoint.y + c21;
Fpx := 0;
Fpy := 0;
for i:= 0 to FNrFunctions-1 do
FCalcFunctionList[i];
ToPoint.x := FPx;
ToPoint.y := FPy;
end;
{ {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1659,18 +1668,18 @@ end;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TXForm.NextPoint2C(var px, py, pc1, pc2: double); procedure TXForm.NextPoint2C(var p: T2CPoint);
var var
i: Integer; i: Integer;
begin begin
// first compute the color coord // first compute the color coord
// pc1 := (pc1 + color) * 0.5 * (1 - symmetry) + symmetry * pc1; // pc1 := (pc1 + color) * 0.5 * (1 - symmetry) + symmetry * pc1;
// pc2 := (pc2 + color) * 0.5 * (1 - symmetry) + symmetry * pc2; // pc2 := (pc2 + color) * 0.5 * (1 - symmetry) + symmetry * pc2;
pc1 := pc1 * colorC1 + colorC2; p.c1 := p.c1 * colorC1 + colorC2;
pc2 := pc2 * colorC1 + colorC2; p.c2 := p.c2 * colorC1 + colorC2;
FTx := c00 * px + c10 * py + c20; FTx := c00 * p.x + c10 * p.y + c20;
FTy := c01 * px + c11 * py + c21; FTy := c01 * p.x + c11 * p.y + c21;
Fpx := 0; Fpx := 0;
Fpy := 0; Fpy := 0;
@ -1678,8 +1687,8 @@ begin
for i:= 0 to FNrFunctions-1 do for i:= 0 to FNrFunctions-1 do
FCalcFunctionList[i]; FCalcFunctionList[i];
px := FPx; p.x := FPx;
py := FPy; p.y := FPy;
// px := p[0,0] * FPx + p[1,0] * FPy + p[2,0]; // px := p[0,0] * FPx + p[1,0] * FPy + p[2,0];
// py := p[0,1] * FPx + p[1,1] * FPy + p[2,1]; // py := p[0,1] * FPx + p[1,1] * FPy + p[2,1];
end; end;

View File

@ -1,6 +1,6 @@
object frmPostProcess: TfrmPostProcess object frmPostProcess: TfrmPostProcess
Left = 38 Left = 61
Top = 43 Top = 77
Width = 640 Width = 640
Height = 534 Height = 534
Caption = 'Post Render' Caption = 'Post Render'
@ -36,40 +36,75 @@ object frmPostProcess: TfrmPostProcess
Height = 13 Height = 13
Caption = 'Background Color' Caption = 'Background Color'
end end
object Label2: TLabel object pnlFilter: TPanel
Left = 12 Left = 8
Top = 34 Top = 32
Width = 24 Width = 97
Height = 13 Height = 21
Caption = 'Filter' Cursor = crHandPoint
BevelOuter = bvLowered
Caption = 'Filter Radius'
TabOrder = 13
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end end
object Label3: TLabel object pnlVibrancy: TPanel
Left = 172 Left = 344
Top = 12 Top = 32
Width = 35 Width = 81
Height = 13 Height = 21
Caption = 'Gamma' Cursor = crHandPoint
BevelOuter = bvLowered
Caption = 'Vibrancy'
TabOrder = 12
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end end
object Label4: TLabel object pnlBrightness: TPanel
Left = 332 Left = 184
Top = 34 Top = 32
Width = 45 Width = 81
Height = 13 Height = 21
Caption = 'Vibrancy:' Cursor = crHandPoint
end BevelOuter = bvLowered
object Label5: TLabel
Left = 332
Top = 12
Width = 42
Height = 13
Caption = 'Contrast'
end
object Label6: TLabel
Left = 172
Top = 34
Width = 50
Height = 13
Caption = 'Brightness' Caption = 'Brightness'
TabOrder = 10
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object pnlContrast: TPanel
Left = 344
Top = 8
Width = 81
Height = 21
Cursor = crHandPoint
BevelOuter = bvLowered
Caption = 'Contrast'
TabOrder = 11
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end
object pnlGamma: TPanel
Left = 184
Top = 8
Width = 81
Height = 21
Cursor = crHandPoint
BevelOuter = bvLowered
Caption = 'Gamma'
TabOrder = 9
OnDblClick = DragPanelDblClick
OnMouseDown = DragPanelMouseDown
OnMouseMove = DragPanelMouseMove
OnMouseUp = DragPanelMouseUp
end end
object btnSave: TButton object btnSave: TButton
Left = 552 Left = 552
@ -112,7 +147,7 @@ object frmPostProcess: TfrmPostProcess
end end
object txtFilterRadius: TEdit object txtFilterRadius: TEdit
Left = 104 Left = 104
Top = 30 Top = 32
Width = 57 Width = 57
Height = 21 Height = 21
TabOrder = 2 TabOrder = 2
@ -124,9 +159,9 @@ object frmPostProcess: TfrmPostProcess
Height = 21 Height = 21
TabOrder = 3 TabOrder = 3
end end
object txtVib: TEdit object txtVibrancy: TEdit
Left = 424 Left = 424
Top = 30 Top = 32
Width = 57 Width = 57
Height = 21 Height = 21
TabOrder = 6 TabOrder = 6
@ -140,7 +175,7 @@ object frmPostProcess: TfrmPostProcess
end end
object txtBrightness: TEdit object txtBrightness: TEdit
Left = 264 Left = 264
Top = 30 Top = 32
Width = 57 Width = 57
Height = 21 Height = 21
TabOrder = 4 TabOrder = 4

View File

@ -16,29 +16,47 @@ type
pnlBackColor: TPanel; pnlBackColor: TPanel;
ColorDialog: TColorDialog; ColorDialog: TColorDialog;
ProgressBar1: TProgressBar; ProgressBar1: TProgressBar;
Label2: TLabel;
btnApply: TButton; btnApply: TButton;
txtFilterRadius: TEdit; txtFilterRadius: TEdit;
Label3: TLabel;
txtGamma: TEdit; txtGamma: TEdit;
Label4: TLabel; txtVibrancy: TEdit;
txtVib: TEdit;
Label5: TLabel;
txtContrast: TEdit; txtContrast: TEdit;
Label6: TLabel;
txtBrightness: TEdit; txtBrightness: TEdit;
pnlGamma: TPanel;
pnlBrightness: TPanel;
pnlContrast: TPanel;
pnlVibrancy: TPanel;
pnlFilter: TPanel;
procedure btnSaveClick(Sender: TObject); procedure btnSaveClick(Sender: TObject);
procedure btnApplyClick(Sender: TObject); procedure btnApplyClick(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
procedure pnlBackColorClick(Sender: TObject); procedure pnlBackColorClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure DragPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DragPanelMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure DragPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DragPanelDblClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
FRenderer: TBaseRenderer; FRenderer: TBaseRenderer;
FCP: TControlPoint; FCP: TControlPoint;
FImagename: string; FImagename: string;
pnlDragMode, pnlDragged, pnlMM: boolean;
pnlDragPos, pnlDragOld: integer;
pnlDragValue: double;
mousepos: TPoint;
BkgColor: TColor;
Filter,
Gamma, Brightness,
Contrast, Vibrancy: double;
procedure UpdateFlame; procedure UpdateFlame;
procedure SetDefaultValues; procedure SetDefaultValues;
@ -123,12 +141,18 @@ end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
procedure TfrmPostProcess.SetDefaultValues; procedure TfrmPostProcess.SetDefaultValues;
begin begin
pnlBackColor.Color := RGB(Fcp.background[0], Fcp.background[1], Fcp.background[2]); BkgColor := RGB(Fcp.background[0], Fcp.background[1], Fcp.background[2]);
txtFilterRadius.Text := FloatTostr(FCP.spatial_filter_radius); pnlBackColor.Color := BkgColor;
txtGamma.Text := FloatTostr(FCP.gamma); Filter := FCP.spatial_filter_radius;
txtVib.Text := FloatTostr(FCP.vibrancy); txtFilterRadius.Text := FloatTostr(Filter);
txtContrast.Text := FloatTostr(FCP.contrast); Gamma := FCP.gamma;
txtBrightness.Text := FloatTostr(FCP.brightness); txtGamma.Text := FloatTostr(Gamma);
Vibrancy := FCP.vibrancy;
txtVibrancy.Text := FloatTostr(Vibrancy);
Contrast := FCP.contrast;
txtContrast.Text := FloatTostr(Contrast);
Brightness := FCP.brightness;
txtBrightness.Text := FloatTostr(brightness);
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -201,13 +225,13 @@ begin
txtGamma.Text := FloatTostr(0.01); txtGamma.Text := FloatTostr(0.01);
end; end;
TryStrToFloat(txtVib.Text, FCP.vibrancy); TryStrToFloat(txtVibrancy.Text, FCP.vibrancy);
if FCP.vibrancy > 10 then begin if FCP.vibrancy > 10 then begin
FCP.vibrancy := 10; FCP.vibrancy := 10;
txtVib.Text := '10'; txtVibrancy.Text := '10';
end else if FCP.vibrancy < 0.01 then begin end else if FCP.vibrancy < 0.01 then begin
FCP.vibrancy := 0.01; FCP.vibrancy := 0.01;
txtVib.Text := FloatTostr(0.01); txtVibrancy.Text := FloatTostr(0.01);
end; end;
TryStrToFloat(txtContrast.Text, FCP.contrast); TryStrToFloat(txtContrast.Text, FCP.contrast);
@ -220,9 +244,9 @@ begin
end; end;
TryStrToFloat(txtBrightness.Text, FCP.brightness); TryStrToFloat(txtBrightness.Text, FCP.brightness);
if FCP.brightness > 10 then begin if FCP.brightness > 100 then begin
FCP.brightness := 10; FCP.brightness := 100;
txtBrightness.Text := '10'; txtBrightness.Text := '100';
end else if FCP.brightness < 0.01 then begin end else if FCP.brightness < 0.01 then begin
FCP.brightness := 0.01; FCP.brightness := 0.01;
txtBrightness.Text := FloatTostr(0.01); txtBrightness.Text := FloatTostr(0.01);
@ -243,5 +267,165 @@ begin
FImagename := imagename; FImagename := imagename;
end; end;
/////////////////////////////////////////////////////////////////////////////// // -----------------------------------------------------------------------------
procedure TfrmPostProcess.DragPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if Button <> mbLeft then exit;
if (Sender = pnlFilter) then
pnlDragValue := fcp.spatial_filter_radius * 10
else if (Sender = pnlGamma) then
pnlDragValue := fcp.gamma
else if (Sender = pnlBrightness) then
pnlDragValue := fcp.brightness
else if (Sender = pnlContrast) then
pnlDragValue := fcp.contrast
else if (Sender = pnlVibrancy) then
pnlDragValue := fcp.vibrancy
else assert(false);
pnlDragMode := true;
pnlDragPos := 0;
pnlDragOld := x;
pnlMM := false;
SetCaptureControl(TControl(Sender));
Screen.Cursor := crHSplit;
GetCursorPos(mousepos); // hmmm
pnlDragged := false;
end;
procedure TfrmPostProcess.DragPanelMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
v: double;
pEdit: ^TEdit;
begin
if pnlMM then // hack: to skip MouseMove event
begin
pnlMM:=false;
end
else
if pnlDragMode and (x <> pnlDragOld) then
begin
Inc(pnlDragPos, x - pnlDragOld);
if GetKeyState(VK_MENU) < 0 then v := 100000
else if GetKeyState(VK_CONTROL) < 0 then v := 10000
else if GetKeyState(VK_SHIFT) < 0 then v := 100
else v := 1000;
v := Round6(pnlDragValue + pnlDragPos / v);
SetCursorPos(MousePos.x, MousePos.y); // hmmm
pnlMM:=true;
if (Sender = pnlFilter) then
begin
v := v / 10;
if v > 2 then v := 2
else if v < 0.01 then v := 0.01;
fcp.spatial_filter_radius := v;
pEdit := @txtFilterRadius;
end
else if (Sender = pnlGamma) then
begin
if v > 10 then v := 10
else if v < 0.01 then v := 0.01;
fcp.gamma := v;
pEdit := @txtGamma;
end
else if (Sender = pnlBrightness) then
begin
if v > 100 then v := 100
else if v < 0.01 then v := 0.01;
fcp.brightness := v;
pEdit := @txtBrightness;
end
else if (Sender = pnlContrast) then
begin
if v > 10 then v := 10
else if v < 0.01 then v := 0.01;
fcp.contrast := v;
pEdit := @txtContrast;
end
else if (Sender = pnlVibrancy) then
begin
if v > 10 then v := 10
else if v < 0.01 then v := 0.01;
fcp.vibrancy := v;
pEdit := @txtVibrancy;
end;
pEdit^.Text := FloatToStr(v);
//pEdit.Refresh;
pnlDragged := True;
// TODO: image preview (?)
//DrawPreview;
end;
end;
procedure TfrmPostProcess.DragPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button <> mbLeft then exit;
if pnlDragMode then
begin
SetCaptureControl(nil);
pnlDragMode := false;
Screen.Cursor := crDefault;
if pnlDragged then
begin
UpdateFlame;
pnlDragged := False;
end;
end;
end;
procedure TfrmPostProcess.DragPanelDblClick(Sender: TObject);
var
pValue: ^double;
pDefaultValue: ^double;
pEdit: ^TEdit;
begin
if (Sender = pnlFilter) then
begin
pValue := @fcp.spatial_filter_radius;
pDefaultValue := @Filter;
pEdit := @txtFilterRadius;
end
else if (Sender = pnlGamma) then
begin
pValue := @fcp.gamma;
pDefaultValue := @Gamma;
pEdit := @txtGamma;
end
else if (Sender = pnlBrightness) then
begin
pValue := @fcp.brightness;
pDefaultValue := @Brightness;
pEdit := @txtBrightness;
end
else if (Sender = pnlContrast) then
begin
pValue := @fcp.contrast;
pDefaultValue := @Contrast;
pEdit := @txtContrast
end
else if (Sender = pnlVibrancy) then
begin
pValue := @fcp.vibrancy;
pDefaultValue := @Vibrancy;
pEdit := @txtVibrancy;
end
else assert(false);
if pValue^ = pDefaultValue^ then exit;
pValue^ := pDefaultValue^;
pEdit^.Text := FloatToStr(pValue^);
UpdateFlame;
end;
end. end.