fpvviewer: Adds options to test rsvg and new svg coords

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4672 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2016-05-30 06:38:29 +00:00
parent 734a8fd99c
commit bba37d9d79
2 changed files with 58 additions and 25 deletions

View File

@@ -11,8 +11,8 @@ object frmFPVViewer: TfrmFPVViewer
LCLVersion = '1.7' LCLVersion = '1.7'
object notebook: TNotebook object notebook: TNotebook
Left = 0 Left = 0
Height = 424 Height = 408
Top = 176 Top = 192
Width = 485 Width = 485
PageIndex = 0 PageIndex = 0
Align = alClient Align = alClient
@@ -73,16 +73,24 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 176 Height = 192
Top = 0 Top = 0
Width = 485 Width = 485
Align = alTop Align = alTop
ClientHeight = 176 ClientHeight = 192
ClientWidth = 485 ClientWidth = 485
TabOrder = 1 TabOrder = 1
object checkboxForceBottomLeftOrigin: TCheckBox
Left = 184
Height = 19
Top = 168
Width = 153
Caption = 'Force Bottom-Left Origin'
TabOrder = 18
end
object editFileName: TFileNameEdit object editFileName: TFileNameEdit
Left = 8 Left = 8
Height = 22 Height = 23
Top = 8 Top = 8
Width = 304 Width = 304
DialogOptions = [] DialogOptions = []
@@ -104,7 +112,7 @@ object frmFPVViewer: TfrmFPVViewer
end end
object spinScale: TFloatSpinEdit object spinScale: TFloatSpinEdit
Left = 72 Left = 72
Height = 16 Height = 23
Top = 97 Top = 97
Width = 168 Width = 168
DecimalPlaces = 6 DecimalPlaces = 6
@@ -117,9 +125,9 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label1: TLabel object Label1: TLabel
Left = 8 Left = 8
Height = 16 Height = 15
Top = 97 Top = 97
Width = 55 Width = 46
Caption = 'Scale by:' Caption = 'Scale by:'
ParentColor = False ParentColor = False
end end
@@ -161,15 +169,15 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label2: TLabel object Label2: TLabel
Left = 8 Left = 8
Height = 16 Height = 15
Top = 72 Top = 72
Width = 88 Width = 73
Caption = 'Y adjustment:' Caption = 'Y adjustment:'
ParentColor = False ParentColor = False
end end
object spinAdjustY: TSpinEdit object spinAdjustY: TSpinEdit
Left = 80 Left = 80
Height = 16 Height = 23
Top = 72 Top = 72
Width = 72 Width = 72
Increment = 100 Increment = 100
@@ -180,7 +188,7 @@ object frmFPVViewer: TfrmFPVViewer
end end
object spinAdjustX: TSpinEdit object spinAdjustX: TSpinEdit
Left = 232 Left = 232
Height = 16 Height = 23
Top = 72 Top = 72
Width = 72 Width = 72
Increment = 50 Increment = 50
@@ -191,9 +199,9 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label3: TLabel object Label3: TLabel
Left = 160 Left = 160
Height = 16 Height = 15
Top = 72 Top = 72
Width = 88 Width = 73
Caption = 'X adjustment:' Caption = 'X adjustment:'
ParentColor = False ParentColor = False
end end
@@ -208,18 +216,18 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label4: TLabel object Label4: TLabel
Left = 9 Left = 9
Height = 16 Height = 15
Top = 126 Top = 126
Width = 153 Width = 128
Caption = 'Force encoding on read:' Caption = 'Force encoding on read:'
ParentColor = False ParentColor = False
end end
object comboEncoding: TComboBox object comboEncoding: TComboBox
Left = 144 Left = 144
Height = 20 Height = 23
Top = 126 Top = 126
Width = 128 Width = 128
ItemHeight = 0 ItemHeight = 15
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'Read from the file' 'Read from the file'
@@ -255,17 +263,17 @@ object frmFPVViewer: TfrmFPVViewer
end end
object labelFileEncoding: TLabel object labelFileEncoding: TLabel
Left = 278 Left = 278
Height = 16 Height = 15
Top = 130 Top = 130
Width = 88 Width = 74
Caption = 'File encoding:' Caption = 'File encoding:'
ParentColor = False ParentColor = False
end end
object checkForceWhiteBackground: TCheckBox object checkForceWhiteBackground: TCheckBox
Left = 9 Left = 9
Height = 18 Height = 19
Top = 152 Top = 152
Width = 177 Width = 153
Caption = 'Force white background?' Caption = 'Force white background?'
TabOrder = 11 TabOrder = 11
end end
@@ -297,10 +305,10 @@ object frmFPVViewer: TfrmFPVViewer
TabOrder = 14 TabOrder = 14
end end
object checkShowPage: TCheckBox object checkShowPage: TCheckBox
Left = 200 Left = 184
Height = 18 Height = 19
Top = 152 Top = 152
Width = 90 Width = 78
Caption = 'Show Page' Caption = 'Show Page'
TabOrder = 15 TabOrder = 15
end end
@@ -313,5 +321,15 @@ object frmFPVViewer: TfrmFPVViewer
OnClick = buttonAutoFitClick OnClick = buttonAutoFitClick
TabOrder = 16 TabOrder = 16
end end
object checkboxSVGviaRSVG: TCheckBox
Left = 9
Height = 19
Top = 168
Width = 147
Caption = 'SVG Rendering via RSVG'
Checked = True
State = cbChecked
TabOrder = 17
end
end end
end end

