This is indeed true. You can work this out by looking at the PixelFormat,
though if you cast the pointer when you get it it isn't an issue, e.g.
// case when it's 8 bit
uint8 *data = (uint8 *)bitmapData->Scan0;
// 16 bit
uint16 *data = (uint16 *)bitmapData->Scan0;
Then data++ iterates properly whatever you do. As another note,
BitmapData::Stride returns a number in bytes, not in pixels, so watch for
that.
Note: How you iterate though the bytes will be different for 8 bit versus
16 bit images.
"Steve McLellan" wrote:
Hi,
Look at LockBits - it allows you to get a BitmapData object which has a
property called Scan0, which refers to the address of the first pixel in
the section of the image you've specified. Then you can happily iterate
through the data.
HTH,
Steve
"Antonio Gómez" <An*********@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com... Hi,
I'm working with images in Visual C++ and I need a fast method to
access to individual pixels of an image. Actually I'm using the GetPixelAddress
method of the Image class, but it's too slow. Thanks for all.