]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/image.tex
Changed wxFileName::SetExt() as per the discussion, added
[wxWidgets.git] / docs / latex / wx / image.tex
... / ...
CommitLineData
1\section{\class{wxImage}}\label{wximage}
2
3This class encapsulates a platform-independent image. An image can be created
4from data, or using \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage}. 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 \helpref{wxDC}{wxdc}. Instead,
10a platform-specific \helpref{wxBitmap}{wxbitmap} object must be created from it using
11the \helpref{wxBitmap::wxBitmap(wxImage,int depth)}{wxbitmapctor} constructor.
12This bitmap can then
13be drawn in a device context, using \helpref{wxDC::DrawBitmap}{wxdcdrawbitmap}.
14
15One colour value of the image may be used as a mask colour which will lead to the automatic
16creation of a \helpref{wxMask}{wxmask} object associated to the bitmap object.
17
18\wxheading{Alpha channel support}
19
20Starting from wxWidgets 2.5.0 wxImage supports alpha channel data, that is in
21addition to a byte for the red, green and blue colour components for each pixel
22it also stores a byte representing the pixel opacity. An alpha value of $0$
23corresponds to a transparent pixel (null opacity) while a value of $255$
24means that the pixel is 100\% opaque.
25
26Unlike RGB data, not all images have an alpha channel and before using
27\helpref{GetAlpha}{wximagegetalpha} you should check if this image contains
28an alpha channel with \helpref{HasAlpha}{wximagehasalpha}. Note that currently only
29images loaded from PNG files with transparency information will have an alpha
30channel but alpha support will be added to the other formats as well (as well
31as support for saving images with alpha channel which also isn't implemented).
32
33\wxheading{Available image handlers}
34
35The following image handlers are available. {\bf wxBMPHandler} is always
36installed by default. To use other image formats, install the appropriate
37handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
38\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
39
40\twocolwidtha{5cm}%
41\begin{twocollist}
42\twocolitem{\indexit{wxBMPHandler}}{For loading and saving, always installed.}
43\twocolitem{\indexit{wxPNGHandler}}{For loading (including alpha support) and saving.}
44\twocolitem{\indexit{wxJPEGHandler}}{For loading and saving.}
45\twocolitem{\indexit{wxGIFHandler}}{Only for loading, due to legal issues.}
46\twocolitem{\indexit{wxPCXHandler}}{For loading and saving (see below).}
47\twocolitem{\indexit{wxPNMHandler}}{For loading and saving (see below).}
48\twocolitem{\indexit{wxTIFFHandler}}{For loading and saving.}
49\twocolitem{\indexit{wxIFFHandler}}{For loading only.}
50\twocolitem{\indexit{wxXPMHandler}}{For loading and saving.}
51\twocolitem{\indexit{wxICOHandler}}{For loading and saving.}
52\twocolitem{\indexit{wxCURHandler}}{For loading and saving.}
53\twocolitem{\indexit{wxANIHandler}}{For loading only.}
54\end{twocollist}
55
56When saving in PCX format, {\bf wxPCXHandler} will count the number of
57different colours in the image; if there are 256 or less colours, it will
58save as 8 bit, else it will save as 24 bit.
59
60Loading PNMs only works for ASCII or raw RGB images. When saving in
61PNM format, {\bf wxPNMHandler} will always save as raw RGB.
62
63\wxheading{Derived from}
64
65\helpref{wxObject}{wxobject}
66
67\wxheading{Include files}
68
69<wx/image.h>
70
71\wxheading{See also}
72
73\helpref{wxBitmap}{wxbitmap},
74\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
75
76\latexignore{\rtfignore{\wxheading{Members}}}
77
78
79\membersection{wxImage::wxImage}\label{wximagector}
80
81\func{}{wxImage}{\void}
82
83Default constructor.
84
85\func{}{wxImage}{\param{const wxImage\& }{image}}
86
87Copy constructor.
88
89\func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}}
90
91(Deprecated form, use \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage}
92instead.) Constructs an image from a platform-dependent bitmap. This preserves
93mask information so that bitmaps and images can be converted back
94and forth without loss in that respect.
95
96\func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{bool}{ clear=true}}
97
98Creates an image with the given width and height. If {\it clear} is true, the new image will be initialized to black.
99Otherwise, the image data will be uninitialized.
100
101\func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{unsigned char*}{ data}, \param{bool}{ static\_data=false}}
102
103Creates an image from given data with the given width and height. If
104{\it static\_data} is true, then wxImage will not delete the actual
105image data in its destructor, otherwise it will free it by calling
106{\it free()}.
107
108\func{}{wxImage}{\param{const wxString\& }{name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
109
110\func{}{wxImage}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
111
112Loads an image from a file.
113
114\func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
115
116\func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
117
118Loads an image from an input stream.
119
120\func{}{wxImage}{\param{const char** }{xpmData}}
121
122Creates an image from XPM data.
123
124\wxheading{Parameters}
125
126\docparam{width}{Specifies the width of the image.}
127
128\docparam{height}{Specifies the height of the image.}
129
130\docparam{name}{Name of the file from which to load the image.}
131
132\docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.}
133
134\docparam{type}{May be one of the following:
135
136\twocolwidtha{5cm}%
137\begin{twocollist}
138\twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
139\twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
140\twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.}
141\twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.}
142\twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
143\twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
144\twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
145\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
146\twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
147\twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
148\twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
149\twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
150\end{twocollist}}
151
152\docparam{mimetype}{MIME type string (for example 'image/jpeg')}
153
154\docparam{index}{Index of the image to load in the case that the image file contains multiple images.
155This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
156"choose the default image" and is interpreted as the first image (index=0) by
157the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
158
159\docparam{xpmData}{A pointer to XPM image data.}
160
161\wxheading{Remarks}
162
163Depending on how wxWidgets has been configured, not all formats may be available.
164
165Note: any handler other than BMP must be previously
166initialized with \helpref{wxImage::AddHandler}{wximageaddhandler} or
167\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
168
169Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
170hotspot for loaded cursor file:
171\begin{verbatim}
172 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
173 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
174
175\end{verbatim}
176
177\wxheading{See also}
178
179\helpref{wxImage::LoadFile}{wximageloadfile}
180
181\pythonnote{Constructors supported by wxPython are:\par
182\indented{2cm}{\begin{twocollist}
183\twocolitem{{\bf wxImage(name, flag)}}{Loads an image from a file}
184\twocolitem{{\bf wxNullImage()}}{Create a null image (has no size or
185image data)}
186\twocolitem{{\bf wxEmptyImage(width, height)}}{Creates an empty image
187of the given size}
188\twocolitem{{\bf wxImageFromMime(name, mimetype}}{Creates an image from
189the given file of the given mimetype}
190\twocolitem{{\bf wxImageFromBitmap(bitmap)}}{Creates an image from a
191platform-dependent bitmap}
192\end{twocollist}}
193}
194
195\perlnote{Constructors supported by wxPerl are:\par
196\begin{itemize}
197\item{Wx::Image->new( bitmap )}
198\item{Wx::Image->new( icon )}
199\item{Wx::Image->new( width, height )}
200\item{Wx::Image->new( width, height, data )}
201\item{Wx::Image->new( file, type, index )}
202\item{Wx::Image->new( file, mimetype, index )}
203\item{Wx::Image->new( stream, type, index )}
204\item{Wx::Image->new( stream, mimetype, index )}
205\end{itemize}
206}
207
208
209\membersection{wxImage::\destruct{wxImage}}\label{wximagedtor}
210
211\func{}{\destruct{wxImage}}{\void}
212
213Destructor.
214
215
216\membersection{wxImage::AddHandler}\label{wximageaddhandler}
217
218\func{static void}{AddHandler}{\param{wxImageHandler*}{ handler}}
219
220Adds a handler to the end of the static list of format handlers.
221
222\docparam{handler}{A new image format handler object. There is usually only one instance
223of a given handler class in an application session.}
224
225\wxheading{See also}
226
227\helpref{wxImageHandler}{wximagehandler}
228
229\func{bool}{CanRead}{\param{const wxString\&}{ filename}}
230
231returns true if the current image handlers can read this file
232
233\pythonnote{In wxPython this static method is named {\tt wxImage\_AddHandler}.}
234
235\membersection{wxImage::CleanUpHandlers}\label{wximagecleanuphandlers}
236
237\func{static void}{CleanUpHandlers}{\void}
238
239Deletes all image handlers.
240
241This function is called by wxWidgets on exit.
242
243
244\membersection{wxImage::ComputeHistogram}\label{wximagecomputehistogram}
245
246\constfunc{unsigned long}{ComputeHistogram}{\param{wxImageHistogram\& }{histogram}}
247
248Computes the histogram of the image. {\it histogram} is a reference to
249wxImageHistogram object. wxImageHistogram is a specialization of
250\helpref{wxHashMap}{wxhashmap} "template" and is defined as follows:
251
252\begin{verbatim}
253class WXDLLEXPORT wxImageHistogramEntry
254{
255public:
256 wxImageHistogramEntry() : index(0), value(0) {}
257 unsigned long index;
258 unsigned long value;
259};
260
261WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry,
262 wxIntegerHash, wxIntegerEqual,
263 wxImageHistogram);
264\end{verbatim}
265
266\wxheading{Return value}
267
268Returns number of colours in the histogram.
269
270
271\membersection{wxImage::ConvertAlphaToMask}\label{wximageconvertalphatomask}
272
273\func{bool}{ConvertAlphaToMask}{\param{unsigned char}{ threshold = 128}}
274
275If the image has alpha channel, this method converts it to mask. All pixels
276with alpha value less than \arg{threshold} are replaced with mask colour
277and the alpha channel is removed. Mask colour is chosen automatically using
278\helpref{FindFirstUnusedColour}{wximagefindfirstunusedcolour}.
279
280If the image image doesn't have alpha channel,
281ConvertAlphaToMask does nothing.
282
283\wxheading{Return value}
284
285\false if FindFirstUnusedColour returns \false, \true otherwise.
286
287
288\membersection{wxImage::ConvertToBitmap}\label{wximageconverttobitmap}
289
290\constfunc{wxBitmap}{ConvertToBitmap}{\void}
291
292Deprecated, use equivalent \helpref{wxBitmap constructor}{wxbitmapctor}
293(which takes wxImage and depth as its arguments) instead.
294
295
296\membersection{wxImage::ConvertToMono}\label{wxbitmapconverttomono}
297
298\constfunc{wxImage}{ConvertToMono}{\param{unsigned char}{ r}, \param{unsigned char}{ g}, \param{unsigned char}{ b}}
299
300Returns monochromatic version of the image. The returned image has white
301colour where the original has {\it (r,g,b)} colour and black colour
302everywhere else.
303
304
305\membersection{wxImage::Copy}\label{wximagecopy}
306
307\constfunc{wxImage}{Copy}{\void}
308
309Returns an identical copy of the image.
310
311
312\membersection{wxImage::Create}\label{wximagecreate}
313
314\func{bool}{Create}{\param{int}{ width}, \param{int}{ height}, \param{bool}{ clear=true}}
315
316Creates a fresh image. If {\it clear} is true, the new image will be initialized to black.
317Otherwise, the image data will be uninitialized.
318
319\wxheading{Parameters}
320
321\docparam{width}{The width of the image in pixels.}
322
323\docparam{height}{The height of the image in pixels.}
324
325\wxheading{Return value}
326
327true if the call succeeded, false otherwise.
328
329
330\membersection{wxImage::Destroy}\label{wximagedestroy}
331
332\func{void}{Destroy}{\void}
333
334Destroys the image data.
335
336
337\membersection{wxImage::FindFirstUnusedColour}\label{wximagefindfirstunusedcolour}
338
339\func{bool}{FindFirstUnusedColour}{\param{unsigned char *}{ r}, \param{unsigned char *}{ g}, \param{unsigned char *}{ b}, \param{unsigned char}{ startR = 1}, \param{unsigned char}{ startG = 0}, \param{unsigned char}{ startB = 0}}
340
341\wxheading{Parameters}
342
343\docparam{r,g,b}{Pointers to variables to save the colour.}
344
345\docparam{startR,startG,startB}{Initial values of the colour. Returned colour
346will have RGB values equal to or greater than these.}
347
348Finds the first colour that is never used in the image. The search begins at
349given initial colour and continues by increasing R, G and B components (in this
350order) by 1 until an unused colour is found or the colour space exhausted.
351
352\wxheading{Return value}
353
354Returns false if there is no unused colour left, true on success.
355
356\wxheading{Notes}
357
358Note that this method involves computing the histogram, which is
359computationally intensive operation.
360
361
362\membersection{wxImage::FindHandler}\label{wximagefindhandler}
363
364\func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{name}}
365
366Finds the handler with the given name.
367
368\func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ imageType}}
369
370Finds the handler associated with the given extension and type.
371
372\func{static wxImageHandler*}{FindHandler}{\param{long }{imageType}}
373
374Finds the handler associated with the given image type.
375
376\func{static wxImageHandler*}{FindHandlerMime}{\param{const wxString\& }{mimetype}}
377
378Finds the handler associated with the given MIME type.
379
380\docparam{name}{The handler name.}
381
382\docparam{extension}{The file extension, such as ``bmp".}
383
384\docparam{imageType}{The image type, such as wxBITMAP\_TYPE\_BMP.}
385
386\docparam{mimetype}{MIME type.}
387
388\wxheading{Return value}
389
390A pointer to the handler if found, NULL otherwise.
391
392\wxheading{See also}
393
394\helpref{wxImageHandler}{wximagehandler}
395
396
397\membersection{wxImage::GetImageExtWildcard}\label{wximagegetimageextwildcard}
398
399\func{static wxString}{GetImageExtWildcard}{\void}
400
401Iterates all registered wxImageHandler objects, and returns a string containing file extension masks
402suitable for passing to file open/save dialog boxes.
403
404\wxheading{Return value}
405
406The format of the returned string is "(*.ext1;*.ext2)|*.ext1;*.ext2".
407
408It is usually a good idea to prepend a description before passing the result to the dialog.
409
410Example:
411
412\begin{verbatim}
413 wxFileDialog FileDlg( this, "Choose Image", ::wxGetWorkingDirectory(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
414\end{verbatim}
415
416\wxheading{See also}
417
418\helpref{wxImageHandler}{wximagehandler}
419
420
421\membersection{wxImage::GetAlpha}\label{wximagegetalpha}
422
423\constfunc{unsigned char}{GetAlpha}{\param{int}{ x}, \param{int}{ y}}
424
425Returns the alpha value for the given pixel. This function may only be called
426for the images with alpha channel, use \helpref{HasAlpha}{wximagehasalpha} to
427check for this.
428
429The returned value is the {\it opacity} of the image, i.e. the value of $0$
430corresponds to the transparent pixels while the value of $255$ -- to the opaque
431ones.
432
433\constfunc{unsigned char *}{GetAlpha}{\void}
434
435Returns pointer to the array storing the alpha values for this image. This
436pointer is {\tt NULL} for the images without the alpha channel. If the image
437does have it, this pointer may be used to directly manipulate the alpha values
438which are stored as the \helpref{RGB}{wximagegetdata} ones.
439
440
441\membersection{wxImage::GetBlue}\label{wximagegetblue}
442
443\constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}}
444
445Returns the blue intensity at the given coordinate.
446
447
448\membersection{wxImage::GetData}\label{wximagegetdata}
449
450\constfunc{unsigned char*}{GetData}{\void}
451
452Returns the image data as an array. This is most often used when doing
453direct image manipulation. The return value points to an array of
454characters in RGBRGBRGB$\ldots$ format in the top-to-bottom, left-to-right
455order, that is the first RGB triplet corresponds to the pixel first pixel of
456the first row, the second one --- to the second pixel of the first row and so
457on until the end of the first row, with second row following after it and so
458on.
459
460You should not delete the returned pointer nor pass it to
461\helpref{wxImage::SetData}{wximagesetdata}.
462
463
464\membersection{wxImage::GetGreen}\label{wximagegetgreen}
465
466\constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}}
467
468Returns the green intensity at the given coordinate.
469
470
471\membersection{wxImage::GetImageCount}\label{wximagegetimagecount}
472
473\func{static int}{GetImageCount}{\param{const wxString\&}{ filename}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
474
475\func{static int}{GetImageCount}{\param{wxInputStream\&}{ stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}}
476
477If the image file contains more than one image and the image handler is capable
478of retrieving these individually, this function will return the number of
479available images.
480
481\docparam{name}{Name of the file to query.}
482
483\docparam{stream}{Opened input stream with image data. Currently, the stream must support seeking.}
484
485\docparam{type}{May be one of the following:
486
487\twocolwidtha{5cm}%
488\begin{twocollist}
489\twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.}
490\twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.}
491\twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.}
492\twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.}
493\twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
494\twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
495\twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
496\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
497\twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
498\twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
499\twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
500\twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
501\end{twocollist}}
502
503\wxheading{Return value}
504
505Number of available images. For most image handlers, this is 1 (exceptions
506are TIFF and ICO formats).
507
508
509\membersection{wxImage::GetHandlers}\label{wximagegethandlers}
510
511\func{static wxList\&}{GetHandlers}{\void}
512
513Returns the static list of image format handlers.
514
515\wxheading{See also}
516
517\helpref{wxImageHandler}{wximagehandler}
518
519
520\membersection{wxImage::GetHeight}\label{wximagegetheight}
521
522\constfunc{int}{GetHeight}{\void}
523
524Gets the height of the image in pixels.
525
526
527\membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue}
528
529\constfunc{unsigned char}{GetMaskBlue}{\void}
530
531Gets the blue value of the mask colour.
532
533
534\membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen}
535
536\constfunc{unsigned char}{GetMaskGreen}{\void}
537
538Gets the green value of the mask colour.
539
540
541\membersection{wxImage::GetMaskRed}\label{wximagegetmaskred}
542
543\constfunc{unsigned char}{GetMaskRed}{\void}
544
545Gets the red value of the mask colour.
546
547
548\membersection{wxImage::GetPalette}\label{wximagegetpalette}
549
550\constfunc{const wxPalette\&}{GetPalette}{\void}
551
552Returns the palette associated with the image. Currently the palette is only
553used when converting to wxBitmap under Windows.
554
555Eventually wxImage handlers will set the palette if one exists in the image file.
556
557
558\membersection{wxImage::GetRed}\label{wximagegetred}
559
560\constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}}
561
562Returns the red intensity at the given coordinate.
563
564
565\membersection{wxImage::GetSubImage}\label{wximagegetsubimage}
566
567\constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{ rect}}
568
569Returns a sub image of the current one as long as the rect belongs entirely to
570the image.
571
572
573\membersection{wxImage::GetWidth}\label{wximagegetwidth}
574
575\constfunc{int}{GetWidth}{\void}
576
577Gets the width of the image in pixels.
578
579\wxheading{See also}
580
581\helpref{wxImage::GetHeight}{wximagegetheight}
582
583
584\membersection{wxImage::HasAlpha}\label{wximagehasalpha}
585
586\constfunc{bool}{HasAlpha}{\void}
587
588Returns true if this image has alpha channel, false otherwise.
589
590\wxheading{See also}
591
592\helpref{GetAlpha}{wximagegetalpha}, \helpref{SetAlpha}{wximagesetalpha}
593
594
595\membersection{wxImage::HasMask}\label{wximagehasmask}
596
597\constfunc{bool}{HasMask}{\void}
598
599Returns true if there is a mask active, false otherwise.
600
601
602\membersection{wxImage::GetOption}\label{wximagegetoption}
603
604\constfunc{wxString}{GetOption}{\param{const wxString\&}{ name}}
605
606Gets a user-defined option. The function is case-insensitive to {\it name}.
607
608For example, when saving as a JPEG file, the option {\bf quality} is
609used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
610
611\wxheading{See also}
612
613\helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
614\helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
615\helpref{wxImage::HasOption}{wximagehasoption}
616
617
618\membersection{wxImage::GetOptionInt}\label{wximagegetoptionint}
619
620\constfunc{int}{GetOptionInt}{\param{const wxString\&}{ name}}
621
622Gets a user-defined option as an integer. The function is case-insensitive to {\it name}.
623
624If the given option is not present, the function returns $0$. Use
625\helpref{wxImage::HasOption}{wximagehasoption} is $0$ is a possibly valid value
626for the option.
627
628Options for wxPNGHandler
629\twocolwidtha{5cm}%
630\begin{twocollist}
631\twocolitem{wxIMAGE\_OPTION\_PNG\_FORMAT}{Format for saving a PNG file.}
632\twocolitem{wxIMAGE\_OPTION\_PNG\_BITDEPTH}{Bit depth for every channel (R/G/B/A).}
633\end{twocollist}
634
635Supported values for wxIMAGE\_OPTION\_PNG\_FORMAT:
636\twocolwidtha{5cm}%
637\begin{twocollist}
638\twocolitem{wxPNG\_TYPE\_COLOUR}{Stores RGB image.}
639\twocolitem{wxPNG\_TYPE\_GREY}{Stores grey image, converts from RGB.}
640\twocolitem{wxPNG\_TYPE\_GREY\_RED}{Stores grey image, uses red value as grey.}
641\end{twocollist}
642
643
644\wxheading{See also}
645
646\helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
647\helpref{wxImage::GetOption}{wximagegetoption}
648
649
650\membersection{wxImage::HasOption}\label{wximagehasoption}
651
652\constfunc{bool}{HasOption}{\param{const wxString\&}{ name}}
653
654Returns true if the given option is present. The function is case-insensitive to {\it name}.
655
656\wxheading{See also}
657
658\helpref{wxImage::SetOption}{wximagesetoption},\rtfsp
659\helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
660\helpref{wxImage::GetOptionInt}{wximagegetoptionint}
661
662
663\membersection{wxImage::InitAlpha}\label{wximageinitalpha}
664
665\func{void}{InitAlpha}{\void}
666
667Initializes the image alpha channel data. It is an error to call it
668if the image already has alpha data. If it doesn't, alpha data will be
669by default initialized to all pixels being fully opaque. But if the image has a
670a mask colour, all mask pixels will be completely transparent.
671
672
673\membersection{wxImage::InitStandardHandlers}\label{wximageinitstandardhandlers}
674
675\func{static void}{InitStandardHandlers}{\void}
676
677Internal use only. Adds standard image format handlers. It only install BMP
678for the time being, which is used by wxBitmap.
679
680This function is called by wxWidgets on startup, and shouldn't be called by
681the user.
682
683\wxheading{See also}
684
685\helpref{wxImageHandler}{wximagehandler},
686\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
687
688
689\membersection{wxImage::InsertHandler}\label{wximageinserthandler}
690
691\func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}}
692
693Adds a handler at the start of the static list of format handlers.
694
695\docparam{handler}{A new image format handler object. There is usually only one instance
696of a given handler class in an application session.}
697
698\wxheading{See also}
699
700\helpref{wxImageHandler}{wximagehandler}
701
702
703\membersection{wxImage::LoadFile}\label{wximageloadfile}
704
705\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}}
706
707\func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
708
709Loads an image from a file. If no handler type is provided, the library will
710try to autodetect the format.
711
712\func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}, \param{int}{ index = -1}}
713
714\func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}}
715
716Loads an image from an input stream.
717
718\wxheading{Parameters}
719
720\docparam{name}{Name of the file from which to load the image.}
721
722\docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.}
723
724\docparam{type}{One of the following values:
725
726\twocolwidtha{5cm}%
727\begin{twocollist}
728\twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.}
729\twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.}
730\twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.}
731\twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.}
732\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.}
733\twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.}
734\twocolitem{{\bf wxBITMAP\_TYPE\_TIF}}{Load a TIFF image file.}
735\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.}
736\twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
737\twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
738\twocolitem{\indexit{wxBITMAP\_TYPE\_ANI}}{Load a Windows animated cursor file (ANI).}
739\twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
740\end{twocollist}}
741
742\docparam{mimetype}{MIME type string (for example 'image/jpeg')}
743
744\docparam{index}{Index of the image to load in the case that the image file contains multiple images.
745This is only used by GIF, ICO and TIFF handlers. The default value (-1) means
746"choose the default image" and is interpreted as the first image (index=0) by
747the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.}
748
749\wxheading{Remarks}
750
751Depending on how wxWidgets has been configured, not all formats may be available.
752
753Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the
754hotspot for loaded cursor file:
755\begin{verbatim}
756 int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
757 int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
758
759\end{verbatim}
760
761\wxheading{Return value}
762
763true if the operation succeeded, false otherwise. If the optional index parameter is out of range,
764false is returned and a call to wxLogError() takes place.
765
766\wxheading{See also}
767
768\helpref{wxImage::SaveFile}{wximagesavefile}
769
770\pythonnote{In place of a single overloaded method name, wxPython
771implements the following methods:\par
772\indented{2cm}{\begin{twocollist}
773\twocolitem{{\bf LoadFile(filename, type)}}{Loads an image of the given
774type from a file}
775\twocolitem{{\bf LoadMimeFile(filename, mimetype)}}{Loads an image of the given
776mimetype from a file}
777\end{twocollist}}
778}
779
780\perlnote{Methods supported by wxPerl are:\par
781\begin{itemize}
782\item{bitmap->LoadFile( name, type )}
783\item{bitmap->LoadFile( name, mimetype )}
784\end{itemize}
785}
786
787
788
789\membersection{wxImage::Ok}\label{wximageok}
790
791\constfunc{bool}{Ok}{\void}
792
793Returns true if image data is present.
794
795
796\membersection{wxImage::RemoveHandler}\label{wximageremovehandler}
797
798\func{static bool}{RemoveHandler}{\param{const wxString\& }{name}}
799
800Finds the handler with the given name, and removes it. The handler
801is not deleted.
802
803\docparam{name}{The handler name.}
804
805\wxheading{Return value}
806
807true if the handler was found and removed, false otherwise.
808
809\wxheading{See also}
810
811\helpref{wxImageHandler}{wximagehandler}
812
813
814\membersection{wxImage::Mirror}\label{wximagemirror}
815
816\constfunc{wxImage}{Mirror}{\param{bool}{ horizontally = true}}
817
818Returns a mirrored copy of the image. The parameter {\it horizontally}
819indicates the orientation.
820
821
822\membersection{wxImage::Replace}\label{wximagereplace}
823
824\func{void}{Replace}{\param{unsigned char}{ r1}, \param{unsigned char}{ g1}, \param{unsigned char}{ b1},
825\param{unsigned char}{ r2}, \param{unsigned char}{ g2}, \param{unsigned char}{ b2}}
826
827Replaces the colour specified by {\it r1,g1,b1} by the colour {\it r2,g2,b2}.
828
829
830\membersection{wxImage::Rescale}\label{wximagerescale}
831
832\func{wxImage \&}{Rescale}{\param{int}{ width}, \param{int}{ height}}
833
834Changes the size of the image in-place: after a call to this function, the
835image will have the given width and height.
836
837Returns the (modified) image itself.
838
839\wxheading{See also}
840
841\helpref{Scale}{wximagescale}
842
843
844\membersection{wxImage::Rotate}\label{wximagerotate}
845
846\func{wxImage}{Rotate}{\param{double}{ angle}, \param{const wxPoint\& }{rotationCentre},
847 \param{bool}{ interpolating = true}, \param{wxPoint*}{ offsetAfterRotation = NULL}}
848
849Rotates the image about the given point, by {\it angle} radians. Passing true
850to {\it interpolating} results in better image quality, but is slower. If the
851image has a mask, then the mask colour is used for the uncovered pixels in the
852rotated image background. Else, black (rgb 0, 0, 0) will be used.
853
854Returns the rotated image, leaving this image intact.
855
856
857\membersection{wxImage::Rotate90}\label{wximagerotate90}
858
859\constfunc{wxImage}{Rotate90}{\param{bool}{ clockwise = true}}
860
861Returns a copy of the image rotated 90 degrees in the direction
862indicated by {\it clockwise}.
863
864
865\membersection{wxImage::SaveFile}\label{wximagesavefile}
866
867\constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}}
868
869\constfunc{bool}{SaveFile}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}}
870
871Saves an image in the named file.
872
873\constfunc{bool}{SaveFile}{\param{const wxString\& }{name}}
874
875Saves an image in the named file. File type is determined from the extension of the
876file name. Note that this function may fail if the extension is not recognized! You
877can use one of the forms above to save images to files with non-standard extensions.
878
879\constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}}
880
881\constfunc{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{const wxString\&}{ mimetype}}
882
883Saves an image in the given stream.
884
885\wxheading{Parameters}
886
887\docparam{name}{Name of the file to save the image to.}
888
889\docparam{stream}{Opened output stream to save the image to.}
890
891\docparam{type}{Currently these types can be used:
892
893\twocolwidtha{5cm}%
894\begin{twocollist}
895\twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Save a BMP image file.}
896\twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Save a JPEG image file.}
897\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.}
898\twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).}
899\twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).}
900\twocolitem{{\bf wxBITMAP\_TYPE\_TIFF}}{Save a TIFF image file.}
901\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save a XPM image file.}
902\twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Save a Windows icon file (ICO) (the size may be up to 255 wide by 127 high. A single image is saved in 8 colors at the size supplied).}
903\twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Save a Windows cursor file (CUR).}
904\end{twocollist}}
905
906\docparam{mimetype}{MIME type.}
907
908\wxheading{Return value}
909
910true if the operation succeeded, false otherwise.
911
912\wxheading{Remarks}
913
914Depending on how wxWidgets has been configured, not all formats may be available.
915
916Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to set the
917hotspot before saving an image into a cursor file (default hotspot is in
918the centre of the image):
919\begin{verbatim}
920 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotspotX);
921 image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotspotY);
922
923\end{verbatim}
924
925\wxheading{See also}
926
927\helpref{wxImage::LoadFile}{wximageloadfile}
928
929\pythonnote{In place of a single overloaded method name, wxPython
930implements the following methods:\par
931\indented{2cm}{\begin{twocollist}
932\twocolitem{{\bf SaveFile(filename, type)}}{Saves the image using the given
933type to the named file}
934\twocolitem{{\bf SaveMimeFile(filename, mimetype)}}{Saves the image using the given
935mimetype to the named file}
936\end{twocollist}}
937}
938
939\perlnote{Methods supported by wxPerl are:\par
940\begin{itemize}
941\item{bitmap->SaveFile( name, type )}
942\item{bitmap->SaveFile( name, mimetype )}
943\end{itemize}
944}
945
946
947\membersection{wxImage::Scale}\label{wximagescale}
948
949\constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}}
950
951Returns a scaled version of the image. This is also useful for
952scaling bitmaps in general as the only other way to scale bitmaps
953is to blit a wxMemoryDC into another wxMemoryDC.
954
955It may be mentioned that the GTK port uses this function internally
956to scale bitmaps when using mapping modes in wxDC.
957
958Example:
959
960\begin{verbatim}
961 // get the bitmap from somewhere
962 wxBitmap bmp = ...;
963
964 // rescale it to have size of 32*32
965 if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )
966 {
967 wxImage image = bmp.ConvertToImage();
968 bmp = wxBitmap(image.Scale(32, 32));
969
970 // another possibility:
971 image.Rescale(32, 32);
972 bmp = image;
973 }
974
975\end{verbatim}
976
977\wxheading{See also}
978
979\helpref{Rescale}{wximagerescale}
980
981
982\membersection{wxImage::SetAlpha}\label{wximagesetalpha}
983
984\func{void}{SetAlpha}{\param{unsigned char *}{alpha = {\tt NULL}}}
985
986This function is similar to \helpref{SetData}{wximagesetdata} and has similar
987restrictions. The pointer passed to it may however be {\tt NULL} in which case
988the function will allocate the alpha array internally -- this is useful to add
989alpha channel data to an image which doesn't have any. If the pointer is not
990{\tt NULL}, it must have one byte for each image pixel and be allocated with
991{\tt malloc()}. wxImage takes ownership of the pointer and will free it.
992
993\func{void}{SetAlpha}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{alpha}}
994
995Sets the alpha value for the given pixel. This function should only be called
996if the image has alpha channel data, use \helpref{HasAlpha}{wximagehasalpha} to
997check for this.
998
999
1000\membersection{wxImage::SetData}\label{wximagesetdata}
1001
1002\func{void}{SetData}{\param{unsigned char*}{data}}
1003
1004Sets the image data without performing checks. The data given must have
1005the size (width*height*3) or results will be unexpected. Don't use this
1006method if you aren't sure you know what you are doing.
1007
1008The data must have been allocated with {\tt malloc()}, {\large {\bf NOT}} with
1009{\tt operator new}.
1010
1011After this call the pointer to the data is owned by the wxImage object,
1012that will be responsible for deleting it.
1013Do not pass to this function a pointer obtained through
1014\helpref{wxImage::GetData}{wximagegetdata}.
1015
1016
1017\membersection{wxImage::SetMask}\label{wximagesetmask}
1018
1019\func{void}{SetMask}{\param{bool}{ hasMask = true}}
1020
1021Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.
1022
1023
1024\membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour}
1025
1026\func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1027
1028Sets the mask colour for this image (and tells the image to use the mask).
1029
1030
1031\membersection{wxImage::SetMaskFromImage}\label{wximagesetmaskfromimage}
1032
1033\func{bool}{SetMaskFromImage}{\param{const wxImage\&}{ mask}, \param{unsigned char}{ mr}, \param{unsigned char}{ mg}, \param{unsigned char}{ mb}}
1034
1035\wxheading{Parameters}
1036
1037\docparam{mask}{The mask image to extract mask shape from. Must have same dimensions as the image.}
1038
1039\docparam{mr,mg,mb}{RGB value of pixels in {\it mask} that will be used to create the mask.}
1040
1041Sets image's mask so that the pixels that have RGB value of {\it mr,mg,mb}
1042in {\it mask} will be masked in the image. This is done by first finding an
1043unused colour in the image, setting this colour as the mask colour and then
1044using this colour to draw all pixels in the image who corresponding pixel
1045in {\it mask} has given RGB value.
1046
1047\wxheading{Return value}
1048
1049Returns false if {\it mask} does not have same dimensions as the image or if
1050there is no unused colour left. Returns true if the mask was successfully
1051applied.
1052
1053\wxheading{Notes}
1054
1055Note that this method involves computing the histogram, which is
1056computationally intensive operation.
1057
1058
1059\membersection{wxImage::SetOption}\label{wximagesetoption}
1060
1061\func{void}{SetOption}{\param{const wxString\&}{ name}, \param{const wxString\&}{ value}}
1062
1063\func{void}{SetOption}{\param{const wxString\&}{ name}, \param{int}{ value}}
1064
1065Sets a user-defined option. The function is case-insensitive to {\it name}.
1066
1067For example, when saving as a JPEG file, the option {\bf quality} is
1068used, which is a number between 0 and 100 (0 is terrible, 100 is very good).
1069
1070\wxheading{See also}
1071
1072\helpref{wxImage::GetOption}{wximagegetoption},\rtfsp
1073\helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp
1074\helpref{wxImage::HasOption}{wximagehasoption}
1075
1076
1077\membersection{wxImage::SetPalette}\label{wximagesetpalette}
1078
1079\func{void}{SetPalette}{\param{const wxPalette\&}{ palette}}
1080
1081Associates a palette with the image. The palette may be used when converting
1082wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet).
1083
1084
1085\membersection{wxImage::SetRGB}\label{wximagesetrgb}
1086
1087\func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}}
1088
1089Sets the pixel at the given coordinate. This routine performs bounds-checks
1090for the coordinate so it can be considered a safe way to manipulate the
1091data, but in some cases this might be too slow so that the data will have to
1092be set directly. In that case you will have to get access to the image data
1093using the \helpref{GetData}{wximagegetdata} method.
1094
1095
1096\membersection{wxImage::operator $=$}\label{wximageassign}
1097
1098\func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}
1099
1100Assignment operator. This operator does not copy any data, but instead
1101passes a pointer to the data in {\it image} and increments a reference
1102counter. It is a fast operation.
1103
1104\wxheading{Parameters}
1105
1106\docparam{image}{Image to assign.}
1107
1108\wxheading{Return value}
1109
1110Returns 'this' object.
1111
1112
1113\membersection{wxImage::operator $==$}\label{wximageequal}
1114
1115\constfunc{bool}{operator $==$}{\param{const wxImage\& }{image}}
1116
1117Equality operator. This operator tests whether the internal data pointers are
1118equal (a fast test).
1119
1120\wxheading{Parameters}
1121
1122\docparam{image}{Image to compare with 'this'}
1123
1124\wxheading{Return value}
1125
1126Returns true if the images were effectively equal, false otherwise.
1127
1128
1129\membersection{wxImage::operator $!=$}\label{wximagenotequal}
1130
1131\constfunc{bool}{operator $!=$}{\param{const wxImage\& }{image}}
1132
1133Inequality operator. This operator tests whether the internal data pointers are
1134unequal (a fast test).
1135
1136\wxheading{Parameters}
1137
1138\docparam{image}{Image to compare with 'this'}
1139
1140\wxheading{Return value}
1141
1142Returns true if the images were unequal, false otherwise.
1143
1144\section{\class{wxImageHandler}}\label{wximagehandler}
1145
1146This is the base class for implementing image file loading/saving, and image creation from data.
1147It is used within wxImage and is not normally seen by the application.
1148
1149If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler
1150and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your
1151application initialisation.
1152
1153\wxheading{Note (Legal Issue)}
1154
1155This software is based in part on the work of the Independent JPEG Group.
1156
1157(Applies when wxWidgets is linked with JPEG support. wxJPEGHandler uses libjpeg
1158created by IJG.)
1159
1160\wxheading{Derived from}
1161
1162\helpref{wxObject}{wxobject}
1163
1164\wxheading{Include files}
1165
1166<wx/image.h>
1167
1168\wxheading{See also}
1169
1170\helpref{wxImage}{wximage},
1171\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
1172
1173\latexignore{\rtfignore{\wxheading{Members}}}
1174
1175
1176\membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerctor}
1177
1178\func{}{wxImageHandler}{\void}
1179
1180Default constructor. In your own default constructor, initialise the members
1181m\_name, m\_extension and m\_type.
1182
1183
1184\membersection{wxImageHandler::\destruct{wxImageHandler}}\label{wximagehandlerdtor}
1185
1186\func{}{\destruct{wxImageHandler}}{\void}
1187
1188Destroys the wxImageHandler object.
1189
1190
1191\membersection{wxImageHandler::GetName}\label{wximagehandlergetname}
1192
1193\constfunc{wxString}{GetName}{\void}
1194
1195Gets the name of this handler.
1196
1197
1198\membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}
1199
1200\constfunc{wxString}{GetExtension}{\void}
1201
1202Gets the file extension associated with this handler.
1203
1204
1205\membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount}
1206
1207\func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}}
1208
1209If the image file contains more than one image and the image handler is capable
1210of retrieving these individually, this function will return the number of
1211available images.
1212
1213\docparam{stream}{Opened input stream for reading image data. Currently, the stream must support seeking.}
1214
1215\wxheading{Return value}
1216
1217Number of available images. For most image handlers, this is 1 (exceptions
1218are TIFF and ICO formats).
1219
1220
1221\membersection{wxImageHandler::GetType}\label{wximagehandlergettype}
1222
1223\constfunc{long}{GetType}{\void}
1224
1225Gets the image type associated with this handler.
1226
1227
1228\membersection{wxImageHandler::GetMimeType}\label{wximagehandlergetmimetype}
1229
1230\constfunc{wxString}{GetMimeType}{\void}
1231
1232Gets the MIME type associated with this handler.
1233
1234
1235\membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile}
1236
1237\func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=true}, \param{int}{ index=0}}
1238
1239Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains
1240more than one image and the image handler is capable of retrieving these individually, {\it index}
1241indicates which image to read from the stream.
1242
1243\wxheading{Parameters}
1244
1245\docparam{image}{The image object which is to be affected by this operation.}
1246
1247\docparam{stream}{Opened input stream for reading image data.}
1248
1249\docparam{verbose}{If set to true, errors reported by the image handler will produce wxLogMessages.}
1250
1251\docparam{index}{The index of the image in the file (starting from zero).}
1252
1253\wxheading{Return value}
1254
1255true if the operation succeeded, false otherwise.
1256
1257\wxheading{See also}
1258
1259\helpref{wxImage::LoadFile}{wximageloadfile},
1260\helpref{wxImage::SaveFile}{wximagesavefile},
1261\helpref{wxImageHandler::SaveFile}{wximagehandlersavefile}
1262
1263
1264\membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile}
1265
1266\func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}}
1267
1268Saves a image in the output stream.
1269
1270\wxheading{Parameters}
1271
1272\docparam{image}{The image object which is to be affected by this operation.}
1273
1274\docparam{stream}{Opened output stream for writing the data.}
1275
1276\wxheading{Return value}
1277
1278true if the operation succeeded, false otherwise.
1279
1280\wxheading{See also}
1281
1282\helpref{wxImage::LoadFile}{wximageloadfile},
1283\helpref{wxImage::SaveFile}{wximagesavefile},
1284\helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile}
1285
1286
1287\membersection{wxImageHandler::SetName}\label{wximagehandlersetname}
1288
1289\func{void}{SetName}{\param{const wxString\& }{name}}
1290
1291Sets the handler name.
1292
1293\wxheading{Parameters}
1294
1295\docparam{name}{Handler name.}
1296
1297
1298\membersection{wxImageHandler::SetExtension}\label{wximagehandlersetextension}
1299
1300\func{void}{SetExtension}{\param{const wxString\& }{extension}}
1301
1302Sets the handler extension.
1303
1304\wxheading{Parameters}
1305
1306\docparam{extension}{Handler extension.}
1307
1308
1309\membersection{wxImageHandler::SetMimeType}\label{wximagehandlersetmimetype}
1310
1311\func{void}{SetMimeType}{\param{const wxString\& }{mimetype}}
1312
1313Sets the handler MIME type.
1314
1315\wxheading{Parameters}
1316
1317\docparam{mimename}{Handler MIME type.}
1318
1319
1320\membersection{wxImageHandler::SetType}\label{wximagehandlersettype}
1321
1322\func{void}{SetType}{\param{long }{type}}
1323
1324Sets the handler type.
1325
1326\wxheading{Parameters}
1327
1328\docparam{name}{Handler type.}
1329