本文介绍了如何复制CImage对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图复制 CImage ,以便我可以使用它的像素进行一些操作。我试过这里 source 是一个指向加载的CImage对象的指针。

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);

然而这似乎不起作用,我相信 source dest 都指向同一个内存。

However this doesn't seem to work and I believe source and dest are pointing to the same memory.

从以前的CImage?

How would I create a new copy totally detached from the previous CImage?

推荐答案

如果这是关于MFC / ATL CImage的问题,那么您可以创建新实例,并使用Create将其初始化为大小的原始CImage。然后使用BitBlt复制内容。

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.

这篇关于如何复制CImage对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 02:56