]>
Commit | Line | Data |
---|---|---|
b3c86150 VS |
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 | ||
52c8d32a | 14 | #include "wx/dfb/dfbptr.h" |
b3c86150 VS |
15 | |
16 | wxDFB_DECLARE_INTERFACE(IDirectFBSurface); | |
17 | ||
b3c86150 VS |
18 | //----------------------------------------------------------------------------- |
19 | // wxBitmap | |
20 | //----------------------------------------------------------------------------- | |
21 | ||
22 | class WXDLLIMPEXP_CORE wxBitmapHandler : public wxBitmapHandlerBase | |
23 | { | |
24 | public: | |
25 | wxBitmapHandler() : wxBitmapHandlerBase() {} | |
26 | private: | |
27 | DECLARE_DYNAMIC_CLASS(wxBitmapHandler) | |
28 | }; | |
29 | ||
30 | class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase | |
31 | { | |
32 | public: | |
33 | wxBitmap() {} | |
4562386d | 34 | wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); } |
b3c86150 VS |
35 | wxBitmap(int width, int height, int depth = -1); |
36 | wxBitmap(const char bits[], int width, int height, int depth = 1); | |
37 | wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | |
38 | wxBitmap(const char **bits) { CreateFromXpm(bits); } | |
39 | wxBitmap(char **bits) { CreateFromXpm((const char **)bits); } | |
40 | #if wxUSE_IMAGE | |
41 | wxBitmap(const wxImage& image, int depth = -1); | |
42 | #endif | |
43 | ||
44 | bool Ok() const; | |
45 | bool operator==(const wxBitmap& bmp) const; | |
46 | bool operator!=(const wxBitmap& bmp) const { return !(*this == bmp); } | |
47 | ||
4562386d | 48 | bool Create(const wxIDirectFBSurfacePtr& surface); |
b3c86150 VS |
49 | bool Create(int width, int height, int depth = -1); |
50 | ||
51 | virtual int GetHeight() const; | |
52 | virtual int GetWidth() const; | |
53 | virtual int GetDepth() const; | |
54 | ||
55 | #if wxUSE_IMAGE | |
56 | virtual wxImage ConvertToImage() const; | |
57 | #endif | |
58 | ||
59 | virtual wxMask *GetMask() const; | |
60 | virtual void SetMask(wxMask *mask); | |
61 | ||
62 | virtual wxBitmap GetSubBitmap(const wxRect& rect) const; | |
63 | ||
64 | virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const; | |
65 | virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | |
66 | ||
67 | #if wxUSE_PALETTE | |
68 | virtual wxPalette *GetPalette() const; | |
69 | virtual void SetPalette(const wxPalette& palette); | |
70 | #endif | |
71 | ||
72 | // copies the contents and mask of the given (colour) icon to the bitmap | |
73 | virtual bool CopyFromIcon(const wxIcon& icon); | |
74 | ||
75 | static void InitStandardHandlers(); | |
76 | ||
77 | // implementation: | |
78 | virtual void SetHeight(int height); | |
79 | virtual void SetWidth(int width); | |
80 | virtual void SetDepth(int depth); | |
81 | ||
82 | // get underlying native representation: | |
52c8d32a | 83 | wxIDirectFBSurfacePtr GetDirectFBSurface() const; |
b3c86150 VS |
84 | |
85 | protected: | |
86 | bool CreateFromXpm(const char **bits); | |
87 | ||
88 | // ref counting code | |
89 | virtual wxObjectRefData *CreateRefData() const; | |
90 | virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; | |
91 | ||
92 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
93 | }; | |
94 | ||
95 | #endif // _WX_DFB_BITMAP_H_ |