Added some global variables

This commit is contained in:
ronaldhordijk 2005-09-19 17:55:12 +00:00
parent 510c4c87a9
commit 6066459f61
7 changed files with 154 additions and 35 deletions

View File

@ -49,13 +49,6 @@ object RenderForm: TRenderForm
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Label6: TLabel
Left = 204
Top = 340
Width = 118
Height = 13
Caption = 'TestValue Nr Of Threads'
end
object ProgressBar: TProgressBar
Left = 0
Top = 392
@ -469,16 +462,6 @@ object RenderForm: TRenderForm
Caption = 'Post render'
TabOrder = 9
end
object edtNrThreads: TEdit
Left = 336
Top = 336
Width = 73
Height = 21
BiDiMode = bdRightToLeft
ParentBiDiMode = False
TabOrder = 13
Text = '1'
end
object SaveDialog: TSaveDialog
Left = 368
Top = 256

View File

@ -66,8 +66,6 @@ type
StatusBar: TStatusBar;
chkShutdown: TCheckBox;
cbPostProcess: TCheckBox;
edtNrThreads: TEdit;
Label6: TLabel;
txtDensity: TComboBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
@ -339,7 +337,7 @@ begin
Renderer.Compatibility := compatibility;
Renderer.SetCP(cp);
Renderer.Priority := tpLower;
Renderer.NrThreads := StrToInt(edtNrThreads.text);
Renderer.NrThreads := NrTreads;
Renderer.Resume;
// enable screensaver

View File

@ -127,7 +127,10 @@ var
defLibrary: string;
LimitVibrancy: Boolean;
DefaultPalette: TColorMap;
PNGTransparency: integer;
ShowTransparency: boolean;
NrTreads: Integer;
UseNrThreads: integer;
function Round6(x: double): double;

View File

@ -146,8 +146,10 @@ end;
///////////////////////////////////////////////////////////////////////////////
function TImageMaker.GetImage: TBitmap;
begin
// Result := GetTransparentImage;
Result := FBitmap;
if ShowTransparency then
Result := GetTransparentImage
else
Result := FBitmap;
end;
///////////////////////////////////////////////////////////////////////////////
@ -193,8 +195,14 @@ end;
///////////////////////////////////////////////////////////////////////////////
procedure TImageMaker.CreateImage(YOffset: integer);
begin
CreateImage_Flame3(YOffset);
// CreateImage_MB(YOffset);
Case PNGTransparency of
0,1:
CreateImage_Flame3(YOffset);
2:
CreateImage_MB(YOffset);
else
Exception.CreateFmt('Unexpected value of PNGTransparency [%d]', [PNGTransparency]);
end;
end;
///////////////////////////////////////////////////////////////////////////////
@ -586,13 +594,22 @@ begin
if UpperCase(ExtractFileExt(FileName)) = '.PNG' then begin
PngObject := TPngObject.Create;
PngObject.Assign(FBitmap);
PngObject.CreateAlpha;
for i:= 0 to FAlphaBitmap.Height - 1 do begin
rowbm := PByteArray(FAlphaBitmap.scanline[i]);
rowpng := PByteArray(PngObject.AlphaScanline[i]);
for row := 0 to FAlphaBitmap.Width -1 do begin
rowpng[row] := rowbm[row];
Case PNGTransparency of
0:
; // do nothing
1,2:
begin
PngObject.CreateAlpha;
for i:= 0 to FAlphaBitmap.Height - 1 do begin
rowbm := PByteArray(FAlphaBitmap.scanline[i]);
rowpng := PByteArray(PngObject.AlphaScanline[i]);
for row := 0 to FAlphaBitmap.Width -1 do begin
rowpng[row] := rowbm[row];
end;
end;
end;
else
Exception.CreateFmt('Unexpected value of PNGTransparency [%d]', [PNGTransparency]);
end;
PngObject.SaveToFile(FileName);

View File

