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 class WXDLLIMPEXP_FWD_CORE wxPixelDataBase
;
18 wxDFB_DECLARE_INTERFACE(IDirectFBSurface
);
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 class WXDLLIMPEXP_CORE wxBitmapHandler
: public wxBitmapHandlerBase
26 DECLARE_ABSTRACT_CLASS(wxBitmapHandler
)
29 class WXDLLIMPEXP_CORE wxBitmap
: public wxBitmapBase
33 wxBitmap(const wxIDirectFBSurfacePtr
& surface
) { Create(surface
); }
34 wxBitmap(int width
, int height
, int depth
= -1);
35 wxBitmap(const char bits
[], int width
, int height
, int depth
= 1);
36 wxBitmap(const wxString
&filename
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
37 wxBitmap(const char* const* bits
);
39 wxBitmap(const wxImage
& image
, int depth
= -1);
42 bool Ok() const { return IsOk(); }
45 bool Create(const wxIDirectFBSurfacePtr
& surface
);
46 bool Create(int width
, int height
, int depth
= -1);
48 virtual int GetHeight() const;
49 virtual int GetWidth() const;
50 virtual int GetDepth() const;
53 virtual wxImage
ConvertToImage() const;
56 virtual wxMask
*GetMask() const;
57 virtual void SetMask(wxMask
*mask
);
59 virtual wxBitmap
GetSubBitmap(const wxRect
& rect
) const;
61 virtual bool SaveFile(const wxString
&name
, wxBitmapType type
, const wxPalette
*palette
= (wxPalette
*) NULL
) const;
62 virtual bool LoadFile(const wxString
&name
, wxBitmapType type
= wxBITMAP_TYPE_RESOURCE
);
65 virtual wxPalette
*GetPalette() const;
66 virtual void SetPalette(const wxPalette
& palette
);
69 // copies the contents and mask of the given (colour) icon to the bitmap
70 virtual bool CopyFromIcon(const wxIcon
& icon
);
72 static void InitStandardHandlers();
74 // raw bitmap access support functions
75 void *GetRawData(wxPixelDataBase
& data
, int bpp
);
76 void UngetRawData(wxPixelDataBase
& data
);
78 bool HasAlpha() const;
81 virtual void SetHeight(int height
);
82 virtual void SetWidth(int width
);
83 virtual void SetDepth(int depth
);
85 // get underlying native representation:
86 wxIDirectFBSurfacePtr
GetDirectFBSurface() const;
90 virtual wxObjectRefData
*CreateRefData() const;
91 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
93 bool CreateWithFormat(int width
, int height
, int dfbFormat
);
95 DECLARE_DYNAMIC_CLASS(wxBitmap
)
98 #endif // _WX_DFB_BITMAP_H_