]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/bitmap.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBitmap class
4 // Author: Julian Smart, Robert Roebling
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "bitmap.h"
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/palette.h"
23 #include "wx/gdiobj.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 //-----------------------------------------------------------------------------
37 class wxMask
: public wxObject
41 wxMask( const wxBitmap
& bitmap
, const wxColour
& colour
);
42 wxMask( const wxBitmap
& bitmap
, int paletteIndex
);
43 wxMask( const wxBitmap
& bitmap
);
46 bool Create( const wxBitmap
& bitmap
, const wxColour
& colour
);
47 bool Create( const wxBitmap
& bitmap
, int paletteIndex
);
48 bool Create( const wxBitmap
& bitmap
);
51 WXPixmap
GetBitmap() const { return m_bitmap
; }
52 void SetBitmap( WXPixmap bitmap
) { m_bitmap
= bitmap
; }
54 WXDisplay
*GetDisplay() const { return m_display
; }
55 void SetDisplay( WXDisplay
*display
) { m_display
= display
; }
62 DECLARE_DYNAMIC_CLASS(wxMask
)
65 //-----------------------------------------------------------------------------
67 //-----------------------------------------------------------------------------
69 class wxBitmap
: public wxGDIObject
73 wxBitmap( int width
, int height
, int depth
= -1 );
74 wxBitmap( const char bits
[], int width
, int height
, int depth
= 1 );
75 wxBitmap( const char **bits
) { (void)CreateFromXpm(bits
); }
76 wxBitmap( char **bits
) { (void)CreateFromXpm((const char **)bits
); }
77 wxBitmap( const wxBitmap
& bmp
);
78 wxBitmap( const wxString
&filename
, int type
= wxBITMAP_TYPE_XPM
);
79 wxBitmap( const wxImage
& image
, int depth
= -1 ) { (void)CreateFromImage(image
, depth
); }
81 wxBitmap
& operator = ( const wxBitmap
& bmp
);
82 bool operator == ( const wxBitmap
& bmp
) const;
83 bool operator != ( const wxBitmap
& bmp
) const;
86 bool Create(int width
, int height
, int depth
= -1);
88 int GetHeight() const;
92 wxImage
ConvertToImage() const;
94 // copies the contents and mask of the given (colour) icon to the bitmap
95 virtual bool CopyFromIcon(const wxIcon
& icon
);
97 wxMask
*GetMask() const;
98 void SetMask( wxMask
*mask
);
100 wxBitmap
GetSubBitmap( const wxRect
& rect
) const;
102 bool SaveFile( const wxString
&name
, int type
, wxPalette
*palette
= (wxPalette
*) NULL
);
103 bool LoadFile( const wxString
&name
, int type
= wxBITMAP_TYPE_XPM
);
105 wxPalette
*GetPalette() const;
106 wxPalette
*GetColourMap() const
107 { return GetPalette(); };
112 void SetHeight( int height
);
113 void SetWidth( int width
);
114 void SetDepth( int depth
);
115 void SetPixmap( WXPixmap pixmap
);
116 void SetBitmap( WXPixmap bitmap
);
118 WXPixmap
GetPixmap() const;
119 WXPixmap
GetBitmap() const;
121 WXDisplay
*GetDisplay() const;
124 bool CreateFromXpm(const char **bits
);
125 bool CreateFromImage(const wxImage
& image
, int depth
= -1);
128 DECLARE_DYNAMIC_CLASS(wxBitmap
)