]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dfb/bitmap.h
adopting correct implementation virtualization for Do/GradientFillConcentric
[wxWidgets.git] / include / wx / dfb / bitmap.h
CommitLineData
b3c86150
VS
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
52c8d32a 14#include "wx/dfb/dfbptr.h"
b3c86150
VS
15
16wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
17
18//-----------------------------------------------------------------------------
19// wxMask
20//-----------------------------------------------------------------------------
21
22#warning "FIXME: move wxMask to common code"
23class WXDLLIMPEXP_CORE wxMask: public wxObject
24{
25public:
26 wxMask();
27 wxMask(const wxBitmap& bitmap);
28 wxMask(const wxBitmap& bitmap, const wxColour& colour);
29#if wxUSE_PALETTE
30 wxMask(const wxBitmap& bitmap, int paletteIndex);
31#endif
32 wxMask(const wxMask& mask);
33 ~wxMask();
34
35 bool Create(const wxBitmap& bitmap);
36 bool Create(const wxBitmap& bitmap, const wxColour& colour);
37#if wxUSE_PALETTE
38 bool Create(const wxBitmap& bitmap, int paletteIndex);
39#endif
40
41 // implementation
42 const wxBitmap& GetBitmap() const;
43
44private:
45 wxBitmap *m_bitmap;
46
47 DECLARE_DYNAMIC_CLASS(wxMask)
48};
49
50//-----------------------------------------------------------------------------
51// wxBitmap
52//-----------------------------------------------------------------------------
53
54class WXDLLIMPEXP_CORE wxBitmapHandler : public wxBitmapHandlerBase
55{
56public:
57 wxBitmapHandler() : wxBitmapHandlerBase() {}
58private:
59 DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
60};
61
62class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
63{
64public:
65 wxBitmap() {}
4562386d 66 wxBitmap(const wxIDirectFBSurfacePtr& surface) { Create(surface); }
b3c86150
VS
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); }
72#if wxUSE_IMAGE
73 wxBitmap(const wxImage& image, int depth = -1);
74#endif
75
76 bool Ok() const;
77 bool operator==(const wxBitmap& bmp) const;
78 bool operator!=(const wxBitmap& bmp) const { return !(*this == bmp); }
79
4562386d 80 bool Create(const wxIDirectFBSurfacePtr& surface);
b3c86150
VS
81 bool Create(int width, int height, int depth = -1);
82
83 virtual int GetHeight() const;
84 virtual int GetWidth() const;
85 virtual int GetDepth() const;
86
87#if wxUSE_IMAGE
88 virtual wxImage ConvertToImage() const;
89#endif
90
91 virtual wxMask *GetMask() const;
92 virtual void SetMask(wxMask *mask);
93
94 virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
95
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);
98
99#if wxUSE_PALETTE
100 virtual wxPalette *GetPalette() const;
101 virtual void SetPalette(const wxPalette& palette);
102#endif
103
104 // copies the contents and mask of the given (colour) icon to the bitmap
105 virtual bool CopyFromIcon(const wxIcon& icon);
106
107 static void InitStandardHandlers();
108
109 // implementation:
110 virtual void SetHeight(int height);
111 virtual void SetWidth(int width);
112 virtual void SetDepth(int depth);
113
114 // get underlying native representation:
52c8d32a 115 wxIDirectFBSurfacePtr GetDirectFBSurface() const;
b3c86150
VS
116
117protected:
118 bool CreateFromXpm(const char **bits);
119
120 // ref counting code
121 virtual wxObjectRefData *CreateRefData() const;
122 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
123
124 DECLARE_DYNAMIC_CLASS(wxBitmap)
125};
126
127#endif // _WX_DFB_BITMAP_H_