]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/bitmap.h
Add more checks for Intel compiler.
[wxWidgets.git] / include / wx / gtk1 / bitmap.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/bitmap.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 #ifndef __GTKBITMAPH__
11 #define __GTKBITMAPH__
12
13 #include "wx/defs.h"
14 #include "wx/object.h"
15 #include "wx/string.h"
16 #include "wx/palette.h"
17 #include "wx/gdiobj.h"
18
19 class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
20
21 //-----------------------------------------------------------------------------
22 // classes
23 //-----------------------------------------------------------------------------
24
25 class WXDLLIMPEXP_FWD_CORE wxMask;
26 class WXDLLIMPEXP_FWD_CORE wxBitmap;
27 class WXDLLIMPEXP_FWD_CORE wxImage;
28
29 //-----------------------------------------------------------------------------
30 // wxMask
31 //-----------------------------------------------------------------------------
32
33 class WXDLLIMPEXP_CORE wxMask: public wxObject
34 {
35 public:
36 wxMask();
37 wxMask( const wxBitmap& bitmap, const wxColour& colour );
38 #if wxUSE_PALETTE
39 wxMask( const wxBitmap& bitmap, int paletteIndex );
40 #endif // wxUSE_PALETTE
41 wxMask( const wxBitmap& bitmap );
42 virtual ~wxMask();
43
44 bool Create( const wxBitmap& bitmap, const wxColour& colour );
45 #if wxUSE_PALETTE
46 bool Create( const wxBitmap& bitmap, int paletteIndex );
47 #endif // wxUSE_PALETTE
48 bool Create( const wxBitmap& bitmap );
49
50 // implementation
51 GdkBitmap *m_bitmap;
52
53 GdkBitmap *GetBitmap() const;
54
55 private:
56 DECLARE_DYNAMIC_CLASS(wxMask)
57 };
58
59 //-----------------------------------------------------------------------------
60 // wxBitmap
61 //-----------------------------------------------------------------------------
62
63 class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
64 {
65 public:
66 wxBitmap() {}
67 wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); }
68 wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); }
69 wxBitmap( const char bits[], int width, int height, int depth = 1 );
70 wxBitmap( const char* const* bits );
71 #ifdef wxNEEDS_CHARPP
72 // needed for old GCC
73 wxBitmap(char** data)
74 {
75 *this = wxBitmap(const_cast<const char* const*>(data));
76 }
77 #endif
78 wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
79 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
80 virtual ~wxBitmap();
81
82 bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
83 bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
84 { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
85 bool Create(int width, int height, const wxDC& WXUNUSED(dc))
86 { return Create(width,height); }
87
88 virtual int GetHeight() const;
89 virtual int GetWidth() const;
90 virtual int GetDepth() const;
91
92 wxImage ConvertToImage() const;
93
94 // copies the contents and mask of the given (colour) icon to the bitmap
95 virtual bool CopyFromIcon(const wxIcon& icon);
96
97 wxMask *GetMask() const;
98 void SetMask( wxMask *mask );
99
100 wxBitmap GetSubBitmap( const wxRect& rect ) const;
101
102 bool SaveFile(const wxString &name, wxBitmapType type,
103 const wxPalette *palette = NULL) const;
104 bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
105
106 #if wxUSE_PALETTE
107 wxPalette *GetPalette() const;
108 void SetPalette(const wxPalette& palette);
109 wxPalette *GetColourMap() const { return GetPalette(); }
110 #endif // wxUSE_PALETTE
111
112 static void InitStandardHandlers();
113
114 // implementation
115 // --------------
116
117 void SetHeight( int height );
118 void SetWidth( int width );
119 void SetDepth( int depth );
120 void SetPixmap( GdkPixmap *pixmap );
121 void SetBitmap( GdkBitmap *bitmap );
122
123 GdkPixmap *GetPixmap() const;
124 GdkBitmap *GetBitmap() const;
125 bool HasPixmap() const;
126
127 // Basically, this corresponds to Win32 StretchBlt()
128 wxBitmap Rescale( int clipx, int clipy, int clipwidth, int clipheight, int width, int height );
129
130 // raw bitmap access support functions
131 void *GetRawData(wxPixelDataBase& data, int bpp);
132 void UngetRawData(wxPixelDataBase& data);
133
134 bool HasAlpha() const;
135
136 protected:
137 bool CreateFromImage(const wxImage& image, int depth);
138
139 virtual wxGDIRefData *CreateGDIRefData() const;
140 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
141
142 private:
143 // to be called from CreateFromImage only!
144 bool CreateFromImageAsBitmap(const wxImage& image);
145 bool CreateFromImageAsPixmap(const wxImage& image);
146
147 friend class wxBitmapHandler;
148
149 private:
150 DECLARE_DYNAMIC_CLASS(wxBitmap)
151 };
152
153
154 #endif // __GTKBITMAPH__