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 WXDLLIMPEXP_FWD_CORE wxDC
;
17 class WXDLLIMPEXP_FWD_CORE wxMemoryDC
;
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 class WXDLLIMPEXP_CORE wxBitmap
: public wxBitmapBase
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_DEFAULT_TYPE
);
34 wxBitmap(const wxImage
& image
, int depth
= -1);
35 virtual ~wxBitmap() {}
37 bool Create(int width
, int height
, int depth
= -1);
39 virtual int GetHeight() const;
40 virtual int GetWidth() const;
41 virtual int GetDepth() const;
43 virtual wxImage
ConvertToImage() const;
45 virtual wxMask
*GetMask() const;
46 virtual void SetMask(wxMask
*mask
);
48 virtual wxBitmap
GetSubBitmap(const wxRect
& rect
) const;
50 virtual bool SaveFile(const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= NULL
) const;
51 virtual bool LoadFile(const wxString
&name
, wxBitmapType type
= wxBITMAP_DEFAULT_TYPE
);
53 virtual wxPalette
*GetPalette() const;
54 virtual void SetPalette(const wxPalette
& palette
);
56 // copies the contents and mask of the given (colour) icon to the bitmap
57 virtual bool CopyFromIcon(const wxIcon
& icon
);
59 static void InitStandardHandlers();
62 virtual void SetHeight(int height
);
63 virtual void SetWidth(int width
);
64 virtual void SetDepth(int depth
);
66 virtual wxColour
QuantizeColour(const wxColour
& colour
) const;
68 // get underlying native representation:
69 bitmap_t
*GetMGLbitmap_t() const;
72 virtual wxGDIRefData
*CreateGDIRefData() const;
73 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
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
);
81 DECLARE_DYNAMIC_CLASS(wxBitmap
)
84 friend class wxMemoryDC
;
87 #endif // __WX_BITMAP_H__