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