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