问题
I am trying to copy a CImage
so that I can do some manipulation with it's pixels. I've tried this where source
is a pointer to a loaded CImage object.
CImage* dest = new CImage(*source);
However this doesn't seem to work and I believe source
and dest
are pointing to the same memory.
How would I create a new copy totally detached from the previous CImage?
回答1:
If this is a question about MFC/ATL CImage then you can create new instance and use Create to initialize it to the size of the original CImage. Then use BitBlt to copy contents.
来源:https://stackoverflow.com/questions/9571304/how-to-copy-a-cimage-object