A general approach for using wxBitmap with wxImage Topic is solved

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
bluesnowball18
Earned a small fee
Earned a small fee
Posts: 13
Joined: Thu Apr 22, 2021 9:23 am

A general approach for using wxBitmap with wxImage

Post by bluesnowball18 »

I would like to clarify one thing about the usage of wxImage.

The latest trunk documentation says that
By splitting the responsibilities between wxImage/wxBitmap like this then it's easier to use generic code shared by all platforms and image types for generic operations and platform specific code where performance or compatibility is needed.
Is this a good idea to store only wxImage and draw a bitmap every time the image is changed? Taking into consideration the high memory usage of wxImage, what are the drawbacks of using wxBitmap for both storing and editing pixel data and wxImage only for handling different file formats?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: A general approach for using wxBitmap with wxImage

Post by doublemax »

The internal byte structure of wxBitmap is platform dependent, so it's harder to edit.
Only wxBitmaps can be drawn onto a wxDC, so every wxImage needs to be converted before drawing.
Every conversion from wxImage and wxBitmap is slow, so if performance is an issue, these should be avoided.

What's best to use depends on your specific requirements.
Use the source, Luke!
Post Reply