| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/dfb/bitmap.h |
| 3 | // Purpose: wxBitmap class |
| 4 | // Author: Vaclav Slavik |
| 5 | // Created: 2006-08-04 |
| 6 | // RCS-ID: $Id$ |
| 7 | // Copyright: (c) 2006 REA Elektronik GmbH |
| 8 | // Licence: wxWindows licence |
| 9 | ///////////////////////////////////////////////////////////////////////////// |
| 10 | |
| 11 | #ifndef _WX_DFB_BITMAP_H_ |
| 12 | #define _WX_DFB_BITMAP_H_ |
| 13 | |
| 14 | #include "wx/dfb/dfbptr.h" |
| 15 | |
| 16 | wxDFB_DECLARE_INTERFACE(IDirectFBSurface); |
| 17 | |
| 18 | //----------------------------------------------------------------------------- |
| 19 | // wxBitmap |
| 20 | //----------------------------------------------------------------------------- |
| 21 | |
| 22 | class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase |
| 23 | { |
| 24 | DECLARE_ABSTRACT_CLASS(wxBitmapHandler) |
| 25 | }; |
| 26 | |
| 27 | class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase |
| 28 | { |
| 29 | public: |
| 30 | wxBitmap() {} |
| 31 | wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); } |
| 32 | wxBitmap(int width, int height, int depth = -1); |
| 33 | wxBitmap(const char bits[], int width, int height, int depth = 1); |
| 34 | wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); |
| 35 | wxBitmap(const char* const* bits); |
| 36 | #if wxUSE_IMAGE |
| 37 | wxBitmap(const wxImage& image, int depth = -1); |
| 38 | #endif |
| 39 | |
| 40 | bool Ok() const { return IsOk(); } |
| 41 | bool IsOk() const; |
| 42 | |
| 43 | bool Create(const wxIDirectFBSurfacePtr& surface); |
| 44 | bool Create(int width, int height, int depth = -1); |
| 45 | |
| 46 | virtual int GetHeight() const; |
| 47 | virtual int GetWidth() const; |
| 48 | virtual int GetDepth() const; |
| 49 | |
| 50 | #if wxUSE_IMAGE |
| 51 | virtual wxImage ConvertToImage() const; |
| 52 | #endif |
| 53 | |
| 54 | virtual wxMask *GetMask() const; |
| 55 | virtual void SetMask(wxMask *mask); |
| 56 | |
| 57 | virtual wxBitmap GetSubBitmap(const wxRect& rect) const; |
| 58 | |
| 59 | virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const; |
| 60 | virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); |
| 61 | |
| 62 | #if wxUSE_PALETTE |
| 63 | virtual wxPalette *GetPalette() const; |
| 64 | virtual void SetPalette(const wxPalette& palette); |
| 65 | #endif |
| 66 | |
| 67 | // copies the contents and mask of the given (colour) icon to the bitmap |
| 68 | virtual bool CopyFromIcon(const wxIcon& icon); |
| 69 | |
| 70 | static void InitStandardHandlers(); |
| 71 | |
| 72 | // implementation: |
| 73 | virtual void SetHeight(int height); |
| 74 | virtual void SetWidth(int width); |
| 75 | virtual void SetDepth(int depth); |
| 76 | |
| 77 | // get underlying native representation: |
| 78 | wxIDirectFBSurfacePtr GetDirectFBSurface() const; |
| 79 | |
| 80 | protected: |
| 81 | // ref counting code |
| 82 | virtual wxObjectRefData *CreateRefData() const; |
| 83 | virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; |
| 84 | |
| 85 | DECLARE_DYNAMIC_CLASS(wxBitmap) |
| 86 | }; |
| 87 | |
| 88 | #endif // _WX_DFB_BITMAP_H_ |