procedure DrawOnWindow(canvas:Tcanvas; l,t,w,h:integer);
const
MaxPixelCountA = MaxInt div SizeOf(TRGBQuad);
type
PRGBAArray = ^TRGBAArray;
TRGBAArray = array[0..MaxPixelCountA-1] of TRGBQuad;
var x, y: Integer;
RowOut: PRGBAArray;
begin
for y:=0 to h-1 do begin
RowOut:= bmp.ScanLine[y+t];
for x:=0 to w-1 do begin
RowOut[x+l].rgbBlue:=byte(trunc(GetBValue(Canvas.Pixels[x,y])*RowOut[x+l].rgbReserved/255));
RowOut[x+l].rgbRed:=byte(trunc(GetrValue(Canvas.Pixels[x,y])*RowOut[x+l].rgbReserved/255));
RowOut[x+l].rgbGreen:=byte(trunc(GetgValue(Canvas.Pixels[x,y])*RowOut[x+l].rgbReserved/255));
end;
end;
end;