]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/image.tex
Added mono bitmap to image conversion.
[wxWidgets.git] / docs / latex / wx / image.tex
CommitLineData
1e6d9499
JS
1\section{\class{wxImage}}\label{wximage}
2
3This class encapsulates a platform-independent image. An image can be created
4from data, or using the constructor taking a wxBitmap object. An image
5can be loaded from a file in a variety of formats, and is extensible to new formats
6via image format handlers. Functions are available to set and get image bits, so
7it can be used for basic image manipulation.
8
9A wxImage cannot (currently) be drawn directly to a wxDC. Instead, a platform-specific
12a44087
RR
10wxBitmap object must be created from it, and that bitmap drawn on the wxDC, using
11wxDC::DrawBitmap.
12
1e6d9499
JS
13\wxheading{Derived from}
14
15\helpref{wxObject}{wxobject}
16
954b8ae6
JS
17\wxheading{Include files}
18
19<wx/image.h>
20
1e6d9499
JS
21\wxheading{See also}
22
23\helpref{wxBitmap}{wxbitmap}
b5a4a47d 24\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
1e6d9499
JS
25
26\latexignore{\rtfignore{\wxheading{Members}}}
27
28\membersection{wxImage::wxImage}\label{wximageconstr}
29
30\func{}{wxImage}{\void}
31
32Default constructor.
33
34\func{}{wxImage}{\param{const wxImage\& }{image}}
35
36Copy constructor.
37
38\func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}}
39
12a44087
RR
40Constructs an image from a platform-dependent bitmap. This preserves
41mask information so that bitmaps and images can be converted back
42and forth without loss in that respect.
1e6d9499
JS
43
44\func{}{wxImage}{\param{int}{ width}, \param{int}{ height}}
45
46Creates an image with the given width and height.
47
f6fcbb63 48\func{}{wxImage}{\param{const wxString\& }{name}, \param{long}{ type = wxBITMAP\_TYPE\_PNG}}
1e6d9499 49
9e9ee68e
VS
50\func{}{wxImage}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}}
51
1e6d9499
JS
52Loads an image from a file.
53
f6fcbb63 54\func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{long}{ type = wxBITMAP\_TYPE\_PNG}}
45b5751f 55
9e9ee68e
VS
56\func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{const wxString\&}{ mimetype}}
57
45b5751f
JS
58Loads an image from an input stream.
59
1e6d9499
JS
60\wxheading{Parameters}
61
62\docparam{width}{Specifies the width of the image.}
63
64\docparam{height}{Specifies the height of the image.}
65
66\docparam{name}{This refers to an image filename. Its meaning is determined by the {\it type} parameter.}
67
45b5751f
JS
68\docparam{stream}{This refers to an input stream. Its meaning is determined by the {\it type} parameter. It is equal to loading from file except that you provide opened stream (file, HTTP or any other custom class).}
69
1e6d9499
JS
70\docparam{type}{May be one of the following:
71
6be663cf 72\twocolwidtha{5cm}%
1e6d9499 73\begin{twocollist}
f6fcbb63
RR
74\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_BMP}}}{Load a Windows bitmap file.}
75\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_PNG}}}{Load a PNG bitmap file.}
48b4e302 76\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_JPEG}}}{Load a JPEG bitmap file.}
2376d03d
VS
77\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_GIF}}}{Load a GIF bitmap file.}
78\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_PCX}}}{Load a PCX bitmap file.}
79\twocolitem{{\bf \indexit{wxBITMAP\_TYPE\_PNM}}}{Load a PNM bitmap file.}
1e6d9499
JS
80\end{twocollist}
81
82The validity of these flags depends on the platform and wxWindows configuration.
48b4e302
VS
83If all possible wxWindows settings are used, the loading a BMP (Windows bitmap) file,
84a PNG (portable network graphics) file and a JPEG file is supported on all platforms that
12a44087 85implement wxImage.}
1e6d9499 86
9e9ee68e
VS
87\docparam{mimetype}{MIME type string (for example 'image/jpeg')}
88
f899db6d 89Note : you must call wxImage::AddHandler(new wxJPEGHandler) during application
0a9f2522
VS
90initialization in order to work with JPEGs.
91
1e6d9499
JS
92\wxheading{See also}
93
94\helpref{wxImage::LoadFile}{wximageloadfile}
95
f899db6d
RD
96\pythonnote{Constructors supported by wxPython are:\par
97\indented{2cm}{\begin{twocollist}
c9110876
VS
98\twocolitem{{\bf wxImage(name, flag)}}{Loads an image from a file}
99\twocolitem{{\bf wxNullImage()}}{Create a null image (has no size or
f899db6d 100image data)}
c9110876 101\twocolitem{{\bf wxEmptyImage(width, height)}}{Creates an empty image
f899db6d 102of the given size}
c9110876 103\twocolitem{{\bf wxImageFromMime(name, mimetype}}{Creates an image from
f899db6d 104the given file of the given mimetype}
c9110876 105\twocolitem{{\bf wxImageFromBitmap(bitmap)}}{Creates an image from a
f899db6d
RD
106platform-dependent bitmap}
107\end{twocollist}}
108}
109
1e6d9499
JS
110\membersection{wxImage::\destruct{wxImage}}
111
112\func{}{\destruct{wxImage}}{\void}
113
114Destructor.
115
116\membersection{wxImage::AddHandler}\label{wximageaddhandler}
117
118\func{static void}{AddHandler}{\param{wxImageHandler*}{ handler}}
119
120Adds a handler to the end of the static list of format handlers.
121
122\docparam{handler}{A new image format handler object. There is usually only one instance
123of a given handler class in an application session.}
124
125\wxheading{See also}
126
127\helpref{wxImageHandler}{wximagehandler}
128
c9110876 129\pythonnote{In wxPython this static method is named {\tt wxImage_AddHandler}.}
1e6d9499
JS
130\membersection{wxImage::CleanUpHandlers}
131
132\func{static void}{CleanUpHandlers}{\void}
133
134Deletes all image handlers.
135
136This function is called by wxWindows on exit.
137
138\membersection{wxImage::ConvertToBitmap}\label{wximageconverttobitmap}
139
140\constfunc{wxBitmap}{ConvertToBitmap}{\void}
141
12a44087
RR
142Converts the image to a platform-specific bitmap object. This has to be done
143to actually display an image as you cannot draw an image directly on a window.
144The resulting bitmap will use the colour depth of the current system which entails
f6fcbb63
RR
145that a (crude) colour reduction has to take place. When in 8-bit mode, this
146routine will use a color cube created on program start-up to look up colors.
147Still, the image quality won't be perfect for photo images.
1e6d9499
JS
148
149\membersection{wxImage::Create}\label{wximagecreate}
150
151\func{bool}{Create}{\param{int}{ width}, \param{int}{ height}}
152
153Creates a fresh image.
154
155\wxheading{Parameters}
156
157\docparam{width}{The width of the image in pixels.}
158
159\docparam{height}{The height of the image in pixels.}
160
161\wxheading{Return value}
162
163TRUE if the call succeeded, FALSE otherwise.
164
165\membersection{wxImage::Destroy}\label{wximagedestroy}
166
167\func{bool}{Destroy}{\void}
168
169Destroys the image data.
170
171\membersection{wxImage::FindHandler}
172
173\func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{name}}
174
175Finds the handler with the given name.
176
177\func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ imageType}}
178
179Finds the handler associated with the given extension and type.
180
181\func{static wxImageHandler*}{FindHandler}{\param{long }{imageType}}
182
183Finds the handler associated with the given image type.
184
9e9ee68e
VS
185\func{static wxImageHandler*}{FindHandlerMime}{\param{const wxString\& }{mimetype}}
186
187Finds the handler associated with the given MIME type.
188
1e6d9499
JS
189\docparam{name}{The handler name.}
190
191\docparam{extension}{The file extension, such as ``bmp".}
192
f6fcbb63 193\docparam{imageType}{The image type, such as wxBITMAP\_TYPE\_BMP.}
1e6d9499 194
9e9ee68e
VS
195\docparam{mimetype}{MIME type.}
196
1e6d9499
JS
197\wxheading{Return value}
198
199A pointer to the handler if found, NULL otherwise.
200
201\wxheading{See also}
202
203\helpref{wxImageHandler}{wximagehandler}
204
205\membersection{wxImage::GetBlue}\label{wximagegetblue}
206
207\constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}}
208
209Returns the blue intensity at the given coordinate.
210
211\membersection{wxImage::GetData}\label{wximagegetdata}
212
213\constfunc{unsigned char*}{GetData}{\void}
214
12a44087
RR
215Returns the image data as an array. This is most often used when doing
216direct image manipulation. The return value points to an array of
217chararcters in RGBGBRGB... format.
1e6d9499
JS
218
219\membersection{wxImage::GetGreen}\label{wximagegetgreen}
220
221\constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}}
222
223Returns the green intensity at the given coordinate.
224
225\membersection{wxImage::GetRed}\label{wximagegetred}
226
227\constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}}
228
229Returns the red intensity at the given coordinate.
230
231\membersection{wxImage::GetHandlers}
232
233\func{static wxList\&}{GetHandlers}{\void}
234
235Returns the static list of image format handlers.
236
237\wxheading{See also}
238
239\helpref{wxImageHandler}{wximagehandler}
240
241\membersection{wxImage::GetHeight}\label{wximagegetheight}
242
243\constfunc{int}{GetHeight}{\void}
244
245Gets the height of the image in pixels.
246
247\membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue}
248
249\constfunc{unsigned char}{GetMaskBlue}{\void}
250
251Gets the blue value of the mask colour.
252
253\membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen}
254
255\constfunc{unsigned char}{GetMaskGreen}{\void}
256
257Gets the green value of the mask colour.
258
259\membersection{wxImage::GetMaskRed}\label{wximagegetmaskred}
260
261\constfunc{unsigned char}{GetMaskRed}{\void}
262
263Gets the red value of the mask colour.
264
fc9c7c09
RR
265\membersection{wxImage::GetSubImage}\label{wximagegetsubimage}
266
605d715d 267\constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{rect}}
fc9c7c09
RR
268
269Returns a sub image of the current one as long as the rect belongs entirely to
270the image.
271
1e6d9499
JS
272\membersection{wxImage::GetWidth}\label{wximagegetwidth}
273
274\constfunc{int}{GetWidth}{\void}
275
276Gets the width of the image in pixels.
277
278\wxheading{See also}
279
280\helpref{wxImage::GetHeight}{wximagegetheight}
281
282\membersection{wxImage::HasMask}\label{wximagehasmask}
283
284\constfunc{bool}{HasMask}{\void}
285
286Returns TRUE if there is a mask active, FALSE otherwise.
287
288\membersection{wxImage::InitStandardHandlers}
289
290\func{static void}{InitStandardHandlers}{\void}
291
a14e57f9
SB
292Internal use only. Adds standard image format handlers. It only install BMP
293for the time being, which is use by wxBitmap.
1e6d9499 294
a14e57f9
SB
295This function is called by wxWindows on startup, and shouldn't be called by
296the user.
1e6d9499
JS
297
298\wxheading{See also}
299
300\helpref{wxImageHandler}{wximagehandler}
b5a4a47d 301\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
1e6d9499
JS
302
303\membersection{wxImage::InsertHandler}
304
305\func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}}
306
307Adds a handler at the start of the static list of format handlers.
308
309\docparam{handler}{A new image format handler object. There is usually only one instance
310of a given handler class in an application session.}
311
312\wxheading{See also}
313
314\helpref{wxImageHandler}{wximagehandler}
315
316\membersection{wxImage::LoadFile}\label{wximageloadfile}
317
a14e57f9 318\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
1e6d9499 319
9e9ee68e
VS
320\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}}
321
a14e57f9 322Loads an image from a file. If no handler type is provided, the library will
88b1927c 323try to use wxBITMAP\_TYPE\_BMP.
1e6d9499 324
45b5751f
JS
325\func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}}
326
9e9ee68e
VS
327\func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ mimetype}}
328
45b5751f
JS
329Loads an image from an input stream.
330
1e6d9499
JS
331\wxheading{Parameters}
332
333\docparam{name}{A filename.
334The meaning of {\it name} is determined by the {\it type} parameter.}
335
45b5751f
JS
336\docparam{stream}{An input stream.
337The meaning of {\it stream} data is determined by the {\it type} parameter.}
338
1e6d9499
JS
339\docparam{type}{One of the following values:
340
6be663cf 341\twocolwidtha{5cm}%
1e6d9499 342\begin{twocollist}
f6fcbb63 343\twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.}
a14e57f9 344\twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.}
48b4e302 345\twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.}
a14e57f9
SB
346\twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.}
347\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.}
348\twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.}
1e6d9499
JS
349\end{twocollist}
350
351The validity of these flags depends on the platform and wxWindows configuration.}
352
9e9ee68e
VS
353\docparam{mimetype}{MIME type string (for example 'image/jpeg')}
354
1e6d9499
JS
355\wxheading{Return value}
356
357TRUE if the operation succeeded, FALSE otherwise.
358
359\wxheading{See also}
360
361\helpref{wxImage::SaveFile}{wximagesavefile}
362
f899db6d
RD
363\pythonnote{In place of a single overloaded method name, wxPython
364implements the following methods:\par
365\indented{2cm}{\begin{twocollist}
c9110876 366\twocolitem{{\bf LoadFile(filename, type)}}{Loads an image of the given
f899db6d 367type from a file}
c9110876 368\twocolitem{{\bf LoadMimeFile(filename, mimetype)}}{Loads an image of the given
f899db6d
RD
369mimetype from a file}
370\end{twocollist}}
371}
372
373
1e6d9499
JS
374\membersection{wxImage::Ok}\label{wximageok}
375
376\constfunc{bool}{Ok}{\void}
377
378Returns TRUE if image data is present.
379
380\membersection{wxImage::RemoveHandler}
381
382\func{static bool}{RemoveHandler}{\param{const wxString\& }{name}}
383
384Finds the handler with the given name, and removes it. The handler
385is not deleted.
386
387\docparam{name}{The handler name.}
388
389\wxheading{Return value}
390
391TRUE if the handler was found and removed, FALSE otherwise.
392
393\wxheading{See also}
394
395\helpref{wxImageHandler}{wximagehandler}
396
397\membersection{wxImage::SaveFile}\label{wximagesavefile}
398
399\func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}}
400
9e9ee68e
VS
401\func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}}
402
1e6d9499
JS
403Saves a image in the named file.
404
45b5751f
JS
405\func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}}
406
9e9ee68e
VS
407\func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{const wxString\&}{ mimetype}}
408
45b5751f
JS
409Saves a image in the given stream.
410
1e6d9499
JS
411\wxheading{Parameters}
412
413\docparam{name}{A filename. The meaning of {\it name} is determined by the {\it type} parameter.}
414
45b5751f
JS
415\docparam{stream}{An output stream. The meaning of {\it stream} is determined by the {\it type} parameter.}
416
48b4e302 417\docparam{type}{Currently two types can be used:
1e6d9499 418
6be663cf 419\twocolwidtha{5cm}%
1e6d9499 420\begin{twocollist}
f6fcbb63 421\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.}
48b4e302 422\twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Save a JPEG image file.}
1e6d9499
JS
423\end{twocollist}
424
12a44087
RR
425The validity of these flags depends on the platform and wxWindows configuration
426as well as user-added handlers.}
1e6d9499 427
9e9ee68e
VS
428\docparam{mimetype}{MIME type.}
429
1e6d9499
JS
430\wxheading{Return value}
431
432TRUE if the operation succeeded, FALSE otherwise.
433
434\wxheading{Remarks}
435
436Depending on how wxWindows has been configured, not all formats may be available.
437
438\wxheading{See also}
439
440\helpref{wxImage::LoadFile}{wximageloadfile}
441
f899db6d
RD
442\pythonnote{In place of a single overloaded method name, wxPython
443implements the following methods:\par
444\indented{2cm}{\begin{twocollist}
c9110876 445\twocolitem{{\bf SaveFile(filename, type)}}{Saves the image using the given
f899db6d 446type to the named file}
c9110876 447\twocolitem{{\bf SaveMimeFile(filename, mimetype)}}{Saves the image using the given
f899db6d
RD
448mimetype to the named file}
449\end{twocollist}}
450}
451
ce9a75d2
VZ
452\membersection{wxImage::Rescale}\label{wximagerescale}
453
6e807169 454\func{wxImage \&}{Rescale}{\param{int}{ width}, \param{int}{ height}}
ce9a75d2 455
9c884972
RR
456Changes the size of the image in-place: after a call to this function, the
457image will have the given width and height.
ce9a75d2 458
6e807169
VZ
459Returns the (modified) image itself.
460
ce9a75d2
VZ
461\wxheading{See also}
462
463\helpref{Scale}{wximagescale}
464
1e6d9499
JS
465\membersection{wxImage::Scale}\label{wximagescale}
466
ce9a75d2 467\constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}}
1e6d9499 468
12a44087
RR
469Returns a scaled version of the image. This is also useful for
470scaling bitmaps in general as the only other way to scale bitmaps
ce9a75d2
VZ
471is to blit a wxMemoryDC into another wxMemoryDC.
472
fc9c7c09
RR
473It may be mentioned that the GTK post uses this function internally
474to scale bitmaps when using mapping mode in wxDC.
ce9a75d2
VZ
475
476Example:
477
478\begin{verbatim}
479 // get the bitmap from somewhere
480 wxBitmap bmp = ...;
481
482 // rescale it to have size of 32*32
483 if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )
484 {
485 wxImage image(bmp);
486 bmp = image.Scale(32, 32).ConvertToBitmap();
487
488 // another possibility:
489 image.Rescale(32, 32);
490 bmp = image;
491 }
492
493\end{verbatim}
494
495\wxheading{See also}
496
497\helpref{Rescale}{wximagerescale}
1e6d9499
JS
498
499\membersection{wxImage::SetData}\label{wximagesetdata}
500
501\func{void}{SetData}{\param{unsigned char*}{data}}
502
f899db6d 503Sets the image data without performing checks. The data given must have
12a44087
RR
504the size (width*height*3) or results will be unexpected. Don't use this
505method if you aren't sure you know what you are doing.
1e6d9499
JS
506
507\membersection{wxImage::SetMask}\label{wximagesetmask}
508
509\func{void}{SetMask}{\param{bool}{ hasMask = TRUE}}
510
511Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.
512
513\membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour}
514
515\func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{blue}, \param{unsigned char }{green}}
516
b1170810 517Sets the mask colour for this image (and tells the image to use the mask).
1e6d9499
JS
518
519\membersection{wxImage::SetRGB}\label{wximagesetrgb}
520
521\func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{blue}, \param{unsigned char }{green}}
522
12a44087
RR
523Sets the pixel at the given coordinate. This routine performs bounds-checks
524for the coordinate so it can be considered a safe way to manipulate the
525data, but in some cases this might be too slow so that the data will have to
526be set directly. In that case you have to get that data by calling GetData().
1e6d9499
JS
527
528\membersection{wxImage::operator $=$}
529
530\func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}
531
532Assignment operator. This operator does not copy any data, but instead
533passes a pointer to the data in {\it image} and increments a reference
534counter. It is a fast operation.
535
536\wxheading{Parameters}
537
538\docparam{image}{Image to assign.}
539
540\wxheading{Return value}
541
542Returns 'this' object.
543
544\membersection{wxImage::operator $==$}
545
546\func{bool}{operator $==$}{\param{const wxImage\& }{image}}
547
548Equality operator. This operator tests whether the internal data pointers are
549equal (a fast test).
550
551\wxheading{Parameters}
552
553\docparam{image}{Image to compare with 'this'}
554
555\wxheading{Return value}
556
557Returns TRUE if the images were effectively equal, FALSE otherwise.
558
559\membersection{wxImage::operator $!=$}
560
561\func{bool}{operator $!=$}{\param{const wxImage\& }{image}}
562
563Inequality operator. This operator tests whether the internal data pointers are
564unequal (a fast test).
565
566\wxheading{Parameters}
567
568\docparam{image}{Image to compare with 'this'}
569
570\wxheading{Return value}
571
572Returns TRUE if the images were unequal, FALSE otherwise.
573
574\section{\class{wxImageHandler}}\label{wximagehandler}
575
1e6d9499
JS
576This is the base class for implementing image file loading/saving, and image creation from data.
577It is used within wxImage and is not normally seen by the application.
578
579If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
580and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your
581application initialisation.
582
48b4e302
VS
583\wxheading{Note (Legal Issue)}
584
954b8ae6 585This software is based in part on the work of the Independent JPEG Group.
48b4e302
VS
586
587(Applies when wxWindows is linked with JPEG support. wxJPEGHandler uses libjpeg
588created by IJG.)
589
1e6d9499
JS
590\wxheading{Derived from}
591
592\helpref{wxObject}{wxobject}
593
954b8ae6
JS
594\wxheading{Include files}
595
596<wx/image.h>
597
1e6d9499
JS
598\wxheading{See also}
599
600\helpref{wxImage}{wximage}
b5a4a47d 601\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
1e6d9499
JS
602
603\latexignore{\rtfignore{\wxheading{Members}}}
604
605\membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerconstr}
606
607\func{}{wxImageHandler}{\void}
608
609Default constructor. In your own default constructor, initialise the members
610m\_name, m\_extension and m\_type.
611
612\membersection{wxImageHandler::\destruct{wxImageHandler}}
613
614\func{}{\destruct{wxImageHandler}}{\void}
615
616Destroys the wxImageHandler object.
617
618\membersection{wxImageHandler::GetName}
619
620\constfunc{wxString}{GetName}{\void}
621
622Gets the name of this handler.
623
624\membersection{wxImageHandler::GetExtension}
625
626\constfunc{wxString}{GetExtension}{\void}
627
628Gets the file extension associated with this handler.
629
7941ba11
RR
630\membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount}
631
632\func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}
633
634If the image file contains more than one image and the image handler is capable
635of retrieving these individually, this function will return the number of
636available images.
637
638\docparam{stream}{Opened input stream for reading image file.}
639
640\wxheading{Return value}
641
642Number of available images. For most image handles, this defaults to 1.
643
1e6d9499
JS
644\membersection{wxImageHandler::GetType}
645
646\constfunc{long}{GetType}{\void}
647
648Gets the image type associated with this handler.
649
9e9ee68e
VS
650\membersection{wxImageHandler::GetMimeType}
651
652\constfunc{wxString}{GetMimeType}{\void}
653
654Gets the MIME type associated with this handler.
655
1e6d9499
JS
656\membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}
657
7941ba11 658\func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=TRUE}, \param{int}{ index=0}}
1e6d9499 659
7941ba11
RR
660Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains
661more than one image and the image handler is capable of retrieving these individually, {\it index}
662indicates which image to read from the stream.
1e6d9499
JS
663
664\wxheading{Parameters}
665
666\docparam{image}{The image object which is to be affected by this operation.}
667
7941ba11
RR
668\docparam{stream}{Opened input stream for reading images.}
669
670\docparam{verbose}{If set to TRUE, errors reported by the image handler will produce wxLogMessages.}
671
672\docparam{index}{The index of the image in the file (starting from zero).}
1e6d9499
JS
673
674\wxheading{Return value}
675
676TRUE if the operation succeeded, FALSE otherwise.
677
678\wxheading{See also}
679
680\helpref{wxImage::LoadFile}{wximageloadfile}\\
681\helpref{wxImage::SaveFile}{wximagesavefile}\\
682\helpref{wxImageHandler::SaveFile}{wximagehandlersavefile}
683
684\membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile}
685
45b5751f 686\func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}}
1e6d9499 687
45b5751f 688Saves a image in the output stream.
1e6d9499
JS
689
690\wxheading{Parameters}
691
692\docparam{image}{The image object which is to be affected by this operation.}
693
7941ba11 694\docparam{stream}{An opened stream for writing images.}
1e6d9499
JS
695
696\wxheading{Return value}
697
698TRUE if the operation succeeded, FALSE otherwise.
699
700\wxheading{See also}
701
702\helpref{wxImage::LoadFile}{wximageloadfile}\\
703\helpref{wxImage::SaveFile}{wximagesavefile}\\
704\helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile}
705
706\membersection{wxImageHandler::SetName}
707
708\func{void}{SetName}{\param{const wxString\& }{name}}
709
710Sets the handler name.
711
712\wxheading{Parameters}
713
714\docparam{name}{Handler name.}
715
716\membersection{wxImageHandler::SetExtension}
717
718\func{void}{SetExtension}{\param{const wxString\& }{extension}}
719
720Sets the handler extension.
721
722\wxheading{Parameters}
723
724\docparam{extension}{Handler extension.}
725
726\membersection{wxImageHandler::SetType}
727
728\func{void}{SetType}{\param{long }{type}}
729
730Sets the handler type.
731
732\wxheading{Parameters}
733
734\docparam{name}{Handler type.}
735
9e9ee68e
VS
736
737\membersection{wxImageHandler::SetMimeType}
738
739\func{void}{SetMimeType}{\param{const wxString\& }{mimetype}}
740
741Sets the handler MIME type.
742
743\wxheading{Parameters}
744
745\docparam{mimename}{Handler MIME type.}
746