Is there a way to copy multiple regions from one dib to another? I've looked throughout the docs and couldn't find a function that allows me to lock a region of a dib, so that I may copy out the pixel data from that region. I thought FreeImage_Copy was the answer, but that does just one region.
Let's say I have this function...
Copy(const Rectangle& sourceRegion, FIBITMAP sourceDib, FIBITMAP destDib)
// Somehow lock the region in sourceDib by sourceRegion.
for (int y = 0; y < sourceRegion.Height; ++y)
for (int x = 0; x < sourceRegion.Width; ++x)
// Copy pixel data from sourceDib to destDib based on the locked region.
Then in a loop I'm calling Copy...
for (int x = 0; x < numRegions; ++x)
Rectangle sourceRegion = GetRegion(x);
Copy(sourceRegion, sourceDib, destDib);
In the end I would have all of the copied regions from the source DIB in the destination DIB. Has anyone done something like this before? Thanks!
I'm sorry but I don't understand your problem ...
Your pseudo-code looks OK so what do you want to do that cannot be solved by this code ?
What I need is a way to lock a region in a dib, so as I'm looping through the height and width, I'm only dealing with that region. I may have just figured this out as I'm typing this. If I use FreeImage_Copy to copy out the region I need from the source dib and store that in a temp dib, I could then copy over the pixel data from the temp dib to the destination dib and move to the next line to be ready for the next region. Think that would work? Thanks for responding. Sometimes you have to get something out and wait for someone to respond before the light bulb turns on ;).
Ok, so I was able to utilize FreeImage_Copy and FreeImage_Paste to extract out all of the regions that I need from a bitmap and merge them in with the destination bitmap. There was no need to copy the bitmap data pixel by pixel.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.