]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/dib.cpp
make it possible to create wxWindowDC for a hidden window
[wxWidgets.git] / src / palmos / dib.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/dib.cpp
3 // Purpose: implements wxDIB class
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10.13.04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_WXDIB
28
29 #ifndef WX_PRECOMP
30 #include "wx/string.h"
31 #include "wx/log.h"
32 #include "wx/intl.h"
33 #include "wx/bitmap.h"
34 #include "wx/image.h"
35 #endif //WX_PRECOMP
36
37 #include "wx/file.h"
38
39 #include "wx/palmos/dib.h"
40
41 // ----------------------------------------------------------------------------
42 // private functions
43 // ----------------------------------------------------------------------------
44
45 // calculate the number of palette entries needed for the bitmap with this
46 // number of bits per pixel
47 static inline WORD GetNumberOfColours(WORD bitsPerPixel)
48 {
49 // only 1, 4 and 8bpp bitmaps use palettes (well, they could be used with
50 // 24bpp ones too but we don't support this as I think it's quite uncommon)
51 return bitsPerPixel <= 8 ? 1 << bitsPerPixel : 0;
52 }
53
54 // wrapper around ::GetObject() for DIB sections
55 static inline bool GetDIBSection(HBITMAP hbmp, DIBSECTION *ds)
56 {
57 // note that at least under Win9x (this doesn't seem to happen under Win2K
58 // but this doesn't mean anything, of course), GetObject() may return
59 // sizeof(DIBSECTION) for a bitmap which is *not* a DIB section and the way
60 // to check for it is by looking at the bits pointer
61 return ::GetObject(hbmp, sizeof(DIBSECTION), ds) == sizeof(DIBSECTION) &&
62 ds->dsBm.bmBits;
63 }
64
65 // ============================================================================
66 // implementation
67 // ============================================================================
68
69 // ----------------------------------------------------------------------------
70 // wxDIB creation
71 // ----------------------------------------------------------------------------
72
73 bool wxDIB::Create(int width, int height, int depth)
74 {
75 return false;
76 }
77
78 bool wxDIB::Create(const wxBitmap& bmp)
79 {
80 return false;
81 }
82
83 bool wxDIB::CopyFromDDB(HBITMAP hbmp)
84 {
85 return false;
86 }
87
88
89 // ----------------------------------------------------------------------------
90 // Loading/saving the DIBs
91 // ----------------------------------------------------------------------------
92
93 bool wxDIB::Load(const wxString& filename)
94 {
95 return false;
96 }
97
98 bool wxDIB::Save(const wxString& filename)
99 {
100 return false;
101 }
102
103 // ----------------------------------------------------------------------------
104 // wxDIB accessors
105 // ----------------------------------------------------------------------------
106
107 void wxDIB::DoGetObject() const
108 {
109 }
110
111 // ----------------------------------------------------------------------------
112 // DDB <-> DIB conversions
113 // ----------------------------------------------------------------------------
114
115 HBITMAP wxDIB::CreateDDB(HDC hdc) const
116 {
117 return 0;
118 }
119
120 /* static */
121 HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, void *bits)
122 {
123 return 0;
124 }
125
126 /* static */
127 size_t wxDIB::ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp)
128 {
129 return 0;
130 }
131
132 /* static */
133 HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp)
134 {
135 return NULL;
136 }
137
138 // ----------------------------------------------------------------------------
139 // palette support
140 // ----------------------------------------------------------------------------
141
142 #if wxUSE_PALETTE
143
144 wxPalette *wxDIB::CreatePalette() const
145 {
146 return NULL;
147 }
148
149 #endif // wxUSE_PALETTE
150
151 // ----------------------------------------------------------------------------
152 // wxImage support
153 // ----------------------------------------------------------------------------
154
155 #if wxUSE_IMAGE
156
157 bool wxDIB::Create(const wxImage& image)
158 {
159 return false;
160 }
161
162 wxImage wxDIB::ConvertToImage() const
163 {
164 return wxNullImage;
165 }
166
167 #endif // wxUSE_IMAGE
168
169 #endif // wxUSE_WXDIB