1 /////////////////////////////////////////////////////////////////////////////
3 // Author: Vaclav Slavik
5 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef __WX_BITMAP_H__
10 #define __WX_BITMAP_H__
12 //-----------------------------------------------------------------------------
14 //-----------------------------------------------------------------------------
16 class WXDLLEXPORT wxDC
;
17 class WXDLLEXPORT wxMemoryDC
;
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 class WXDLLEXPORT wxBitmapHandler
: public wxBitmapHandlerBase
29 wxBitmapHandler() : wxBitmapHandlerBase() {}
31 DECLARE_DYNAMIC_CLASS(wxBitmapHandler
)
34 class WXDLLEXPORT wxBitmap
: public wxBitmapBase
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;
49 bool Create(int width
, int height
, int depth
= -1);
51 virtual int GetHeight() const;
52 virtual int GetWidth() const;
53 virtual int GetDepth() const;
55 virtual wxImage
ConvertToImage() const;
57 virtual wxMask
*GetMask() const;
58 virtual void SetMask(wxMask
*mask
);
60 virtual wxBitmap
GetSubBitmap(const wxRect
& rect
) const;
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
);
65 virtual wxPalette
*GetPalette() const;
66 virtual void SetPalette(const wxPalette
& palette
);
68 // copies the contents and mask of the given (colour) icon to the bitmap
69 virtual bool CopyFromIcon(const wxIcon
& icon
);
71 static void InitStandardHandlers();
74 virtual void SetHeight(int height
);
75 virtual void SetWidth(int width
);
76 virtual void SetDepth(int depth
);
78 virtual wxColour
QuantizeColour(const wxColour
& colour
) const;
80 // get underlying native representation:
81 bitmap_t
*GetMGLbitmap_t() const;
84 bool CreateFromXpm(const char **bits
);
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
);
92 DECLARE_DYNAMIC_CLASS(wxBitmap
)
95 friend class wxMemoryDC
;
98 #endif // __WX_BITMAP_H__