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(const wxIDirectFBSurfacePtr
& surface
) { Create(surface
); }
67 wxBitmap(int width
, int height
, int depth
= -1);
68 wxBitmap(const char bits
[], int width
, int height
, int depth
= 1);
69 wxBitmap(const wxString
&filename
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
70 wxBitmap(const char **bits
) { CreateFromXpm(bits
); }
71 wxBitmap(char **bits
) { CreateFromXpm((const char **)bits
); }
73 wxBitmap(const wxImage
& image
, int depth
= -1);
77 bool operator==(const wxBitmap
& bmp
) const;
78 bool operator!=(const wxBitmap
& bmp
) const { return !(*this == bmp
); }
80 bool Create(const wxIDirectFBSurfacePtr
& surface
);
81 bool Create(int width
, int height
, int depth
= -1);
83 virtual int GetHeight() const;
84 virtual int GetWidth() const;
85 virtual int GetDepth() const;
88 virtual wxImage
ConvertToImage() const;
91 virtual wxMask
*GetMask() const;
92 virtual void SetMask(wxMask
*mask
);
94 virtual wxBitmap
GetSubBitmap(const wxRect
& rect
) const;
96 virtual bool SaveFile(const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= (wxPalette
*) NULL
) const;
97 virtual bool LoadFile(const wxString
&name
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
100 virtual wxPalette
*GetPalette() const;
101 virtual void SetPalette(const wxPalette
& palette
);
104 // copies the contents and mask of the given (colour) icon to the bitmap
105 virtual bool CopyFromIcon(const wxIcon
& icon
);
107 static void InitStandardHandlers();
110 virtual void SetHeight(int height
);
111 virtual void SetWidth(int width
);
112 virtual void SetDepth(int depth
);
114 // get underlying native representation:
115 wxIDirectFBSurfacePtr
GetDirectFBSurface() const;
118 bool CreateFromXpm(const char **bits
);
121 virtual wxObjectRefData
*CreateRefData() const;
122 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
124 DECLARE_DYNAMIC_CLASS(wxBitmap
)
127 #endif // _WX_DFB_BITMAP_H_