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