1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/bitmap.h
3 // Purpose: wxBitmap class
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DFB_BITMAP_H_
12 #define _WX_DFB_BITMAP_H_
14 #include "wx/dfb/dfbptr.h"
16 wxDFB_DECLARE_INTERFACE(IDirectFBSurface
);
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 #warning "FIXME: move wxMask to common code"
23 class WXDLLIMPEXP_CORE wxMask
: public wxObject
27 wxMask(const wxBitmap
& bitmap
);
28 wxMask(const wxBitmap
& bitmap
, const wxColour
& colour
);
30 wxMask(const wxBitmap
& bitmap
, int paletteIndex
);
32 wxMask(const wxMask
& mask
);
35 bool Create(const wxBitmap
& bitmap
);
36 bool Create(const wxBitmap
& bitmap
, const wxColour
& colour
);
38 bool Create(const wxBitmap
& bitmap
, int paletteIndex
);
42 const wxBitmap
& GetBitmap() const;
47 DECLARE_DYNAMIC_CLASS(wxMask
)
50 //-----------------------------------------------------------------------------
52 //-----------------------------------------------------------------------------
54 class WXDLLIMPEXP_CORE wxBitmapHandler
: public wxBitmapHandlerBase
57 wxBitmapHandler() : wxBitmapHandlerBase() {}
59 DECLARE_DYNAMIC_CLASS(wxBitmapHandler
)
62 class WXDLLIMPEXP_CORE wxBitmap
: public wxBitmapBase
66 wxBitmap(int width
, int height
, int depth
= -1);
67 wxBitmap(const char bits
[], int width
, int height
, int depth
= 1);
68 wxBitmap(const wxString
&filename
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
69 wxBitmap(const char **bits
) { CreateFromXpm(bits
); }
70 wxBitmap(char **bits
) { CreateFromXpm((const char **)bits
); }
72 wxBitmap(const wxImage
& image
, int depth
= -1);
76 bool operator==(const wxBitmap
& bmp
) const;
77 bool operator!=(const wxBitmap
& bmp
) const { return !(*this == bmp
); }
79 bool Create(int width
, int height
, int depth
= -1);
81 virtual int GetHeight() const;
82 virtual int GetWidth() const;
83 virtual int GetDepth() const;
86 virtual wxImage
ConvertToImage() const;
89 virtual wxMask
*GetMask() const;
90 virtual void SetMask(wxMask
*mask
);
92 virtual wxBitmap
GetSubBitmap(const wxRect
& rect
) const;
94 virtual bool SaveFile(const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= (wxPalette
*) NULL
) const;
95 virtual bool LoadFile(const wxString
&name
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
98 virtual wxPalette
*GetPalette() const;
99 virtual void SetPalette(const wxPalette
& palette
);
102 // copies the contents and mask of the given (colour) icon to the bitmap
103 virtual bool CopyFromIcon(const wxIcon
& icon
);
105 static void InitStandardHandlers();
108 virtual void SetHeight(int height
);
109 virtual void SetWidth(int width
);
110 virtual void SetDepth(int depth
);
112 // get underlying native representation:
113 wxIDirectFBSurfacePtr
GetDirectFBSurface() const;
116 bool CreateFromXpm(const char **bits
);
119 virtual wxObjectRefData
*CreateRefData() const;
120 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
122 DECLARE_DYNAMIC_CLASS(wxBitmap
)
125 #endif // _WX_DFB_BITMAP_H_