Is the Api Function "GetPixel" faster than Canvas.Pixels ?
It should be the same:
function TCanvas.GetPixel(X, Y: Integer): TColor;
begin
RequiredState([csHandleValid]);
GetPixel := Windows.GetPixel(FHandle, X, Y);
end;
If you are looking for something that performs better than GetPixel/Canvas.Pixel[] you should check out Bitmap.ScanLine. Only trouble is the data may be arranged in a number of ways, determined by Bitmap.PixelFormat
The GetPixel function is very slow! If you need high (or even acceptable) performance, you should use the ScanLine property. ScanLine[y] is a pointer to the yth line of pixels in the bitmap, encoded in the format specified by the PixelFormat property. For instance, for a 24-bit bitmap, the line has the format
B1 G1 R1 B2 G2 R2 ... Bn Gn Rn
if the width of the bitmap is n. Bi, Gi, and Ri are the blue, green, and red intensities of pixel i, respectively, as bytes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With