]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/bitmap.h
974c2a78448762555bce25efe174b68f9ce48fbb
[wxWidgets.git] / include / wx / dfb / bitmap.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/bitmap.h
3 // Purpose: wxBitmap class
4 // Author: Vaclav Slavik
5 // Created: 2006-08-04
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DFB_BITMAP_H_
12 #define _WX_DFB_BITMAP_H_
13
14 #include "wx/dfb/dfbptr.h"
15
16 class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
17
18 wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
19
20 //-----------------------------------------------------------------------------
21 // wxBitmap
22 //-----------------------------------------------------------------------------
23
24 class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase
25 {
26 public:
27 wxBitmap() {}
28 wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); }
29 wxBitmap(int width, int height, int depth = -1) { Create(width, height, depth); }
30 wxBitmap(const wxSize& sz, int depth = -1) { Create(sz, depth); }
31 wxBitmap(const char bits[], int width, int height, int depth = 1);
32 wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
33 wxBitmap(const char* const* bits);
34 #if wxUSE_IMAGE
35 wxBitmap(const wxImage& image, int depth = -1);
36 #endif
37
38 bool Create(const wxIDirectFBSurfacePtr& surface);
39 bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
40 bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
41 { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
42 bool Create(int width, int height, const wxDC& WXUNUSED(dc))
43 { return Create(width,height); }
44
45 virtual int GetHeight() const;
46 virtual int GetWidth() const;
47 virtual int GetDepth() const;
48
49 #if wxUSE_IMAGE
50 virtual wxImage ConvertToImage() const;
51 #endif
52
53 virtual wxMask *GetMask() const;
54 virtual void SetMask(wxMask *mask);
55
56 virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
57
58 virtual bool SaveFile(const wxString &name, wxBitmapType type,
59 const wxPalette *palette = NULL) const;
60 virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
61
62 #if wxUSE_PALETTE
63 virtual wxPalette *GetPalette() const;
64 virtual void SetPalette(const wxPalette& palette);
65 #endif
66
67 // copies the contents and mask of the given (colour) icon to the bitmap
68 virtual bool CopyFromIcon(const wxIcon& icon);
69
70 static void InitStandardHandlers();
71
72 // raw bitmap access support functions
73 void *GetRawData(wxPixelDataBase& data, int bpp);
74 void UngetRawData(wxPixelDataBase& data);
75
76 bool HasAlpha() const;
77
78 // implementation:
79 virtual void SetHeight(int height);
80 virtual void SetWidth(int width);
81 virtual void SetDepth(int depth);
82
83 // get underlying native representation:
84 wxIDirectFBSurfacePtr GetDirectFBSurface() const;
85
86 protected:
87 virtual wxGDIRefData *CreateGDIRefData() const;
88 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
89
90 bool CreateWithFormat(int width, int height, int dfbFormat);
91
92 DECLARE_DYNAMIC_CLASS(wxBitmap)
93 };
94
95 #endif // _WX_DFB_BITMAP_H_