1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/bitmap.h
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 wxMask
& mask
);
38 wxMask( const wxBitmap
& bitmap
, const wxColour
& colour
);
39 wxMask( const wxBitmap
& bitmap
, int paletteIndex
);
40 wxMask( const wxBitmap
& bitmap
);
43 bool Create( const wxBitmap
& bitmap
, const wxColour
& colour
);
44 bool Create( const wxBitmap
& bitmap
, int paletteIndex
);
45 bool Create( const wxBitmap
& bitmap
);
48 WXPixmap
GetBitmap() const { return m_bitmap
; }
49 void SetBitmap( WXPixmap bitmap
) { m_bitmap
= bitmap
; }
51 WXDisplay
*GetDisplay() const { return m_display
; }
52 void SetDisplay( WXDisplay
*display
) { m_display
= display
; }
60 DECLARE_DYNAMIC_CLASS(wxMask
)
63 //-----------------------------------------------------------------------------
65 //-----------------------------------------------------------------------------
67 class WXDLLIMPEXP_CORE wxBitmap
: public wxBitmapBase
71 wxBitmap( int width
, int height
, int depth
= -1 ) { Create( width
, height
, depth
); }
72 wxBitmap( const wxSize
& sz
, int depth
= -1 ) { Create( sz
, depth
); }
74 wxBitmap( const char bits
[], int width
, int height
, int depth
= 1 );
75 wxBitmap( const char* const* bits
);
80 *this = wxBitmap(const_cast<const char* const*>(data
));
83 wxBitmap( const wxString
&filename
, wxBitmapType type
= wxBITMAP_DEFAULT_TYPE
);
86 static void InitStandardHandlers();
88 bool Create(int width
, int height
, int depth
= wxBITMAP_SCREEN_DEPTH
);
89 bool Create(const wxSize
& sz
, int depth
= wxBITMAP_SCREEN_DEPTH
)
90 { return Create(sz
.GetWidth(), sz
.GetHeight(), depth
); }
91 bool Create(int width
, int height
, const wxDC
& WXUNUSED(dc
))
92 { return Create(width
,height
); }
94 bool Create(const void* data
, wxBitmapType type
,
95 int width
, int height
, int depth
= -1);
96 // create the wxBitmap using a _copy_ of the pixmap
97 bool Create(WXPixmap pixmap
);
99 int GetHeight() const;
100 int GetWidth() const;
101 int GetDepth() const;
104 wxBitmap( const wxImage
& image
, int depth
= -1 ) { (void)CreateFromImage(image
, depth
); }
105 wxImage
ConvertToImage() const;
106 bool CreateFromImage(const wxImage
& image
, int depth
= -1);
107 #endif // wxUSE_IMAGE
109 // copies the contents and mask of the given (colour) icon to the bitmap
110 virtual bool CopyFromIcon(const wxIcon
& icon
);
112 wxMask
*GetMask() const;
113 void SetMask( wxMask
*mask
);
115 wxBitmap
GetSubBitmap( const wxRect
& rect
) const;
117 bool SaveFile( const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= NULL
) const;
118 bool LoadFile( const wxString
&name
, wxBitmapType type
= wxBITMAP_DEFAULT_TYPE
);
120 wxPalette
*GetPalette() const;
121 wxPalette
*GetColourMap() const
122 { return GetPalette(); }
123 virtual void SetPalette(const wxPalette
& palette
);
128 void SetHeight( int height
);
129 void SetWidth( int width
);
130 void SetDepth( int depth
);
131 void SetPixmap( WXPixmap pixmap
);
132 void SetBitmap( WXPixmap bitmap
);
134 WXPixmap
GetPixmap() const;
135 WXPixmap
GetBitmap() const;
137 WXPixmap
GetDrawable() const;
139 WXDisplay
*GetDisplay() const;
142 virtual wxGDIRefData
*CreateGDIRefData() const;
143 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
146 DECLARE_DYNAMIC_CLASS(wxBitmap
)
149 #endif // _WX_BITMAP_H_