fpvviewer: Preparations for text document rendering

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3401 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2014-07-31 16:08:20 +00:00
parent e96b16b993
commit e8e5b85b57
2 changed files with 28 additions and 24 deletions

View File

@ -82,7 +82,7 @@ object frmFPVViewer: TfrmFPVViewer
TabOrder = 1
object editFileName: TFileNameEdit
Left = 8
Height = 22
Height = 23
Top = 8
Width = 304
DialogOptions = []
@ -104,7 +104,7 @@ object frmFPVViewer: TfrmFPVViewer
end
object spinScale: TFloatSpinEdit
Left = 72
Height = 16
Height = 23
Top = 97
Width = 168
DecimalPlaces = 6
@ -117,9 +117,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 +161,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 +180,7 @@ object frmFPVViewer: TfrmFPVViewer
end
object spinAdjustX: TSpinEdit
Left = 232
Height = 16
Height = 23
Top = 72
Width = 72
Increment = 50
@ -191,9 +191,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 +208,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 +255,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 = 178
Width = 153
Caption = 'Force white background?'
TabOrder = 11
end
@ -298,9 +298,9 @@ object frmFPVViewer: TfrmFPVViewer
end
object checkShowPage: TCheckBox
Left = 216
Height = 18
Height = 19
Top = 152
Width = 87
Width = 78
Caption = 'Show Page'
TabOrder = 15
end

View File

@ -99,6 +99,7 @@ var
Vec: TvVectorialDocument;
CanvasSize: TPoint;
lCurPage: TvVectorialPage;
lPage: TvPage;
begin
// First check the in input
if editFileName.FileName = '' then Exit; // silent exit in this simple case
@ -136,17 +137,20 @@ begin
Drawer.Drawing.Canvas.Brush.Color := clWhite;
Drawer.Drawing.Canvas.Brush.Style := bsSolid;
Drawer.Drawing.Canvas.FillRect(0, 0, Drawer.Drawing.Width, Drawer.Drawing.Height);
if checkForceWhiteBackground.Checked then Vec.GetPageAsVectorial(0).BackgroundColor := colWhite;
lPage := Vec.GetPage(0);
if lPage = nil then
Exception.Create('The document has no pages');
if checkForceWhiteBackground.Checked then lPage.BackgroundColor := colWhite;
if not checkForceWhiteBackground.Checked then
Vec.GetPageAsVectorial(0).DrawBackground(Drawer.Drawing.Canvas);
Vec.GetPageAsVectorial(0).Render(
lPage.DrawBackground(Drawer.Drawing.Canvas);
lPage.Render(
Drawer.Drawing.Canvas,
FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosX,
Drawer.Drawing.Height - FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosY,
spinScale.Value,
-1 * spinScale.Value);
if checkShowPage.Checked then
Vec.GetPageAsVectorial(0).RenderPageBorder(
lPage.RenderPageBorder(
Drawer.Drawing.Canvas,
FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosX,
Drawer.Drawing.Height - FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosY,