BYTE* dst = (BYTE*) pBitmapData; //valid memory buffer
for (int jj = atlImage.GetHeight(); --jj >= 0; )
{
memcpy(dst, src, bytes);
src += pitch;
dst += pitch;
}
How do I get the byte * value form the png image loaded?
Thankx a ton in advance for reply
Regards,
Sandhya .
Re: how to convert png image into byte array in VC++??
if you want the pixel values so you can change the image.
Then make a memory bitmap (Dib section), paint/blit the image into that, then you can access the individual pixel values. Make sure you create the dib section with the desired memory layout.
The ATL lib is a wrapper on GDI+. GDI+ doesn't provide you with access to individual pixels directly, in fact, there isn't even a guarantee the bitmap is entirely loaded in memory at any point in time. (you will notice that when opening a bitmap from file that the file remains open and locked for this reason). This is why you need to paint it to an actual memory bitmap first. If you need to get it back into a CImage, there's functions to convert/load a dib-section into a CImage. The process of copying into the memory bitmap and back are "slow" though. If you want to achieve animation with this, this isn't going to work very well.
Re: how to convert png image into byte array in VC++??
if you want the pixel values so you can change the image.
Then make a memory bitmap (Dib section), paint/blit the image into that, then you can access the individual pixel values. Make sure you create the dib section with the desired memory layout.
The ATL lib is a wrapper on GDI+. GDI+ doesn't provide you with access to individual pixels directly, in fact, there isn't even a guarantee the bitmap is entirely loaded in memory at any point in time. (you will notice that when opening a bitmap from file that the file remains open and locked for this reason). This is why you need to paint it to an actual memory bitmap first. If you need to get it back into a CImage, there's functions to convert/load a dib-section into a CImage. The process of copying into the memory bitmap and back are "slow" though. If you want to achieve animation with this, this isn't going to work very well.
Bookmarks