]>
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 | ||
452418c4 | 26 | class WXDLLIMPEXP_CORE wxBitmapHandler: public wxBitmapHandlerBase |
32b8ec41 | 27 | { |
452418c4 | 28 | DECLARE_ABSTRACT_CLASS(wxBitmapHandler) |
32b8ec41 VZ |
29 | }; |
30 | ||
31 | class WXDLLEXPORT wxBitmap: public wxBitmapBase | |
32 | { | |
33 | public: | |
3cdd0895 | 34 | wxBitmap() {} |
32b8ec41 VZ |
35 | wxBitmap(int width, int height, int depth = -1); |
36 | wxBitmap(const char bits[], int width, int height, int depth = 1); | |
452418c4 | 37 | wxBitmap(const char* const* bits); |
32b8ec41 VZ |
38 | wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); |
39 | wxBitmap(const wxImage& image, int depth = -1); | |
d3c7fc99 | 40 | virtual ~wxBitmap() {} |
b7cacb43 VZ |
41 | bool Ok() const { return IsOk(); } |
42 | bool IsOk() const; | |
32b8ec41 VZ |
43 | |
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 | virtual wxImage ConvertToImage() const; | |
51 | ||
52 | virtual wxMask *GetMask() const; | |
53 | virtual void SetMask(wxMask *mask); | |
54 | ||
55 | virtual wxBitmap GetSubBitmap(const wxRect& rect) const; | |
56 | ||
57 | virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const; | |
58 | virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE); | |
59 | ||
60 | virtual wxPalette *GetPalette() const; | |
61 | virtual void SetPalette(const wxPalette& palette); | |
62 | ||
63 | // copies the contents and mask of the given (colour) icon to the bitmap | |
64 | virtual bool CopyFromIcon(const wxIcon& icon); | |
65 | ||
66 | static void InitStandardHandlers(); | |
67 | ||
68 | // implementation: | |
69 | virtual void SetHeight(int height); | |
70 | virtual void SetWidth(int width); | |
71 | virtual void SetDepth(int depth); | |
72 | ||
87f83ac8 VZ |
73 | virtual wxColour QuantizeColour(const wxColour& colour) const; |
74 | ||
32b8ec41 VZ |
75 | // get underlying native representation: |
76 | bitmap_t *GetMGLbitmap_t() const; | |
77 | ||
78 | protected: | |
32b8ec41 VZ |
79 | // creates temporary DC for access to bitmap's data: |
80 | MGLDevCtx *CreateTmpDC() const; | |
81 | // sets fg & bg colours for 1bit bitmaps: | |
82 | void SetMonoPalette(const wxColour& fg, const wxColour& bg); | |
83 | ||
84 | private: | |
85 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
86 | ||
87 | friend class wxDC; | |
88 | friend class wxMemoryDC; | |
89 | }; | |
90 | ||
91 | #endif // __WX_BITMAP_H__ |