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 WXDLLIMPEXP_CORE wxBitmapHandler
: public wxBitmapHandlerBase
28 DECLARE_ABSTRACT_CLASS(wxBitmapHandler
)
31 class WXDLLEXPORT wxBitmap
: public wxBitmapBase
35 wxBitmap(int width
, int height
, int depth
= -1);
36 wxBitmap(const char bits
[], int width
, int height
, int depth
= 1);
37 wxBitmap(const char* const* bits
);
38 wxBitmap(const wxString
&filename
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
39 wxBitmap(const wxImage
& image
, int depth
= -1);
40 virtual ~wxBitmap() {}
41 bool operator == (const wxBitmap
& bmp
) const;
42 bool operator != (const wxBitmap
& bmp
) const;
45 bool Create(int width
, int height
, int depth
= -1);
47 virtual int GetHeight() const;
48 virtual int GetWidth() const;
49 virtual int GetDepth() const;
51 virtual wxImage
ConvertToImage() const;
53 virtual wxMask
*GetMask() const;
54 virtual void SetMask(wxMask
*mask
);
56 virtual wxBitmap
GetSubBitmap(const wxRect
& rect
) const;
58 virtual bool SaveFile(const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= (wxPalette
*) NULL
) const;
59 virtual bool LoadFile(const wxString
&name
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
61 virtual wxPalette
*GetPalette() const;
62 virtual void SetPalette(const wxPalette
& palette
);
64 // copies the contents and mask of the given (colour) icon to the bitmap
65 virtual bool CopyFromIcon(const wxIcon
& icon
);
67 static void InitStandardHandlers();
70 virtual void SetHeight(int height
);
71 virtual void SetWidth(int width
);
72 virtual void SetDepth(int depth
);
74 virtual wxColour
QuantizeColour(const wxColour
& colour
) const;
76 // get underlying native representation:
77 bitmap_t
*GetMGLbitmap_t() const;
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
);
86 DECLARE_DYNAMIC_CLASS(wxBitmap
)
89 friend class wxMemoryDC
;
92 #endif // __WX_BITMAP_H__