unit PEngine1;
interface
uses
Classes, SysUtils, stdctrls, comctrls,GR32_Image, ExtCtrls,
Messages, Variants, Graphics, Forms, Dialogs, Printers,
GR32, JPEG,WinSpool;
type
Engine1 =
class(TThread)
public
constructor Create(PRN : Integer; Viewer : TImage32);
private
{ Private-Deklarationen }
PIndex : Integer;
IViewer : TImage32;
Drucker : TPrinter;
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 Engine1.Create(PRN : Integer; Viewer : TImage32);
begin
PIndex := PRN;
IViewer := Viewer;
FreeOnTerminate := True;
inherited Create(True);
end;
procedure Engine1.Preprint(PCanvas: TCanvas; px1: Integer; py1: Integer;
px2: Integer; py2: Integer; Datei:
string);
var
gra : Tbitmap32;
begin
IViewer.Visible:= false;
IViewer.Bitmap.LoadFromFile(Datei);
IViewer.Visible:= true;
gra := Tbitmap32.Create;
gra.LoadFromFile(Datei);
//gra.ResamplerClassName := 'TLinearResampler';
gra.ResamplerClassName := '
TKernelResampler';
gra.DrawTo(pcanvas.Handle, Rect(px1,py1,px2,py2), gra.BoundsRect);
gra.Free;
end;
procedure Engine1.PrintImage(Datei:
string; O,L,H,B: Integer);
begin
Drucker:= TPrinter.Create;
Drucker.PrinterIndex:=PIndex;
with Drucker
do
begin
BeginDoc;
PrePrint(Canvas,O,L,H,B,Datei);
EndDoc;
end;
end;
procedure Engine1.Execute;
begin
Synchronize(Update);
end;
procedure Engine1.Update;
begin
PrintImage('
I:\Test\Image1p.jpg', 0,0,16064,9686);
end;
end.