Board index » delphi » accessing the scanline of a 24bit bitmap

accessing the scanline of a 24bit bitmap

is there a pointer array large enough to let me access all the colors in a
scanline.  the largest i've found is PWordArray, but it only is large enough
to let me see the red and green values.  any help on getting at the blue
value?
 

Re:accessing the scanline of a 24bit bitmap


Quote
Jeff Harmon <JeffHar...@trsdev.com> wrote in message

news:7ns9fa$cl312@forums.borland.com...

Quote
> is there a pointer array large enough to let me access all the colors in a
> scanline.  the largest i've found is PWordArray, but it only is large enough
> to let me see the red and green values.  any help on getting at the blue
> value?

The Scanlines for each of the PixelFormats are described in detail
in the Scanline Tech Note at

http://www.efg2.com/Lab/ImageProcessing/Scanline.htm

___
efg

Earl F. Glynn     E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

efg's Computer Lab:  http://www.efg2.com/Lab

Re:accessing the scanline of a 24bit bitmap


the pixels are stored at the location scanline[0].. as an array of bytes. to
access them, create a typed pointer:

type
  T3Bytes = record
    r,g,b: Byte;
  Line24Bit = array[Word]of T3Bytes;
  PLine24Bit = ^Line24Bit;

var
  Line: PLine24Bit;
begin
  Line:=Bitmap.Scanline[5];

then you access Line[x].r g b etc..  its considered dereferencing the
pointer when you access the subproperties of the type.

there is a faster way to loop through 32bit pixels.. you make a typed
pointer of 4bytes (r,g,b,a) and loop through Width*Height-1  using the inc
statement on your typed pointer variable.
-Gordy

Other Threads