1

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?

marcinj
  • 48,511
  • 9
  • 79
  • 100
Ash Burlaczenko
  • 24,778
  • 15
  • 68
  • 99

1 Answers1

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.

marcinj
  • 48,511
  • 9
  • 79
  • 100