-
November 17th, 2008, 07:07 AM
#1
int** to CImage to png file
I have an array of RGB values that I use to draw an image on screen. I need to save that image to a png file.
I've looked at the usual candidates - libpng and the like, and they all seem to suffer from the usual Win32 multi-threaded non-threaded debug release problem. I'd really like to not have to bother with that problem.
So, I see that he CImage class can write png files. Ace. What I can't work out is how to load a CImage with RGB values from my ordinary array in order to write the output to a png file. Can anyone point me in the right direction?
-
November 17th, 2008, 09:24 AM
#2
Re: int** to CImage to png file
Have you looked at the GetBits() member function? That retrieves a pointer to the actual bitmap buffer.
-
November 17th, 2008, 09:24 AM
#3
Re: int** to CImage to png file
...or loop and call SetPixel or SetPixelRGB to assign each pixel.
Or, you can use CImage::BitBlt to copy all the image data from a device context. You may be able to use a CBitmap (+SetBitmapBits) selected into the device context you are copying the data from.
Nobody cares how it works as long as it works
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|