How to copy a CImage object?

元气小坏坏 提交于 2019-12-11 07:57:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!