1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/bitmap.h
3 // Purpose: wxBitmap class
4 // Author: Julian Smart, Robert Roebling
7 // Copyright: (c) Julian Smart, Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/object.h"
16 #include "wx/string.h"
17 #include "wx/palette.h"
18 #include "wx/gdiobj.h"
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 class WXDLLIMPEXP_FWD_CORE wxMask
;
25 class WXDLLIMPEXP_FWD_CORE wxBitmap
;
26 class WXDLLIMPEXP_FWD_CORE wxImage
;
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 class WXDLLIMPEXP_CORE wxMask
: public wxObject
36 wxMask(const wxMask
& mask
);
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
; }
59 DECLARE_DYNAMIC_CLASS(wxMask
)
62 //-----------------------------------------------------------------------------
64 //-----------------------------------------------------------------------------
66 class WXDLLIMPEXP_CORE wxBitmap
: public wxBitmapBase
70 wxBitmap( int width
, int height
, int depth
= -1 ) { Create( width
, height
, depth
); }
71 wxBitmap( const wxSize
& sz
, int depth
= -1 ) { Create( sz
, depth
); }
73 wxBitmap( const char bits
[], int width
, int height
, int depth
= 1 );
74 wxBitmap( const char* const* bits
);
79 *this = wxBitmap(const_cast<const char* const*>(data
));
82 wxBitmap( const wxString
&filename
, wxBitmapType type
= wxBITMAP_DEFAULT_TYPE
);
85 static void InitStandardHandlers();
87 bool Create(int width
, int height
, int depth
= wxBITMAP_SCREEN_DEPTH
);
88 bool Create(const wxSize
& sz
, int depth
= wxBITMAP_SCREEN_DEPTH
)
89 { return Create(sz
.GetWidth(), sz
.GetHeight(), depth
); }
90 bool Create(int width
, int height
, const wxDC
& WXUNUSED(dc
))
91 { return Create(width
,height
); }
93 bool Create(const void* data
, wxBitmapType type
,
94 int width
, int height
, int depth
= -1);
95 // create the wxBitmap using a _copy_ of the pixmap
96 bool Create(WXPixmap pixmap
);
98 int GetHeight() const;
100 int GetDepth() const;
103 wxBitmap( const wxImage
& image
, int depth
= -1 ) { (void)CreateFromImage(image
, depth
); }
104 wxImage
ConvertToImage() const;
105 bool CreateFromImage(const wxImage
& image
, int depth
= -1);
106 #endif // wxUSE_IMAGE
108 // copies the contents and mask of the given (colour) icon to the bitmap
109 virtual bool CopyFromIcon(const wxIcon
& icon
);
111 wxMask
*GetMask() const;
112 void SetMask( wxMask
*mask
);
114 wxBitmap
GetSubBitmap( const wxRect
& rect
) const;
116 bool SaveFile( const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= NULL
) const;
117 bool LoadFile( const wxString
&name
, wxBitmapType type
= wxBITMAP_DEFAULT_TYPE
);
119 wxPalette
*GetPalette() const;
120 wxPalette
*GetColourMap() const
121 { return GetPalette(); }
122 virtual void SetPalette(const wxPalette
& palette
);
127 void SetHeight( int height
);
128 void SetWidth( int width
);
129 void SetDepth( int depth
);
130 void SetPixmap( WXPixmap pixmap
);
131 void SetBitmap( WXPixmap bitmap
);
133 WXPixmap
GetPixmap() const;
134 WXPixmap
GetBitmap() const;
136 WXPixmap
GetDrawable() const;
138 WXDisplay
*GetDisplay() const;
141 virtual wxGDIRefData
*CreateGDIRefData() const;
142 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
145 DECLARE_DYNAMIC_CLASS(wxBitmap
)
148 #endif // _WX_BITMAP_H_