@ -161,6 +161,68 @@ object OptionsForm: TOptionsForm
Caption = 'Resize on load'
TabOrder = 5
end
object GroupBox15: TGroupBox
Left = 8
Top = 134
Width = 129
Height = 83
Caption = 'PNG Transparency'
TabOrder = 6
object RadioButton1: TRadioButton
Left = 12
Top = 16
Width = 113
Height = 17
Caption = 'No transparency'
TabOrder = 0
end
object RadioButton2: TRadioButton
Left = 12
Top = 32
Width = 113
Height = 17
Caption = 'Like Flame3'
TabOrder = 1
end
object RadioButton3: TRadioButton
Left = 12
Top = 48
Width = 113
Height = 17
Caption = 'Like Flamesong'
TabOrder = 2
end
end
object GroupBox16: TGroupBox
Left = 140
Top = 134
Width = 117
Height = 51
Caption = 'Nr processors'
TabOrder = 7
object cbNrTheads: TComboBox
Left = 12
Top = 20
Width = 89
Height = 21
ItemHeight = 13
TabOrder = 0
Text = '200'
Items.Strings = (
'Off'
'2'
'4'
'8')
end
end
object cbShowTransparancy: TCheckBox
Left = 144
Top = 196
Width = 169
Height = 17
Caption = 'Show Transparancy'
TabOrder = 8
end
end
object DisplayPage: TTabSheet
Caption = 'Display'
@ -553,10 +615,11 @@ object OptionsForm: TOptionsForm
object clbVarEnabled: TCheckListBox
Left = 12
Top = 16
Width = 205
Width = 309
Height = 189
ItemHeight = 13
TabOrder = 0
TabWidth = 100
end
end
object btnSetAll: TButton

View File

@ -174,6 +174,13 @@ type
Label37: TLabel;
txtLibrary: TEdit;
clbVarEnabled: TCheckListBox;
GroupBox15: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
GroupBox16: TGroupBox;
cbNrTheads: TComboBox;
cbShowTransparancy: TCheckBox;
procedure btnCancelClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnOKClick(Sender: TObject);
@ -250,6 +257,17 @@ begin
chkFixedReference.Checked := FixedReference;
udBatchSize.Position := BatchSize;
chkResize.checked := ResizeOnLoad;
case PNGTransparency of
0: RadioButton1.Checked := True;
1: RadioButton2.Checked := True;
2: RadioButton3.Checked := True;
else
end;
if NrTreads <= 1 then
cbNrTheads.ItemIndex := 0
else
cbNrTheads.text := intTostr(NrTreads);
cbShowTransparancy.Checked := ShowTransparency;
{ Display tab }
txtSampleDensity.Text := FloatToStr(defSampleDensity);
@ -345,6 +363,16 @@ begin
if BatchSize < 1 then BatchSize := 1;
if BatchSize > 300 then BatchSize := 300;
if RadioButton1.Checked then
PNGTransparency := 0
else if RadioButton2.Checked then
PNGTransparency := 1
else if RadioButton3.Checked then
PNGTransparency := 2;
ShowTransparency := cbShowTransparancy.Checked;
NrTreads := StrToIntDef(cbNrTheads.text, 0);
ConfirmDelete := chkConfirmDel.Checked;
FixedReference := chkFixedReference.Checked;
ResizeOnLoad := chkResize.checked;

View File

@ -480,11 +480,29 @@ begin
if Registry.ValueExists('ShowProgress') then
begin
ShowProgress := Registry.ReadBool('ShowProgress');
end
else
begin
end else begin
ShowProgress := true;
end;
if Registry.ValueExists('PNGTransparency') then begin
PNGTransparency := Registry.ReadInteger('PNGTransparency');
end else begin
PNGTransparency := 2
end;
if Registry.ValueExists('ShowTransparency') then begin
ShowTransparency := Registry.ReadBool('ShowTransparency');
end else begin
ShowTransparency := False;
end;
if Registry.ValueExists('NrTreads') then begin
NrTreads := Registry.ReadInteger('NrTreads');
end else begin
NrTreads := 1;
end;
if Registry.ValueExists('UseNrThreads') then begin
UseNrThreads := Registry.ReadInteger('UseNrThreads');
end else begin
UseNrThreads := 1;
end;
end
else
begin
@ -542,6 +560,10 @@ begin
SheepServer := 'http://v2d5.sheepserver.net/';
ResizeOnLoad := False;
ShowProgress := true;
PNGTransparency := 2;
ShowTransparency := False;
NrTreads := 1;
UseNrThreads := 1;
end;
Registry.CloseKey;
{ Render }
@ -876,6 +898,11 @@ begin
Registry.WriteBool('ShowProgress', ShowProgress);
Registry.WriteBool('KeepBackground', KeepBackground);
Registry.WriteString('FunctionLibrary', defLibrary);
Registry.WriteBool('ShowTransparency', ShowTransparency);
Registry.WriteInteger('PNGTransparency', PNGTransparency);
Registry.WriteInteger('NrTreads', NrTreads);
Registry.WriteInteger('UseNrThreads', UseNrThreads);
end;
{ Display }
if Registry.OpenKey('\Software\' + APP_NAME + '\Display', True) then