You've already forked lazarus-ccr
fpvviewer: Printing improvement and html basic test
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3399 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
24352
applications/fpvviewer/examples_files/dxf/kehik_test_2014_06_13.dxf
Normal file
24352
applications/fpvviewer/examples_files/dxf/kehik_test_2014_06_13.dxf
Normal file
File diff suppressed because it is too large
Load Diff
39
applications/fpvviewer/examples_files/html/basictest_1.html
Normal file
39
applications/fpvviewer/examples_files/html/basictest_1.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Test_20140527</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1> Simple HTML </h1>
|
||||||
|
<h2> Header 2</h2>
|
||||||
|
<h3> Header 3</h3>
|
||||||
|
<h4> Header 4</h4>
|
||||||
|
<h5> Header 5</h5>
|
||||||
|
<h6> Header 6</h6>
|
||||||
|
<p>
|
||||||
|
Below are three stars:
|
||||||
|
</p>
|
||||||
|
<svg width="400" height="200">
|
||||||
|
<defs>
|
||||||
|
<polygon id="tahti" stroke="white" fill="blue"
|
||||||
|
points="60,80 80,80 90,60 100,80 120,80 105,95 110,115 90,105
|
||||||
|
70,115 75,95" />
|
||||||
|
</defs>
|
||||||
|
<use xlink:href="#tahti" x="0" y="10" />
|
||||||
|
<use xlink:href="#tahti" x="100" y="10" />
|
||||||
|
<use xlink:href="#tahti" x="200" y="10" />
|
||||||
|
</svg>
|
||||||
|
<p>
|
||||||
|
and the rectangle should appear.
|
||||||
|
</p>
|
||||||
|
<svg width="400" height="110">
|
||||||
|
<rect width="300" height="100"
|
||||||
|
style="fill:rgb(0,0,255);stroke-width:6;stroke:red" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -370,7 +370,7 @@ end;
|
|||||||
procedure TfrmFPVViewer.buttonPrintClick(Sender: TObject);
|
procedure TfrmFPVViewer.buttonPrintClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
printDialog: TPrintDialog;
|
printDialog: TPrintDialog;
|
||||||
ScaleX, ScaleY: Double;
|
ScaleX, ScaleY, lScale: Double;
|
||||||
lRectSrc, lRectDest: TRect;
|
lRectSrc, lRectDest: TRect;
|
||||||
begin
|
begin
|
||||||
// Create a printer selection dialog
|
// Create a printer selection dialog
|
||||||
@@ -389,10 +389,20 @@ begin
|
|||||||
Printer.BeginDoc;
|
Printer.BeginDoc;
|
||||||
|
|
||||||
// Draw the image
|
// Draw the image
|
||||||
|
{$IFDEF OLD_PRINT_CODE}
|
||||||
ScaleX := LCLIntf.GetDeviceCaps(Handle, logPixelsX) / PixelsPerInch; // Don't know why, but GetDeviceCaps is returning zero...
|
ScaleX := LCLIntf.GetDeviceCaps(Handle, logPixelsX) / PixelsPerInch; // Don't know why, but GetDeviceCaps is returning zero...
|
||||||
ScaleY := LCLIntf.GetDeviceCaps(Handle, logPixelsY) / PixelsPerInch;
|
ScaleY := LCLIntf.GetDeviceCaps(Handle, logPixelsY) / PixelsPerInch;
|
||||||
lRectSrc := Bounds(0, 0, Drawer.Drawing.Width, Drawer.Drawing.Height);
|
lRectSrc := Bounds(0, 0, Drawer.Drawing.Width, Drawer.Drawing.Height);
|
||||||
lRectDest := Bounds(0, 0, Printer.PageWidth, Printer.PageHeight);
|
lRectDest := Bounds(0, 0, Printer.PageWidth, Printer.PageHeight);
|
||||||
|
{$ELSE}
|
||||||
|
ScaleX := Printer.PageWidth / Drawer.Drawing.Width;
|
||||||
|
ScaleY := Printer.PageHeight / Drawer.Drawing.Height;
|
||||||
|
lScale := Min(ScaleX, ScaleY);
|
||||||
|
lRectSrc := Bounds(0, 0, Drawer.Drawing.Width, Drawer.Drawing.Height);
|
||||||
|
lRectDest := Bounds(0, 0,
|
||||||
|
Round(Drawer.Drawing.Width * lScale),
|
||||||
|
Round(Drawer.Drawing.Height * lScale));
|
||||||
|
{$ENDIF}
|
||||||
Printer.Canvas.StretchDraw(
|
Printer.Canvas.StretchDraw(
|
||||||
lRectDest,
|
lRectDest,
|
||||||
Drawer.Drawing);
|
Drawer.Drawing);
|
||||||
|
Reference in New Issue
Block a user