]>
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 | ||
b5dbe15d VS |
16 | class WXDLLIMPEXP_FWD_CORE wxDC; |
17 | class WXDLLIMPEXP_FWD_CORE wxMemoryDC; | |
32b8ec41 VZ |
18 | |
19 | class MGLDevCtx; | |
20 | struct bitmap_t; | |
21 | ||
32b8ec41 VZ |
22 | //----------------------------------------------------------------------------- |
23 | // wxBitmap | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
53a2db12 | 26 | class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase |
32b8ec41 VZ |
27 | { |
28 | public: | |
3cdd0895 | 29 | wxBitmap() {} |
732d8c74 FM |
30 | wxBitmap(int width, int height, int depth = -1) |
31 | { Create(width, height, depth); } | |
32 | wxBitmap(const wxSize& sz, int depth = -1) | |
33 | { Create(sz, depth); } | |
32b8ec41 | 34 | wxBitmap(const char bits[], int width, int height, int depth = 1); |
452418c4 | 35 | wxBitmap(const char* const* bits); |
cbea3ec6 | 36 | wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); |
32b8ec41 | 37 | wxBitmap(const wxImage& image, int depth = -1); |
d3c7fc99 | 38 | virtual ~wxBitmap() {} |
32b8ec41 | 39 | |
732d8c74 FM |
40 | bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); |
41 | bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) | |
42 | { return Create(sz.GetWidth(), sz.GetHeight(), depth); } | |
32b8ec41 VZ |
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 | ||
d3b9f782 | 55 | virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = NULL) const; |
cbea3ec6 | 56 | virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); |
32b8ec41 VZ |
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 | ||
87f83ac8 VZ |
71 | virtual wxColour QuantizeColour(const wxColour& colour) const; |
72 | ||
32b8ec41 VZ |
73 | // get underlying native representation: |
74 | bitmap_t *GetMGLbitmap_t() const; | |
75 | ||
76 | protected: | |
ee437b7e VZ |
77 | virtual wxGDIRefData *CreateGDIRefData() const; |
78 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
79 | ||
32b8ec41 VZ |
80 | // creates temporary DC for access to bitmap's data: |
81 | MGLDevCtx *CreateTmpDC() const; | |
82 | // sets fg & bg colours for 1bit bitmaps: | |
83 | void SetMonoPalette(const wxColour& fg, const wxColour& bg); | |
84 | ||
85 | private: | |
86 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
87 | ||
88 | friend class wxDC; | |
89 | friend class wxMemoryDC; | |
90 | }; | |
91 | ||
92 | #endif // __WX_BITMAP_H__ |