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 class WXDLLIMPEXP_CORE wxBitmapHandler
: public wxBitmapHandlerBase
25 wxBitmapHandler() : wxBitmapHandlerBase() {}
27 DECLARE_DYNAMIC_CLASS(wxBitmapHandler
)
30 class WXDLLIMPEXP_CORE wxBitmap
: public wxBitmapBase
34 wxBitmap(const wxIDirectFBSurfacePtr
& surface
) { Create(surface
); }
35 wxBitmap(int width
, int height
, int depth
= -1);
36 wxBitmap(const char bits
[], int width
, int height
, int depth
= 1);
37 wxBitmap(const wxString
&filename
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
38 wxBitmap(const char **bits
) { CreateFromXpm(bits
); }
39 wxBitmap(char **bits
) { CreateFromXpm((const char **)bits
); }
41 wxBitmap(const wxImage
& image
, int depth
= -1);
45 bool operator==(const wxBitmap
& bmp
) const;
46 bool operator!=(const wxBitmap
& bmp
) const { return !(*this == bmp
); }
48 bool Create(const wxIDirectFBSurfacePtr
& surface
);
49 bool Create(int width
, int height
, int depth
= -1);
51 virtual int GetHeight() const;
52 virtual int GetWidth() const;
53 virtual int GetDepth() const;
56 virtual wxImage
ConvertToImage() const;
59 virtual wxMask
*GetMask() const;
60 virtual void SetMask(wxMask
*mask
);
62 virtual wxBitmap
GetSubBitmap(const wxRect
& rect
) const;
64 virtual bool SaveFile(const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= (wxPalette
*) NULL
) const;
65 virtual bool LoadFile(const wxString
&name
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
68 virtual wxPalette
*GetPalette() const;
69 virtual void SetPalette(const wxPalette
& palette
);
72 // copies the contents and mask of the given (colour) icon to the bitmap
73 virtual bool CopyFromIcon(const wxIcon
& icon
);
75 static void InitStandardHandlers();
78 virtual void SetHeight(int height
);
79 virtual void SetWidth(int width
);
80 virtual void SetDepth(int depth
);
82 // get underlying native representation:
83 wxIDirectFBSurfacePtr
GetDirectFBSurface() const;
86 bool CreateFromXpm(const char **bits
);
89 virtual wxObjectRefData
*CreateRefData() const;
90 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
92 DECLARE_DYNAMIC_CLASS(wxBitmap
)
95 #endif // _WX_DFB_BITMAP_H_