]>
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 | ||
14 | #include "wx/dfb/ifacehelpers.h" | |
15 | ||
16 | wxDFB_DECLARE_INTERFACE(IDirectFBSurface); | |
17 | ||
18 | //----------------------------------------------------------------------------- | |
19 | // wxMask | |
20 | //----------------------------------------------------------------------------- | |
21 | ||
22 | #warning "FIXME: move wxMask to common code" | |
23 | class WXDLLIMPEXP_CORE wxMask: public wxObject | |
24 | { | |
25 | public: | |
26 | wxMask(); | |
27 | wxMask(const wxBitmap& bitmap); | |
28 | wxMask(const wxBitmap& bitmap, const wxColour& colour); | |
29 | #if wxUSE_PALETTE | |
30 | wxMask(const wxBitmap& bitmap, int paletteIndex); | |
31 | #endif | |
32 | wxMask(const wxMask& mask); | |
33 | ~wxMask(); | |
34 | ||
35 | bool Create(const wxBitmap& bitmap); | |
36 | bool Create(const wxBitmap& bitmap, const wxColour& colour); | |
37 | #if wxUSE_PALETTE | |
38 | bool Create(const wxBitmap& bitmap, int paletteIndex); | |
39 | #endif | |
40 | ||
41 | // implementation | |
42 | const wxBitmap& GetBitmap() const; | |
43 | ||
44 | private: | |
45 | wxBitmap *m_bitmap; | |
46 | ||
47 | DECLARE_DYNAMIC_CLASS(wxMask) | |
48 | }; | |
49 | ||
50 | //----------------------------------------------------------------------------- | |
51 | // wxBitmap | |
52 | //----------------------------------------------------------------------------- | |
53 | ||
54 | class WXDLLIMPEXP_CORE wxBitmapHandler : public wxBitmapHandlerBase | |
55 | { | |
56 | public: | |
57 | wxBitmapHandler() : wxBitmapHandlerBase() {} | |
58 | private: | |
59 | DECLARE_DYNAMIC_CLASS(wxBitmapHandler) | |
60 | }; | |
61 | ||
62 | class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase | |
63 | { | |
64 | public: | |
65 | wxBitmap() {} | |
66 | wxBitmap(int width, int height, int depth = -1); | |
67 | wxBitmap(const char bits[], int width, int height, int depth = 1); | |
68 | wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | |
69 | wxBitmap(const char **bits) { CreateFromXpm(bits); } | |
70 | wxBitmap(char **bits) { CreateFromXpm((const char **)bits); } | |
71 | #if wxUSE_IMAGE | |
72 | wxBitmap(const wxImage& image, int depth = -1); | |
73 | #endif | |
74 | ||
75 | bool Ok() const; | |
76 | bool operator==(const wxBitmap& bmp) const; | |
77 | bool operator!=(const wxBitmap& bmp) const { return !(*this == bmp); } | |
78 | ||
79 | bool Create(int width, int height, int depth = -1); | |
80 | ||
81 | virtual int GetHeight() const; | |
82 | virtual int GetWidth() const; | |
83 | virtual int GetDepth() const; | |
84 | ||
85 | #if wxUSE_IMAGE | |
86 | virtual wxImage ConvertToImage() const; | |
87 | #endif | |
88 | ||
89 | virtual wxMask *GetMask() const; | |
90 | virtual void SetMask(wxMask *mask); | |
91 | ||
92 | virtual wxBitmap GetSubBitmap(const wxRect& rect) const; | |
93 | ||
94 | virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const; | |
95 | virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | |
96 | ||
97 | #if wxUSE_PALETTE | |
98 | virtual wxPalette *GetPalette() const; | |
99 | virtual void SetPalette(const wxPalette& palette); | |
100 | #endif | |
101 | ||
102 | // copies the contents and mask of the given (colour) icon to the bitmap | |
103 | virtual bool CopyFromIcon(const wxIcon& icon); | |
104 | ||
105 | static void InitStandardHandlers(); | |
106 | ||
107 | // implementation: | |
108 | virtual void SetHeight(int height); | |
109 | virtual void SetWidth(int width); | |
110 | virtual void SetDepth(int depth); | |
111 | ||
112 | // get underlying native representation: | |
113 | IDirectFBSurfacePtr GetDirectFBSurface() const; | |
114 | ||
115 | protected: | |
116 | bool CreateFromXpm(const char **bits); | |
117 | ||
118 | // ref counting code | |
119 | virtual wxObjectRefData *CreateRefData() const; | |
120 | virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; | |
121 | ||
122 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
123 | }; | |
124 | ||
125 | #endif // _WX_DFB_BITMAP_H_ |