Destroying wxBitmaps

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Miles Lombardi
Experienced Solver
Experienced Solver
Posts: 66
Joined: Sun Feb 26, 2006 7:49 pm

Destroying wxBitmaps

Post by Miles Lombardi » Tue Apr 04, 2006 7:13 pm

I want to set a bitmap to another bitmap.
Is there a way to destroy the first one and then set it to something else? Or should I just use a pointer?

Ksmith22
I live to help wx-kind
I live to help wx-kind
Posts: 199
Joined: Mon Nov 21, 2005 4:34 pm

Post by Ksmith22 » Tue Apr 04, 2006 7:24 pm

Doesn't something like this work?

Code: Select all

wxBitmap bmp1("somebitmap.bmp",wxBITMAP_TYPE_BMP);
wxBitmap bmp2("someotherbitmap.bmp",wxBITMAP_TYPE_BMP);

bmp1 = bmp2;

// or

wxBitmap bmp3(bmp1);
The docs say those all use pointers though, and suggest this if you want a real copy:

Code: Select all

   wxBitmap newBitmap = oldBitmap.GetSubBitmap(wxRect(0, 0, oldBitmap.GetWidth(), oldBitmap.GetHeight()));

Post Reply