]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mgl/bitmap.h
include <string>
[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 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 wxBitmap: public wxBitmapBase
27 {
28 public:
29 wxBitmap() {}
30 wxBitmap(int width, int height, int depth = -1);
31 wxBitmap(const char bits[], int width, int height, int depth = 1);
32 wxBitmap(const char* const* bits);
33 wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
34 wxBitmap(const wxImage& image, int depth = -1);
35 virtual ~wxBitmap() {}
36
37 bool Create(int width, int height, int depth = -1);
38
39 virtual int GetHeight() const;
40 virtual int GetWidth() const;
41 virtual int GetDepth() const;
42
43 virtual wxImage ConvertToImage() const;
44
45 virtual wxMask *GetMask() const;
46 virtual void SetMask(wxMask *mask);
47
48 virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
49
50 virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const;
51 virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
52
53 virtual wxPalette *GetPalette() const;
54 virtual void SetPalette(const wxPalette& palette);
55
56 // copies the contents and mask of the given (colour) icon to the bitmap
57 virtual bool CopyFromIcon(const wxIcon& icon);
58
59 static void InitStandardHandlers();
60
61 // implementation:
62 virtual void SetHeight(int height);
63 virtual void SetWidth(int width);
64 virtual void SetDepth(int depth);
65
66 virtual wxColour QuantizeColour(const wxColour& colour) const;
67
68 // get underlying native representation:
69 bitmap_t *GetMGLbitmap_t() const;
70
71 protected:
72 virtual wxGDIRefData *CreateGDIRefData() const;
73 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
74
75 // creates temporary DC for access to bitmap's data:
76 MGLDevCtx *CreateTmpDC() const;
77 // sets fg & bg colours for 1bit bitmaps:
78 void SetMonoPalette(const wxColour& fg, const wxColour& bg);
79
80 private:
81 DECLARE_DYNAMIC_CLASS(wxBitmap)
82
83 friend class wxDC;
84 friend class wxMemoryDC;
85 };
86
87 #endif // __WX_BITMAP_H__