lazarus/components/tachart/taprint.pas
ask ab52351a55 TAChart: Fix compilation of taprint unit
git-svn-id: trunk@30496 -
2011-04-28 14:49:26 +00:00

59 lines
1.5 KiB
ObjectPascal

{
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
Authors: Alexander Klenin
}
unit TAPrint;
{$H+}
interface
uses
Printers, TADrawerCanvas;
type
{ TPrinterDrawer }
TPrinterDrawer = class(TCanvasDrawer)
private
FPrinter: TPrinter;
FCoeff: Double;
public
constructor Create(APrinter: TPrinter);
function Scale(ADistance: Integer): Integer; override;
end;
implementation
uses
Forms, Math;
{ TPrinterDrawer }
constructor TPrinterDrawer.Create(APrinter: TPrinter);
begin
FPrinter := APrinter;
inherited Create(FPrinter.Canvas);
FCoeff := Max(FPrinter.XDPI, FPrinter.YDPI) / Screen.PixelsPerInch;
end;
function TPrinterDrawer.Scale(ADistance: Integer): Integer;
begin
Result := Round(ADistance * FCoeff);
end;
end.