]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mgl/bitmap.h
rename the ID parameter
[wxWidgets.git] / include / wx / mgl / bitmap.h
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 WXDLLEXPORT wxDC;
17 class WXDLLEXPORT wxMemoryDC;
18
19 class MGLDevCtx;
20 struct bitmap_t;
21
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:
37 wxBitmap() {}
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); }
42 wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
43 wxBitmap(const wxImage& image, int depth = -1);
44 virtual ~wxBitmap() {}
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
78 virtual wxColour QuantizeColour(const wxColour& colour) const;
79
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__