1wxBitmap(3)                Erlang Module Definition                wxBitmap(3)
2
3
4

NAME

6       wxBitmap - Functions for wxBitmap class
7

DESCRIPTION

9       This class encapsulates the concept of a platform-dependent bitmap, ei‐
10       ther monochrome or colour or colour with alpha channel support.
11
12       If you need direct access the bitmap data instead going through drawing
13       to it using wxMemoryDC you need to use the wxPixelData (not implemented
14       in wx) class (either wxNativePixelData for RGB bitmaps or wxAlphaPixel‐
15       Data for bitmaps with an additionally alpha channel).
16
17       Note  that  many  wxBitmap  functions take a type parameter, which is a
18       value of the ?wxBitmapType enumeration. The validity  of  those  values
19       depends  however on the platform where your program is running and from
20       the wxWidgets configuration. If all  possible  wxWidgets  settings  are
21       used:
22
23       In  addition,  wxBitmap can load and save all formats that wxImage can;
24       see wxImage for more info. Of course, you must have loaded the  wxImage
25       handlers  (see  ?wxInitAllImageHandlers()  and wxImage::AddHandler (not
26       implemented in wx)). Note that all  available  wxBitmapHandlers  for  a
27       given  wxWidgets  port are automatically loaded at startup so you won't
28       need to use wxBitmap::AddHandler (not implemented in wx).
29
30       More on the difference between wxImage and wxBitmap: wxImage is just  a
31       buffer  of RGB bytes with an optional buffer for the alpha bytes. It is
32       all generic, platform independent and  image  file  format  independent
33       code.  It  includes  generic  code for scaling, resizing, clipping, and
34       other manipulations of the image data. OTOH, wxBitmap is intended to be
35       a wrapper of whatever is the native image format that is quickest/easi‐
36       est to draw to a DC or to be the target of the drawing operations  per‐
37       formed on a wxMemoryDC. By splitting the responsibilities between wxIm‐
38       age/wxBitmap like this then it's easier to use generic code  shared  by
39       all  platforms and image types for generic operations and platform spe‐
40       cific code where performance or compatibility is needed.
41
42       Predefined objects (include wx.hrl): ?wxNullBitmap
43
44       See: Overview bitmap, Overview bitmap, wxDC:blit/6,  wxIcon,  wxCursor,
45       wxMemoryDC, wxImage, wxPixelData (not implemented in wx)
46
47       wxWidgets docs: wxBitmap
48

DATA TYPES

50       wxBitmap() = wx:wx_object()
51

EXPORTS

