w and h is the height and width of the bitmap.

 type PRGBarray = ^TRGBarray; TRGBarray = array[0..30000] of TRGBQuad; var colorLine1 : pRGBarray; for x:=1 to w-1 do begin colorline1:=bmpin1.ScanLine[x]; for y := 1 to h-1 do begin colorline1[y].rgbBlue:=0; colorline1[y].rgbGreen:=0; colorline1[y].rgbRed:=0; end; end; 

As a result, white bitmap is covered with alternating vertical stripes: black, red, blue, green. How to deal with it? What am I doing wrong?

    1 answer 1

    It should be understood that ScanLine simply returns a string in bytes. And pixels can be encoded in a different way. For example, 4 bytes per pixel or 2 bits per pixel. This is determined by the PixelFormat property (possible values ​​are TPixelFormat = (pfDevice, pflbit, pf4bit, pf8bit, pf15bit, pf16bit, pf24bit, pf32bit, pfCustom);). But there is one more error in the code - ScanLine returns a pointer to the buffer, and your code has rgbBlue and similar fields ... Read here .

    • Thanks, problem solved: bmpin1.PixelFormat: = pf32bit; - ololo