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:
sekelsenmat
2014-07-30 14:38:38 +00:00
parent 2f728bb0d0
commit 07934e5c16
3 changed files with 24402 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View 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>

View File

@ -370,7 +370,7 @@ end;
procedure TfrmFPVViewer.buttonPrintClick(Sender: TObject);
var
printDialog: TPrintDialog;
ScaleX, ScaleY: Double;
ScaleX, ScaleY, lScale: Double;
lRectSrc, lRectDest: TRect;
begin
// Create a printer selection dialog
@ -389,10 +389,20 @@ begin
Printer.BeginDoc;
// Draw the image
{$IFDEF OLD_PRINT_CODE}
ScaleX := LCLIntf.GetDeviceCaps(Handle, logPixelsX) / PixelsPerInch; // Don't know why, but GetDeviceCaps is returning zero...
ScaleY := LCLIntf.GetDeviceCaps(Handle, logPixelsY) / PixelsPerInch;
lRectSrc := Bounds(0, 0, Drawer.Drawing.Width, Drawer.Drawing.Height);
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(
lRectDest,
Drawer.Drawing);