53       new() -> wxBitmap()
54
55              Default constructor.
56
57              Constructs  a  bitmap  object with no data; an assignment or an‐
58              other member function such as create/4  or  loadFile/3  must  be
59              called subsequently.
60
61       new(Name) -> wxBitmap()
62
63       new(Sz) -> wxBitmap()
64
65       new(Img) -> wxBitmap()
66
67              Types:
68
69                 Img = wxImage:wxImage() | wxBitmap:wxBitmap()
70
71       new(Width, Height) -> wxBitmap()
72
73       new(Name, Height :: [Option]) -> wxBitmap()
74
75       new(Sz, Height :: [Option]) -> wxBitmap()
76
77       new(Img, Height :: [Option]) -> wxBitmap()
78
79              Types:
80
81                 Img = wxImage:wxImage()
82                 Option = {depth, integer()}
83
84              Creates this bitmap object from the given image.
85
86              This  has  to be done to actually display an image as you cannot
87              draw an image directly on a window.
88
89              The resulting bitmap will use the provided colour depth (or that
90              of  the current system if depth is ?wxBITMAP_SCREEN_DEPTH) which
91              entails that a colour reduction may take place.
92
93              On Windows, if there is a palette present (set with SetPalette),
94              it will be used when creating the wxBitmap (most useful in 8-bit
95              display mode). On other platforms, the palette is currently  ig‐
96              nored.
97
98       new(Bits, Width, Height) -> wxBitmap()
99
100       new(Width, Height, Height :: [Option]) -> wxBitmap()
101
102              Types:
103
104                 Width = Height = integer()
105                 Option = {depth, integer()}
106
107              Creates a new bitmap.
108
109              A  depth  of  ?wxBITMAP_SCREEN_DEPTH  indicates the depth of the
110              current screen or visual.
111
112              Some   platforms   only   support   1   for    monochrome    and
113              ?wxBITMAP_SCREEN_DEPTH for the current colour setting.
114
115              A depth of 32 including an alpha channel is supported under MSW,
116              Mac and GTK+.
117
118       new(Bits, Width, Height, Options :: [Option]) -> wxBitmap()
119
120              Types:
121
122                 Bits = binary()
123                 Width = Height = integer()
124                 Option = {depth, integer()}
125
126              Creates a bitmap from the given array bits.
127
128              You should only use this function for monochrome bitmaps  (depth
129              1)  in portable programs: in this case the bits parameter should
130              contain an XBM image.
131
132              For other bit depths, the behaviour is platform dependent: under
133              Windows,  the data is passed without any changes to the underly‐
134              ing CreateBitmap() API. Under other platforms,  only  monochrome
135              bitmaps may be created using this constructor and wxImage should
136              be used for creating colour bitmaps from static data.
137
138       destroy(This :: wxBitmap()) -> ok
139
140              Creates bitmap corresponding to the given cursor.
141
142              This can be useful to display a cursor as it cannot be drawn di‐
143              rectly on a window.
144
145              This constructor only exists in wxMSW and wxGTK (where it is im‐
146              plemented for GTK+ 2.8 or later) only.
147
148              Since: 3.1.0 Destructor. See overview_refcount_destruct for more
149              info.
150
151              If  the  application  omits to delete the bitmap explicitly, the
152              bitmap will be destroyed automatically by wxWidgets when the ap‐
153              plication exits.
154
155              Warning:  Do  not delete a bitmap that is selected into a memory
156              device context.
157
158       convertToImage(This) -> wxImage:wxImage()
159
160              Types:
161
162                 This = wxBitmap()
163
164              Creates an image from a platform-dependent bitmap.
165
166              This preserves mask information so that bitmaps and  images  can
167              be converted back and forth without loss in that respect.
168
169       copyFromIcon(This, Icon) -> boolean()
170
171              Types:
172
173                 This = wxBitmap()
174                 Icon = wxIcon:wxIcon()
175
176              Creates the bitmap from an icon.
177
178       create(This, Sz) -> boolean()
179
180              Types:
181
182                 This = wxBitmap()
183                 Sz = {W :: integer(), H :: integer()}
184
185       create(This, Width, Height) -> boolean()
186
187       create(This, Sz, Height :: [Option]) -> boolean()
188
189              Types:
190
191                 This = wxBitmap()
192                 Sz = {W :: integer(), H :: integer()}
193                 Option = {depth, integer()}
194
195              This is an overloaded member function, provided for convenience.
196              It differs from the above function only in what  argument(s)  it
197              accepts.
198
199       create(This, Width, Height, Options :: [Option]) -> boolean()
200
201       create(This, Width, Height, Dc) -> boolean()
202
203              Types:
204
205                 This = wxBitmap()
206                 Width = Height = integer()
207                 Dc = wxDC:wxDC()
208
209              Create  a  bitmap  compatible  with the given DC, inheriting its
210              magnification factor.
211
212              Return: true if the creation was successful.
213
214              Since: 3.1.0
215
216       getDepth(This) -> integer()
217
218              Types:
219
220                 This = wxBitmap()
221
222              Gets the colour depth of the bitmap.
223
224              A value of 1 indicates a monochrome bitmap.
225
226       getHeight(This) -> integer()
227
228              Types:
229
230                 This = wxBitmap()
231
232              Gets the height of the bitmap in pixels.
233
234              See: getWidth/1, GetSize() (not implemented in wx)
235
236       getPalette(This) -> wxPalette:wxPalette()
237
238              Types:
239
240                 This = wxBitmap()
241
242              Gets the associated palette (if any) which may have been  loaded
243              from a file or set for the bitmap.
244
245              See: wxPalette
246
247       getMask(This) -> wxMask:wxMask()
248
249              Types:
250
251                 This = wxBitmap()
252
253              Gets  the  associated  mask  (if any) which may have been loaded
254              from a file or set for the bitmap.
255
256              See: setMask/2, wxMask
257
258       getWidth(This) -> integer()
259
260              Types:
261
262                 This = wxBitmap()
263
264              Gets the width of the bitmap in pixels.
265
266              See: getHeight/1, GetSize() (not implemented in wx)
267
268       getSubBitmap(This, Rect) -> wxBitmap()
269
270              Types:
271
272                 This = wxBitmap()
273                 Rect =
274                     {X :: integer(),
275                      Y :: integer(),
276                      W :: integer(),
277                      H :: integer()}
278
279              Returns a sub bitmap of the current one as long as the rect  be‐
280              longs entirely to the bitmap.
281
282              This function preserves bit depth and mask information.
283
284       loadFile(This, Name) -> boolean()
285
286              Types:
287
288                 This = wxBitmap()
289                 Name = unicode:chardata()
290
291       loadFile(This, Name, Options :: [Option]) -> boolean()
292
293              Types:
294
295                 This = wxBitmap()
296                 Name = unicode:chardata()
297                 Option = {type, wx:wx_enum()}
298
299              Loads a bitmap from a file or resource.
300
301              Return: true if the operation succeeded, false otherwise.
302
303              Remark:  A  palette may be associated with the bitmap if one ex‐
304              ists (especially for colour Windows bitmaps), and  if  the  code
305              supports  it. You can check if one has been created by using the
306              getPalette/1 member.
307
308              See: saveFile/4
309
310       ok(This) -> boolean()
311
312              Types:
313
314                 This = wxBitmap()
315
316              See: isOk/1.
317
318       isOk(This) -> boolean()
319
320              Types:
321
322                 This = wxBitmap()
323
324              Returns true if bitmap data is present.
325
326       saveFile(This, Name, Type) -> boolean()
327
328              Types:
329
330                 This = wxBitmap()
331                 Name = unicode:chardata()
332                 Type = wx:wx_enum()
333
334       saveFile(This, Name, Type, Options :: [Option]) -> boolean()
335
336              Types:
337
338                 This = wxBitmap()
339                 Name = unicode:chardata()
340                 Type = wx:wx_enum()
341                 Option = {palette, wxPalette:wxPalette()}
342
343              Saves a bitmap in the named file.
344
345              Return: true if the operation succeeded, false otherwise.
346
347              Remark: Depending on how wxWidgets has been configured, not  all
348              formats may be available.
349
350              See: loadFile/3
351
352       setDepth(This, Depth) -> ok
353
354              Types:
355
356                 This = wxBitmap()
357                 Depth = integer()
358
359              Deprecated: This function is deprecated since version 3.1.2, di‐
360              mensions and depth can only be set at construction time.
361
362              Sets the depth member (does not affect the bitmap data).
363
364       setHeight(This, Height) -> ok
365
366              Types:
367
368                 This = wxBitmap()
369                 Height = integer()
370
371              Deprecated: This function is deprecated since version 3.1.2, di‐
372              mensions and depth can only be set at construction time.
373
374              Sets the height member (does not affect the bitmap data).
375
376       setMask(This, Mask) -> ok
377
378              Types:
379
380                 This = wxBitmap()
381                 Mask = wxMask:wxMask()
382
383              Sets the mask for this bitmap.
384
385              Remark:  The  bitmap  object  owns  the  mask once this has been
386              called.
387
388              Note: A mask can be set also for bitmap with  an  alpha  channel
389              but  doing so under wxMSW is not recommended because performance
390              of drawing such bitmap is not very good.
391
392              See: getMask/1, wxMask
393
394       setPalette(This, Palette) -> ok
395
396              Types:
397
398                 This = wxBitmap()
399                 Palette = wxPalette:wxPalette()
400
401              Sets the associated palette.
402
403              (Not implemented under GTK+).
404
405              See: wxPalette
406
407       setWidth(This, Width) -> ok
408
409              Types:
410
411                 This = wxBitmap()
412                 Width = integer()
413
414              Deprecated: This function is deprecated since version 3.1.2, di‐
415              mensions and depth can only be set at construction time.
416
417              Sets the width member (does not affect the bitmap data).
418
419
420
421wxWidgets team.                    wx 2.2.1                        wxBitmap(3)
Impressum