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