unit PEngine2;
interface
uses
Classes, SysUtils, stdctrls, comctrls,GR32_Image, ExtCtrls,
Messages, Variants, Graphics, Forms, Dialogs, Printers,
GR32, JPEG;
type
Engine2 =
class(TThread)
public
constructor Create(PRN : Integer; Viewer : TImage32);
private
{ Private-Deklarationen }
Drucker : Integer;
IViewer : TImage32;
protected
procedure Execute;
override;
procedure PrintImage(Datei:
string; O,L,H,B: Integer);
procedure Preprint(PCanvas: TCanvas; px1: Integer; py1: Integer;
px2: Integer; py2: Integer; Datei:
string);
procedure Update;
end;
implementation
uses Main, Controls;
{ Engine1 }
constructor Engine2.Create(PRN : Integer; Viewer : TImage32);
begin
Drucker := PRN;
IViewer := Viewer;
FreeOnTerminate := True;
inherited Create(True);
end;
procedure Engine2.Preprint(PCanvas: TCanvas; px1: Integer; py1: Integer;
px2: Integer; py2: Integer; Datei:
string);
var
gra : Tbitmap32;
begin
IViewer.Visible:= false;
IViewer.Bitmap.LoadFromFile(Datei);
// Ist ein Timgage32 auf der MainForm
IViewer.Visible:= true;
gra := Tbitmap32.Create;
gra.LoadFromFile(Datei);
gra.ResamplerClassName := '
TKernelResampler';
gra.DrawTo(pcanvas.Handle, Rect(px1,py1,px2,py2), gra.BoundsRect);
gra.Free;
end;
procedure Engine2.PrintImage(Datei:
string; O,L,H,B: Integer);
var Tstamp :
string;
begin
Printer.PrinterIndex:= Drucker;
with Printer
do
begin
BeginDoc;
PrePrint(Canvas,O,L,H,B,Datei);
EndDoc;
end;
end;
procedure Engine2.Execute;
begin
Synchronize(Update);
// wegen dem Image was auf der MainForm geladen wird
end;
procedure Engine2.Update;
begin
PrintImage('
I:\Test.jpg', 0,0,16064,9686);
end;
end.