

(Don’t just take my word for it, go ahead and time it!) In total that makes 2 * 640 * 480 calls to ScanLine, each taking a short time (There are multiple function calls in the getter method.).Ĭall that code for several bitmaps and you will end up with a huge amount of time spent in the calls to ScanLine. Let’s assume a small VGA sized bitmap, so we get 480 lines with 640 pixels each. Then it enumerates through all the lines in the input bitmap and then all the pixels in that line, reads them does “something” with them and finally writes them to the corresponding pixel in the output bitmap. This code first checks that the input bitmap is using 24 bits per pixel, then sets the output bitmap to do the same.

PRgbTripleArray(_OutBmp.Scanline)^ := Pixel Pixel := PRgbTripleArray(_InBmp.Scanline)^ _OutBmp.SetSize(_InBmp.Width, _InBmp.Height) Procedure ConvertBmp(_InBmp, _OutBmp: TBitmap) TRgbTripleArray = packed array of TRgbTriple do not change the order of the fields, do not add any fields As you will find in the documentation and on the web the usual way to access the pixels of a Bitmap in Delphi is using the Scanline array property.
