1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBitmap class
4 // Author: Julian Smart, Robert Roebling
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #include "wx/object.h"
17 #include "wx/string.h"
18 #include "wx/palette.h"
19 #include "wx/gdiobj.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 class WXDLLIMPEXP_FWD_CORE wxMask
;
26 class WXDLLIMPEXP_FWD_CORE wxBitmap
;
27 class WXDLLIMPEXP_FWD_CORE wxImage
;
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 class WXDLLIMPEXP_CORE wxMask
: public wxObject
37 wxMask( const wxBitmap
& bitmap
, const wxColour
& colour
);
38 wxMask( const wxBitmap
& bitmap
, int paletteIndex
);
39 wxMask( const wxBitmap
& bitmap
);
42 bool Create( const wxBitmap
& bitmap
, const wxColour
& colour
);
43 bool Create( const wxBitmap
& bitmap
, int paletteIndex
);
44 bool Create( const wxBitmap
& bitmap
);
47 WXPixmap
GetBitmap() const { return m_bitmap
; }
48 void SetBitmap( WXPixmap bitmap
) { m_bitmap
= bitmap
; }
50 WXDisplay
*GetDisplay() const { return m_display
; }
51 void SetDisplay( WXDisplay
*display
) { m_display
= display
; }
58 DECLARE_DYNAMIC_CLASS(wxMask
)
61 //-----------------------------------------------------------------------------
63 //-----------------------------------------------------------------------------
65 class WXDLLIMPEXP_CORE wxBitmap
: public wxBitmapBase
69 wxBitmap( int width
, int height
, int depth
= -1 );
70 wxBitmap( const char bits
[], int width
, int height
, int depth
= 1 );
71 wxBitmap( const char* const* bits
);
76 *this = wxBitmap(const_cast<const char* const*>(data
));
79 wxBitmap( const wxString
&filename
, wxBitmapType type
= wxBITMAP_DEFAULT_TYPE
);
82 static void InitStandardHandlers();
84 bool Create(int width
, int height
, int depth
= -1);
85 bool Create(const void* data
, wxBitmapType type
,
86 int width
, int height
, int depth
= -1);
87 // create the wxBitmap using a _copy_ of the pixmap
88 bool Create(WXPixmap pixmap
);
90 int GetHeight() const;
95 wxBitmap( const wxImage
& image
, int depth
= -1 ) { (void)CreateFromImage(image
, depth
); }
96 wxImage
ConvertToImage() const;
97 bool CreateFromImage(const wxImage
& image
, int depth
= -1);
100 // copies the contents and mask of the given (colour) icon to the bitmap
101 virtual bool CopyFromIcon(const wxIcon
& icon
);
103 wxMask
*GetMask() const;
104 void SetMask( wxMask
*mask
);
106 wxBitmap
GetSubBitmap( const wxRect
& rect
) const;
108 bool SaveFile( const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= (wxPalette
*) NULL
) const;
109 bool LoadFile( const wxString
&name
, wxBitmapType type
= wxBITMAP_DEFAULT_TYPE
);
111 wxPalette
*GetPalette() const;
112 wxPalette
*GetColourMap() const
113 { return GetPalette(); };
114 virtual void SetPalette(const wxPalette
& palette
);
119 void SetHeight( int height
);
120 void SetWidth( int width
);
121 void SetDepth( int depth
);
122 void SetPixmap( WXPixmap pixmap
);
123 void SetBitmap( WXPixmap bitmap
);
125 WXPixmap
GetPixmap() const;
126 WXPixmap
GetBitmap() const;
128 WXPixmap
GetDrawable() const;
130 WXDisplay
*GetDisplay() const;
133 virtual wxGDIRefData
*CreateGDIRefData() const;
134 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
137 DECLARE_DYNAMIC_CLASS(wxBitmap
)
140 #endif // _WX_BITMAP_H_