Use Bitmap.Scanline instead of Bitmap.Canvas.Pixels[ x,y ] and you'll jump alot in speed;
The following code is to convert a Phoenix texture to a windows Bitmap showing the use of scanline:
Code:
Type TRGBQuadArray = Array[WORD] of TRGBQuad;
Type PRGBQuadArray = ^TRGBQuadArray;
Type TRGBTripleArray = Array[WORD] of TRGBTriple;
Type PRGBTripleArray = ^TRGBTripleArray;
var Line : PRGBTripleArray;
var X,Y : Integer;
var Color : TColor4b;
begin
Dest.Width := Source.Width;
Dest.Height := Source.Height;
Dest.PixelFormat:= Graphics.pf24Bit;
For Y:=0 to Source.Height-1 do begin
Line:=Dest.ScanLine[Y];
For X:=0 to Source.Width-1 do begin
Color:= Source.Pixels[X,Y];
Line[X].rgbtRed := Color.Red ;
Line[X].rgbtGreen := Color.Green;
Line[X].rgbtBlue := Color.Blue ;
end;
end;
Bookmarks