unit Unit1;
interface
uses
System.Classes,
Vcl.Graphics,
SynPdf;
type
ICanvas =
interface
['
{F4E825EF-5ADF-42AB-B5E1-8CF82BA5DCDB}']
procedure TextOut( X: Integer; Y: Integer;
const Text:
string );
end;
TVclCanvas =
class( TInterfacedObject, ICanvas )
private
FCanvas: TCanvas;
public
constructor Create( ACanvas: TCanvas );
procedure TextOut( X: Integer; Y: Integer;
const Text:
string );
end;
TSynPdfCanvas =
class( TInterfacedObject, ICanvas )
private
FCanvas: TPdfCanvas;
public
constructor Create( ACanvas: TPdfCanvas );
procedure TextOut( X: Integer; Y: Integer;
const Text:
string );
override;
end;
implementation
{ TVclCanvas }
constructor TVclCanvas.Create( ACanvas: TCanvas );
begin
inherited Create;
FCanvas := ACanvas;
end;
procedure TVclCanvas.TextOut( X, Y: Integer;
const Text:
string );
begin
FCanvas.TextOut( X, Y, Text );
end;
{ TSynPdfCanvas }
constructor TSynPdfCanvas.Create( ACanvas: TPdfCanvas );
begin
inherited Create;
FCanvas := ACanvas;
end;
procedure TSynPdfCanvas.TextOut( X, Y: Integer;
const Text:
string );
begin
FCanvas.TextOut( X, Y, Text );
end;
end.