View File

@@ -10,6 +10,7 @@ uses
Printers, PrintersDlgs, LCLIntf, LCLType, Printers, PrintersDlgs, LCLIntf, LCLType,
fpvv_drawer, fpimage, fpcanvas, coreconrec, fpvutils, fpvv_drawer, fpimage, fpcanvas, coreconrec, fpvutils,
fpvectorial, lasvectorialreader, svgvectorialwriter, fpvectorial, lasvectorialreader, svgvectorialwriter,
svgvectorialreader_rsvg, svgvectorialreader,
dxfvectorialreader, epsvectorialreader, fpvtocanvas, dxftokentotree; dxfvectorialreader, epsvectorialreader, fpvtocanvas, dxftokentotree;
type type
@@ -28,6 +29,8 @@ type
buttonAdjust: TButton; buttonAdjust: TButton;
buttonViewDebugInfo: TButton; buttonViewDebugInfo: TButton;
buttonAutoFitView: TButton; buttonAutoFitView: TButton;
checkboxSVGviaRSVG: TCheckBox;
checkboxForceBottomLeftOrigin: TCheckBox;
checkShowPage: TCheckBox; checkShowPage: TCheckBox;
checkForceWhiteBackground: TCheckBox; checkForceWhiteBackground: TCheckBox;
comboEncoding: TComboBox; comboEncoding: TComboBox;
@@ -550,6 +553,17 @@ begin
FVec.ForcedEncodingOnRead := comboEncoding.Text FVec.ForcedEncodingOnRead := comboEncoding.Text
else FVec.ForcedEncodingOnRead := ''; else FVec.ForcedEncodingOnRead := '';
// checkbox options
{$ifdef Windows}
gSVGVecReader_RSVG_Path := ExtractFilePath(paramstr(0))+'rsvg\rsvg-convert.exe';
{$endif}
gSVGVecReader_UseTopLeftCoords := not checkboxForceBottomLeftOrigin.Checked;
if checkboxSVGviaRSVG.Checked then
RegisterVectorialReader(TvSVGVectorialReader_RSVG, vfSVG)
else
RegisterVectorialReader(TvSVGVectorialReader, vfSVG);
// Actual reading process
FVec.ReadFromFile(editFileName.FileName); FVec.ReadFromFile(editFileName.FileName);
// some formats like HTML need an input of control size to render themselves // some formats like HTML need an input of control size to render themselves
@@ -567,6 +581,7 @@ const
var var
CanvasSize: TPoint; CanvasSize: TPoint;
begin begin
if FVec = nil then Exit;
// We need to be robust, because sometimes the document size won't be given // We need to be robust, because sometimes the document size won't be given
// also give up drawing everything if we need more then 4MB of RAM for the image // also give up drawing everything if we need more then 4MB of RAM for the image
// and also give some space in the image to allow for negative coordinates // and also give some space in the image to allow for negative coordinates