WXTOIMG IMAGE SLANTED CODE
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.
OTOH, wxBitmap is intended to be a wrapper of whatever is the native image format that is quickest/easiest to draw to a DC or to be the target of the drawing operations performed on a wxMemoryDC. It includes generic code for scaling, resizing, clipping, and other manipulations of the image data. It is all generic, platform independent and image file format independent code. More on the difference between wxImage and wxBitmap: wxImage is just a buffer of RGB bytes with an optional buffer for the alpha bytes. This bitmap can then be drawn in a device context, using wxDC::DrawBitmap. Instead, a platform-specific wxBitmap object must be created from it using the wxBitmap::wxBitmap(wxImage,int depth) constructor. Functions are available to set and get image bits, so it can be used for basic image manipulation.Ī wxImage cannot (currently) be drawn directly to a wxDC. An image can be loaded from a file in a variety of formats, and is extensible to new formats via image format handlers. This class encapsulates a platform-independent image.Īn image can be created from data, or using wxBitmap::ConvertToImage.