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

View File

@@ -10,6 +10,7 @@ uses
Printers, PrintersDlgs, LCLIntf, LCLType,
fpvv_drawer, fpimage, fpcanvas, coreconrec, fpvutils,
fpvectorial, lasvectorialreader, svgvectorialwriter,
svgvectorialreader_rsvg, svgvectorialreader,
dxfvectorialreader, epsvectorialreader, fpvtocanvas, dxftokentotree;
type
@@ -28,6 +29,8 @@ type
buttonAdjust: TButton;
buttonViewDebugInfo: TButton;
buttonAutoFitView: TButton;
checkboxSVGviaRSVG: TCheckBox;
checkboxForceBottomLeftOrigin: TCheckBox;
checkShowPage: TCheckBox;
checkForceWhiteBackground: TCheckBox;
comboEncoding: TComboBox;
@@ -550,6 +553,17 @@ begin
FVec.ForcedEncodingOnRead := comboEncoding.Text
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);
// some formats like HTML need an input of control size to render themselves
@@ -567,6 +581,7 @@ const
var
CanvasSize: TPoint;
begin
if FVec = nil then Exit;
// 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
// and also give some space in the image to allow for negative coordinates