steh wohl grad auf dem Schlauch.
Wunder mich schon ne Weile, überall steht Scanline ist schneller
Hier ist es doch auch so. Oder.
http://stackoverflow.com/questions/1...24-bit-bitmaps
Delphi-Quellcode:
type
PRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray =
array[0..4095]
of TRGBTriple;
procedure GrayscaleBitmap(ABitmap: TBitmap);
var
X: Integer;
Y: Integer;
Gray: Byte;
Pixels: PRGBTripleArray;
begin
// iterate bitmap from top to bottom to get access to each row's raw data
for Y := 0
to ABitmap.Height - 1
do
begin
// get pointer to the currently iterated row's raw data
Pixels := ABitmap.ScanLine[Y];
// iterate the row's pixels from left to right in the whole bitmap width
for X := 0
to ABitmap.Width - 1
do
begin
// calculate luminance for the current pixel by the mentioned formula
Gray := Round((0.299 * Pixels[X].rgbtRed) +
(0.587 * Pixels[X].rgbtGreen) + (0.114 * Pixels[X].rgbtBlue));
// and assign the luminance to each color component of the current pixel
Pixels[X].rgbtRed := Gray;
Pixels[X].rgbtGreen := Gray;
Pixels[X].rgbtBlue := Gray;
end;
end;
end;