]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: bitmap.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
6f65e337 | 5 | // RCS-ID: $Id$ |
01111366 | 6 | // Copyright: (c) 1998 Robert Roebling |
f05df5a8 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | ||
11 | #ifndef __GTKBITMAPH__ | |
12 | #define __GTKBITMAPH__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
19 | #include "wx/object.h" | |
20 | #include "wx/string.h" | |
21 | #include "wx/palette.h" | |
58c837a4 | 22 | #include "wx/gdiobj.h" |
c801d85f KB |
23 | |
24 | //----------------------------------------------------------------------------- | |
25 | // classes | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
c801d85f KB |
28 | class wxMask; |
29 | class wxBitmap; | |
fd859211 | 30 | class wxImage; |
c801d85f KB |
31 | |
32 | //----------------------------------------------------------------------------- | |
33 | // wxMask | |
34 | //----------------------------------------------------------------------------- | |
35 | ||
36 | class wxMask: public wxObject | |
37 | { | |
fd0eed64 | 38 | public: |
8636aed8 RR |
39 | wxMask(); |
40 | wxMask( const wxBitmap& bitmap, const wxColour& colour ); | |
41 | wxMask( const wxBitmap& bitmap, int paletteIndex ); | |
42 | wxMask( const wxBitmap& bitmap ); | |
43 | ~wxMask(); | |
91b8de8d | 44 | |
8636aed8 RR |
45 | bool Create( const wxBitmap& bitmap, const wxColour& colour ); |
46 | bool Create( const wxBitmap& bitmap, int paletteIndex ); | |
47 | bool Create( const wxBitmap& bitmap ); | |
48 | ||
49 | // implementation | |
50 | GdkBitmap *m_bitmap; | |
51 | ||
52 | GdkBitmap *GetBitmap() const; | |
53 | ||
54 | private: | |
55 | DECLARE_DYNAMIC_CLASS(wxMask) | |
c801d85f KB |
56 | }; |
57 | ||
58 | //----------------------------------------------------------------------------- | |
59 | // wxBitmap | |
60 | //----------------------------------------------------------------------------- | |
61 | ||
58c837a4 | 62 | class wxBitmap: public wxGDIObject |
c801d85f | 63 | { |
fd0eed64 | 64 | public: |
8636aed8 RR |
65 | wxBitmap(); |
66 | wxBitmap( int width, int height, int depth = -1 ); | |
67 | wxBitmap( const char bits[], int width, int height, int depth = 1 ); | |
e838cc14 VZ |
68 | wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); } |
69 | wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); } | |
8636aed8 RR |
70 | wxBitmap( const wxBitmap& bmp ); |
71 | wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); | |
fd859211 | 72 | wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); } |
8636aed8 RR |
73 | ~wxBitmap(); |
74 | wxBitmap& operator = ( const wxBitmap& bmp ); | |
f6bcfd97 BP |
75 | bool operator == ( const wxBitmap& bmp ) const; |
76 | bool operator != ( const wxBitmap& bmp ) const; | |
8636aed8 RR |
77 | bool Ok() const; |
78 | ||
c826213d RR |
79 | bool Create(int width, int height, int depth = -1); |
80 | ||
8636aed8 RR |
81 | int GetHeight() const; |
82 | int GetWidth() const; | |
83 | int GetDepth() const; | |
fd859211 VS |
84 | |
85 | wxImage ConvertToImage() const; | |
8636aed8 RR |
86 | |
87 | wxMask *GetMask() const; | |
88 | void SetMask( wxMask *mask ); | |
17bec151 RR |
89 | |
90 | wxBitmap GetSubBitmap( const wxRect& rect ) const; | |
8636aed8 RR |
91 | |
92 | bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL ); | |
93 | bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM ); | |
94 | ||
95 | wxPalette *GetPalette() const; | |
96 | wxPalette *GetColourMap() const | |
fd0eed64 | 97 | { return GetPalette(); }; |
8bbe427f | 98 | |
8636aed8 | 99 | // implementation |
20e05ffb | 100 | // -------------- |
c801d85f | 101 | |
8636aed8 RR |
102 | void SetHeight( int height ); |
103 | void SetWidth( int width ); | |
104 | void SetDepth( int depth ); | |
105 | void SetPixmap( GdkPixmap *pixmap ); | |
82ea63e6 | 106 | void SetBitmap( GdkBitmap *bitmap ); |
8bbe427f | 107 | |
8636aed8 RR |
108 | GdkPixmap *GetPixmap() const; |
109 | GdkBitmap *GetBitmap() const; | |
8636aed8 | 110 | |
e838cc14 VZ |
111 | protected: |
112 | bool CreateFromXpm(const char **bits); | |
fd859211 | 113 | bool CreateFromImage(const wxImage& image, int depth); |
e838cc14 | 114 | |
8636aed8 RR |
115 | private: |
116 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
c801d85f KB |
117 | }; |
118 | ||
119 | #endif // __GTKBITMAPH__ |