procedure TQRImage.Print(OfsX,OfsY : Integer);
var
Dest : TRect;
DC, SavedDC : THandle;
begin
Dest.Top := QRPrinter.YPos(OfsY + Size.Top);
Dest.Left := QRPrinter.XPos(OfsX + Size.Left);
Dest.Right := QRPrinter.XPos(OfsX + Size.Width + Size.Left);
Dest.Bottom := QRPrinter.YPos(OfsY + Size.Height + Size.Top);
if Stretch
then
begin
// remove all references to PrintBitmap, use stretchdraw only
QRPrinter.Canvas.StretchDraw(Dest, Picture.Graphic);
end else
begin
IntersectClipRect(QRPrinter.Canvas.Handle, Dest.Left, Dest.Top, Dest.Right, Dest.Bottom);
DC := GetDC(QRPrinter.Canvas.Handle);
SavedDC := SaveDC(
DC);
Dest.Right := Dest.Left +
round(Picture.Width / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.XFactor);
Dest.Bottom := Dest.Top +
round(Picture.Height / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.YFactor);
if Center
then OffsetRect(Dest,
(QRPrinter.XSize(Size.Width) -
round(Picture.Width / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.XFactor))
div 2,
(QRPrinter.YSize(Size.Height) -
round(Picture.Height / Screen.PixelsPerInch * 254 * ParentReport.QRPrinter.YFactor))
div 2);
//and again.
QRPrinter.Canvas.StretchDraw(Dest, Picture.Graphic);
RestoreDC(
DC, SavedDC);
SelectClipRgn(QRPrinter.Canvas.Handle, 0);
end;
inherited Print(OfsX,OfsY);
end;