Store the cmapindex and use it to select the correct gradien in the adjust window
This commit is contained in:
parent
3c5e316960
commit
ea11c313df
@ -173,7 +173,7 @@ object AdjustForm: TAdjustForm
|
|||||||
Top = 133
|
Top = 133
|
||||||
Width = 390
|
Width = 390
|
||||||
Height = 131
|
Height = 131
|
||||||
ActivePage = TabSheet2
|
ActivePage = TabSheet3
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object TabSheet1: TTabSheet
|
object TabSheet1: TTabSheet
|
||||||
@ -912,7 +912,7 @@ object AdjustForm: TAdjustForm
|
|||||||
Top = 12
|
Top = 12
|
||||||
Width = 73
|
Width = 73
|
||||||
Height = 21
|
Height = 21
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
Text = '512'
|
Text = '512'
|
||||||
@ -930,7 +930,7 @@ object AdjustForm: TAdjustForm
|
|||||||
Top = 36
|
Top = 36
|
||||||
Width = 73
|
Width = 73
|
||||||
Height = 21
|
Height = 21
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
Text = '384'
|
Text = '384'
|
||||||
|
@ -281,6 +281,7 @@ type
|
|||||||
procedure WritePreset(n: integer);
|
procedure WritePreset(n: integer);
|
||||||
function PresetToStr(n: integer): string;
|
function PresetToStr(n: integer): string;
|
||||||
|
|
||||||
|
procedure UpdateGradient(Pal: TColorMap);
|
||||||
// --
|
// --
|
||||||
public
|
public
|
||||||
PreviewDensity: double;
|
PreviewDensity: double;
|
||||||
@ -291,7 +292,6 @@ type
|
|||||||
procedure UpdateDisplay;
|
procedure UpdateDisplay;
|
||||||
procedure UpdateFlame;
|
procedure UpdateFlame;
|
||||||
|
|
||||||
procedure UpdateGradient(Pal: TColorMap);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -364,7 +364,12 @@ begin
|
|||||||
Resetting := False;
|
Resetting := False;
|
||||||
DrawPreview;
|
DrawPreview;
|
||||||
|
|
||||||
Palette:=cp.cmap;
|
// gradient
|
||||||
|
if cp.cmapindex >= 0 then
|
||||||
|
cmbPalette.ItemIndex := cp.cmapindex;
|
||||||
|
ScrollBar.Position := 0;
|
||||||
|
Palette := cp.cmap;
|
||||||
|
BackupPal := cp.cmap;
|
||||||
DrawPalette;
|
DrawPalette;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ object GradientBrowser: TGradientBrowser
|
|||||||
0000800300008003000080030000800300008003000080030000800300008003
|
0000800300008003000080030000800300008003000080030000800300008003
|
||||||
000080030000800300008003000080070000800F0000801F0000803F0000}
|
000080030000800300008003000080070000800F0000801F0000803F0000}
|
||||||
OldCreateOrder = False
|
OldCreateOrder = False
|
||||||
Position = poDefaultPosOnly
|
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
@ -54,7 +53,7 @@ object GradientBrowser: TGradientBrowser
|
|||||||
Left = 0
|
Left = 0
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 372
|
Width = 372
|
||||||
Height = 105
|
Height = 99
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -98,7 +97,7 @@ object GradientBrowser: TGradientBrowser
|
|||||||
end
|
end
|
||||||
object pnlControls: TPanel
|
object pnlControls: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 109
|
Top = 103
|
||||||
Width = 372
|
Width = 372
|
||||||
Height = 51
|
Height = 51
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
|
@ -470,10 +470,8 @@ begin
|
|||||||
MainForm.StopThread;
|
MainForm.StopThread;
|
||||||
MainForm.UpdateUndo;
|
MainForm.UpdateUndo;
|
||||||
MainCp.cmap := Palette;
|
MainCp.cmap := Palette;
|
||||||
//gradientForm.UpdateGradient(Palette);
|
|
||||||
AdjustForm.UpdateGradient(Palette);
|
|
||||||
if EditForm.Visible then EditForm.UpdateDisplay;
|
if EditForm.Visible then EditForm.UpdateDisplay;
|
||||||
// if AdjustForm.Visible then AdjustForm.UpdateDisplay;
|
if AdjustForm.Visible then AdjustForm.UpdateDisplay;
|
||||||
if MutateForm.Visible then MutateForm.UpdateDisplay;
|
if MutateForm.Visible then MutateForm.UpdateDisplay;
|
||||||
MainForm.RedrawTimer.enabled := true;
|
MainForm.RedrawTimer.enabled := true;
|
||||||
end;
|
end;
|
||||||
|
@ -76,7 +76,6 @@ var
|
|||||||
UPRHeight: Integer;
|
UPRHeight: Integer;
|
||||||
ImageFolder: string;
|
ImageFolder: string;
|
||||||
UPRPath: string; // Name and folder of last UPR file
|
UPRPath: string; // Name and folder of last UPR file
|
||||||
UpdateGradient: boolean;
|
|
||||||
cmap_index: integer; // Index to current gradient
|
cmap_index: integer; // Index to current gradient
|
||||||
Variation: TVariation; // Current variation
|
Variation: TVariation; // Current variation
|
||||||
NumTries, TryLength: integer; // Settings for smooth palette
|
NumTries, TryLength: integer; // Settings for smooth palette
|
||||||
|
@ -27,7 +27,7 @@ object MainForm: TMainForm
|
|||||||
Left = 160
|
Left = 160
|
||||||
Top = 28
|
Top = 28
|
||||||
Width = 4
|
Width = 4
|
||||||
Height = 480
|
Height = 494
|
||||||
end
|
end
|
||||||
object ToolBar: TToolBar
|
object ToolBar: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -283,7 +283,7 @@ object MainForm: TMainForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Top = 28
|
Top = 28
|
||||||
Width = 160
|
Width = 160
|
||||||
Height = 480
|
Height = 494
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
Columns = <
|
Columns = <
|
||||||
item
|
item
|
||||||
@ -302,7 +302,7 @@ object MainForm: TMainForm
|
|||||||
Left = 164
|
Left = 164
|
||||||
Top = 28
|
Top = 28
|
||||||
Width = 433
|
Width = 433
|
||||||
Height = 480
|
Height = 494
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BevelInner = bvLowered
|
BevelInner = bvLowered
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
@ -326,7 +326,7 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object StatusBar: TStatusBar
|
object StatusBar: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 508
|
Top = 522
|
||||||
Width = 597
|
Width = 597
|
||||||
Height = 19
|
Height = 19
|
||||||
Panels = <
|
Panels = <
|
||||||
|
@ -1363,11 +1363,11 @@ begin
|
|||||||
x := cp1.center[0];
|
x := cp1.center[0];
|
||||||
y := cp1.center[1];
|
y := cp1.center[1];
|
||||||
pal := ''; hue := '';
|
pal := ''; hue := '';
|
||||||
if sheep then
|
// if sheep then
|
||||||
begin
|
// begin
|
||||||
pal := 'palette="' + IntToStr(cp1.cmapindex) + '" ';
|
pal := 'palette="' + IntToStr(cp1.cmapindex) + '" ';
|
||||||
hue := 'hue="' + format('%g', [cp1.hue_rotation]) + '" ';
|
hue := 'hue="' + format('%g', [cp1.hue_rotation]) + '" ';
|
||||||
end;
|
// end;
|
||||||
if Trim(SheepNick) <> '' then nick := 'nick="' + Trim(SheepNick) + '"';
|
if Trim(SheepNick) <> '' then nick := 'nick="' + Trim(SheepNick) + '"';
|
||||||
if Trim(SheepURL) <> '' then url := 'url="' + Trim(SheepURL) + '" ';
|
if Trim(SheepURL) <> '' then url := 'url="' + Trim(SheepURL) + '" ';
|
||||||
try
|
try
|
||||||
@ -1386,6 +1386,7 @@ begin
|
|||||||
format('brightness="%g" ', [cp1.brightness]) +
|
format('brightness="%g" ', [cp1.brightness]) +
|
||||||
format('gamma="%g" ', [cp1.gamma]) +
|
format('gamma="%g" ', [cp1.gamma]) +
|
||||||
format('vibrancy="%g" ', [cp1.vibrancy]) + hue + url + nick + '>');
|
format('vibrancy="%g" ', [cp1.vibrancy]) + hue + url + nick + '>');
|
||||||
|
|
||||||
{ Write transform parameters }
|
{ Write transform parameters }
|
||||||
t := NumXForms(cp1);
|
t := NumXForms(cp1);
|
||||||
for i := 0 to t - 1 do begin
|
for i := 0 to t - 1 do begin
|
||||||
@ -2334,8 +2335,9 @@ begin
|
|||||||
MainCp.name := RandomPrefix + RandomDate + '-' +
|
MainCp.name := RandomPrefix + RandomDate + '-' +
|
||||||
IntToStr(RandomIndex);
|
IntToStr(RandomIndex);
|
||||||
Transforms := TrianglesFromCP(MainCp, MainTriangles);
|
Transforms := TrianglesFromCP(MainCp, MainTriangles);
|
||||||
// if GradientForm.visible then GradientForm.UpdateGradient(Maincp.cmap);
|
|
||||||
if AdjustForm.visible then AdjustForm.UpdateGradient(Maincp.cmap);
|
if AdjustForm.visible then
|
||||||
|
AdjustForm.UpdateDisplay;
|
||||||
|
|
||||||
StatusBar.Panels[2].text := maincp.name;
|
StatusBar.Panels[2].text := maincp.name;
|
||||||
ResetLocation;
|
ResetLocation;
|
||||||
@ -2977,8 +2979,8 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.UpdateWindows;
|
procedure TMainForm.UpdateWindows;
|
||||||
begin
|
begin
|
||||||
if AdjustForm.visible then AdjustForm.UpdateGradient(maincp.cmap);
|
if AdjustForm.visible then
|
||||||
// if GradientForm.visible then GradientForm.UpdateGradient(maincp.cmap);
|
AdjustForm.UpdateDisplay;
|
||||||
|
|
||||||
if EditForm.visible then EditForm.UpdateDisplay;
|
if EditForm.visible then EditForm.UpdateDisplay;
|
||||||
// hmm I think I still have some problems with EditForm updating
|
// hmm I think I still have some problems with EditForm updating
|
||||||
@ -3052,9 +3054,12 @@ begin
|
|||||||
Transforms := TrianglesFromCP(maincp, MainTriangles);
|
Transforms := TrianglesFromCP(maincp, MainTriangles);
|
||||||
// Trim undo index from title
|
// Trim undo index from title
|
||||||
maincp.name := Copy(Fstrings[0], 6, length(Fstrings[0]) - 7);
|
maincp.name := Copy(Fstrings[0], 6, length(Fstrings[0]) - 7);
|
||||||
if SavedPal then maincp.cmap := palette;
|
|
||||||
// if GradientForm.visible then GradientForm.UpdateGradient(maincp.cmap);
|
if SavedPal then
|
||||||
if AdjustForm.visible then AdjustForm.UpdateGradient(maincp.cmap);
|
maincp.cmap := palette;
|
||||||
|
if AdjustForm.visible then
|
||||||
|
AdjustForm.UpdateDisplay;
|
||||||
|
|
||||||
RedrawTimer.Enabled := True;
|
RedrawTimer.Enabled := True;
|
||||||
UpdateWindows;
|
UpdateWindows;
|
||||||
finally
|
finally
|
||||||
@ -3121,8 +3126,6 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.mnuGradClick(Sender: TObject);
|
procedure TMainForm.mnuGradClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
//gradientForm.UpdateGradient(maincp.cmap);
|
|
||||||
//GradientForm.Show;
|
|
||||||
AdjustForm.UpdateDisplay;
|
AdjustForm.UpdateDisplay;
|
||||||
AdjustForm.PageControl.TabIndex:=2;
|
AdjustForm.PageControl.TabIndex:=2;
|
||||||
AdjustForm.Show;
|
AdjustForm.Show;
|
||||||
@ -3299,7 +3302,7 @@ begin
|
|||||||
StopThread;
|
StopThread;
|
||||||
UpdateUndo;
|
UpdateUndo;
|
||||||
maincp.cmap := Pal;
|
maincp.cmap := Pal;
|
||||||
AdjustForm.UpdateGradient(maincp.cmap);
|
AdjustForm.UpdateDisplay;
|
||||||
|
|
||||||
if EditForm.Visible then EditForm.UpdateDisplay;
|
if EditForm.Visible then EditForm.UpdateDisplay;
|
||||||
if MutateForm.Visible then MutateForm.UpdateDisplay;
|
if MutateForm.Visible then MutateForm.UpdateDisplay;
|
||||||
@ -3720,24 +3723,25 @@ begin
|
|||||||
ScriptEditor.Stopped := True;
|
ScriptEditor.Stopped := True;
|
||||||
StopThread;
|
StopThread;
|
||||||
nxform := 0;
|
nxform := 0;
|
||||||
|
Parsecp.cmapindex := -2; // generate pallet from cmapindex and hue (apo 1 and earlier)
|
||||||
ParseCp.symmetry := 0;
|
ParseCp.symmetry := 0;
|
||||||
XMLScanner.LoadFromBuffer(params);
|
XMLScanner.LoadFromBuffer(params);
|
||||||
XMLScanner.Execute;
|
XMLScanner.Execute;
|
||||||
cp1.copy(ParseCp);
|
cp1.copy(ParseCp);
|
||||||
if Parsecp.cmapindex <> -1 then
|
if Parsecp.cmapindex = -2 then
|
||||||
begin
|
begin
|
||||||
if cp1.cmapindex < NRCMAPS then
|
if cp1.cmapindex < NRCMAPS then
|
||||||
GetCMap(cp1.cmapindex, 1, cp1.cmap)
|
GetCMap(cp1.cmapindex, 1, cp1.cmap)
|
||||||
else
|
else
|
||||||
ShowMessage('Palette index too high');
|
ShowMessage('Palette index too high');
|
||||||
end;
|
|
||||||
if (cp1.hue_rotation > 0) and (cp1.hue_rotation < 1) then
|
if (cp1.hue_rotation > 0) and (cp1.hue_rotation < 1) then begin
|
||||||
begin
|
for i := 0 to 255 do
|
||||||
for i := 0 to 255 do
|
begin
|
||||||
begin
|
RGBToHSV(cp1.cmap[i][0], cp1.cmap[i][1], cp1.cmap[i][2], h, s, v);
|
||||||
RGBToHSV(cp1.cmap[i][0], cp1.cmap[i][1], cp1.cmap[i][2], h, s, v);
|
h := Round(360 + h + (cp1.hue_rotation * 360)) mod 360;
|
||||||
h := Round(360 + h + (cp1.hue_rotation * 360)) mod 360;
|
HSVToRGB(h, s, v, cp1.cmap[i][0], cp1.cmap[i][1], cp1.cmap[i][2]);
|
||||||
HSVToRGB(h, s, v, cp1.cmap[i][0], cp1.cmap[i][1], cp1.cmap[i][2]);
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4094,6 +4098,10 @@ procedure ParseCompactcolors(cp: TControlPoint; count: integer; data: string);
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
|
// diable generating pallete
|
||||||
|
if Parsecp.cmapindex = -2 then
|
||||||
|
Parsecp.cmapindex := -1;
|
||||||
|
|
||||||
Assert(Count = 256,'only 256 color Colormaps are supported at the moment');
|
Assert(Count = 256,'only 256 color Colormaps are supported at the moment');
|
||||||
Assert((Count * 8) = Length(data),'Data size MisMatch');
|
Assert((Count * 8) = Length(data),'Data size MisMatch');
|
||||||
for i := 0 to Count -1 do begin
|
for i := 0 to Count -1 do begin
|
||||||
@ -4172,6 +4180,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
if TagName = 'color' then
|
if TagName = 'color' then
|
||||||
begin
|
begin
|
||||||
|
// diable generating pallete
|
||||||
|
if Parsecp.cmapindex = -2 then
|
||||||
|
Parsecp.cmapindex := -1;
|
||||||
|
|
||||||
i := StrToInt(Attributes.value('index'));
|
i := StrToInt(Attributes.value('index'));
|
||||||
v := Attributes.value('rgb');
|
v := Attributes.value('rgb');
|
||||||
GetTokens(v, tokens);
|
GetTokens(v, tokens);
|
||||||
|
@ -38,7 +38,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
cmap_index := Random(NRCMAPS);
|
cmap_index := Random(NRCMAPS);
|
||||||
GetCMap(cmap_index, 1, DestCP.cmap);
|
GetCMap(cmap_index, 1, DestCP.cmap);
|
||||||
cmap_index := DestCP.cmapindex;
|
// cmap_index := DestCP.cmapindex;
|
||||||
DestCP.cmapIndex := cmap_index;
|
DestCP.cmapIndex := cmap_index;
|
||||||
end;
|
end;
|
||||||
1:
|
1:
|
||||||
|
@ -2958,10 +2958,8 @@ begin
|
|||||||
MainCp.cmap := cp.cmap;
|
MainCp.cmap := cp.cmap;
|
||||||
MainForm.RedrawTimer.enabled := true;
|
MainForm.RedrawTimer.enabled := true;
|
||||||
if EditForm.Visible then EditForm.UpdateDisplay;
|
if EditForm.Visible then EditForm.UpdateDisplay;
|
||||||
// if AdjustForm.Visible then AdjustForm.UpdateDisplay;
|
if AdjustForm.Visible then AdjustForm.UpdateDisplay;
|
||||||
if MutateForm.Visible then MutateForm.UpdateDisplay;
|
if MutateForm.Visible then MutateForm.UpdateDisplay;
|
||||||
// if GradientForm.Visible then GradientForm.UpdateGradient(cmap)
|
|
||||||
if AdjustForm.Visible then AdjustForm.UpdateGradient(cmap)
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ ******************************* functions ********************************** }
|
{ ******************************* functions ********************************** }
|
||||||
|
Loading…
Reference in New Issue
Block a user