]>
Commit | Line | Data |
---|---|---|
32b8ec41 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: bitmap.h | |
3 | // Author: Vaclav Slavik | |
4 | // RCS-ID: $Id$ | |
52750c2e | 5 | // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) |
65571936 | 6 | // Licence: wxWindows licence |
32b8ec41 VZ |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
32b8ec41 VZ |
9 | #ifndef __WX_BITMAP_H__ |
10 | #define __WX_BITMAP_H__ | |
11 | ||
32b8ec41 VZ |
12 | //----------------------------------------------------------------------------- |
13 | // classes | |
14 | //----------------------------------------------------------------------------- | |
15 | ||
32b8ec41 VZ |
16 | class WXDLLEXPORT wxDC; |
17 | class WXDLLEXPORT wxMemoryDC; | |
18 | ||
19 | class MGLDevCtx; | |
20 | struct bitmap_t; | |
21 | ||
32b8ec41 VZ |
22 | //----------------------------------------------------------------------------- |
23 | // wxBitmap | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | class WXDLLEXPORT wxBitmapHandler : public wxBitmapHandlerBase | |
27 | { | |
28 | public: | |
29 | wxBitmapHandler() : wxBitmapHandlerBase() {} | |
30 | private: | |
31 | DECLARE_DYNAMIC_CLASS(wxBitmapHandler) | |
32 | }; | |
33 | ||
34 | class WXDLLEXPORT wxBitmap: public wxBitmapBase | |
35 | { | |
36 | public: | |
3cdd0895 | 37 | wxBitmap() {} |
32b8ec41 VZ |
38 | wxBitmap(int width, int height, int depth = -1); |
39 | wxBitmap(const char bits[], int width, int height, int depth = 1); | |
40 | wxBitmap(const char **bits) { CreateFromXpm(bits); } | |
41 | wxBitmap(char **bits) { CreateFromXpm((const char **)bits); } | |
32b8ec41 VZ |
42 | wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); |
43 | wxBitmap(const wxImage& image, int depth = -1); | |
d3c7fc99 | 44 | virtual ~wxBitmap() {} |
32b8ec41 VZ |
45 | bool operator == (const wxBitmap& bmp) const; |
46 | bool operator != (const wxBitmap& bmp) const; | |
47 | bool Ok() const; | |
48 | ||
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 | virtual wxImage ConvertToImage() const; | |
56 | ||
57 | virtual wxMask *GetMask() const; | |
58 | virtual void SetMask(wxMask *mask); | |
59 | ||
60 | virtual wxBitmap GetSubBitmap(const wxRect& rect) const; | |
61 | ||
62 | virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const; | |
63 | virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | |
64 | ||
65 | virtual wxPalette *GetPalette() const; | |
66 | virtual void SetPalette(const wxPalette& palette); | |
67 | ||
68 | // copies the contents and mask of the given (colour) icon to the bitmap | |
69 | virtual bool CopyFromIcon(const wxIcon& icon); | |
70 | ||
71 | static void InitStandardHandlers(); | |
72 | ||
73 | // implementation: | |
74 | virtual void SetHeight(int height); | |
75 | virtual void SetWidth(int width); | |
76 | virtual void SetDepth(int depth); | |
77 | ||
87f83ac8 VZ |
78 | virtual wxColour QuantizeColour(const wxColour& colour) const; |
79 | ||
32b8ec41 VZ |
80 | // get underlying native representation: |
81 | bitmap_t *GetMGLbitmap_t() const; | |
82 | ||
83 | protected: | |
84 | bool CreateFromXpm(const char **bits); | |
85 | ||
86 | // creates temporary DC for access to bitmap's data: | |
87 | MGLDevCtx *CreateTmpDC() const; | |
88 | // sets fg & bg colours for 1bit bitmaps: | |
89 | void SetMonoPalette(const wxColour& fg, const wxColour& bg); | |
90 | ||
91 | private: | |
92 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
93 | ||
94 | friend class wxDC; | |
95 | friend class wxMemoryDC; | |
96 | }; | |
97 | ||
98 | #endif // __WX_BITMAP_H__ |