TBitmap and Scanline simulation
Original Reporter info from Mantis:
-
Reporter name:
Original Reporter info from Mantis:
- Reporter name:
Description:
I have created many base image procesing functions using fast scanline method in Delphi. Now it is a problem to fast translate all the code to Lazarus, unless translation for TLazIntfImage doens't be finished. I also dobut of speed performance using TLazIntfImage.
It would be useful at least to allow simulation of scanline functionality in order to keep Delphi compatibility.
For example, a very fast 90 degree 32-bits rotation with Delphi code:
procedure SZRotateBmp90(Src, Dest: TBitmap);
var
x, y : integer;
dY : array of PDWORD; // Array for destination scanline
sH, dH: integer; // Height variables
P : PDWORD; // Source pointer
begin
if Src.PixelFormat<> pf32bit then
Src.PixelFormat := pf32bit;
if Dest.PixelFormat<> pf32bit then
Dest.PixelFormat := pf32bit;
try
Dest.Width := Src.Height;
Dest.Height := Src.Width;
sH:=Src.Height-1;
dH:=Dest.Height-1;
// Initialize dynamic array
SetLength(DY,dH+1);
// Save pointers to array for acceleration
for y := 0 to dH do
DY[y] := Dest.ScanLine[y];
// Copy Src horizontal lines to be Dest vertical by +90 degree
for y := 0 to sH do
begin
P:=Src.ScanLine[y];
for x := dH downto 0 do
begin
Dy[x]^:=P^;
inc(Dy[x]);
inc(P);
end;
end;
finally
SetLength(DY,0);
end;
end;
Mantis conversion info:
- Mantis ID: 1958
- Build: 9059
- Version: 0.9.15 (SVN)
- Monitored by: » crossbuilder (Burkhard Carstens), » @PascalDragon (Sven Barth)