]>
Commit | Line | Data |
---|---|---|
1e6d9499 JS |
1 | \section{\class{wxImage}}\label{wximage} |
2 | ||
3 | This class encapsulates a platform-independent image. An image can be created | |
b06a6b20 | 4 | from data, or using \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage}. An image |
1e6d9499 JS |
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 | ||
7468b994 RR |
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 | |
b06a6b20 VS |
11 | the \helpref{wxBitmap::wxBitmap(wxImage,int depth)}{wxbitmapconstr} constructor. |
12 | This bitmap can then | |
7468b994 RR |
13 | be drawn in a device context, using \helpref{wxDC::DrawBitmap}{wxdcdrawbitmap}. |
14 | ||
15 | One colour value of the image may be used as a mask colour which will lead to the automatic | |
16 | creation of a \helpref{wxMask}{wxmask} object associated to the bitmap object. | |
12a44087 | 17 | |
8727a1fe GRG |
18 | \wxheading{Available image handlers} |
19 | ||
20 | The following image handlers are available. {\bf wxBMPHandler} is always | |
21 | installed by default. To use other image formats, install the appropiate | |
fa482912 | 22 | handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or |
8727a1fe GRG |
23 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}. |
24 | ||
25 | \twocolwidtha{5cm}% | |
26 | \begin{twocollist} | |
606a3178 GT |
27 | \twocolitem{\indexit{wxBMPHandler}}{Only for loading, always installed.} |
28 | \twocolitem{\indexit{wxPNGHandler}}{For loading and saving.} | |
29 | \twocolitem{\indexit{wxJPEGHandler}}{For loading and saving.} | |
30 | \twocolitem{\indexit{wxGIFHandler}}{Only for loading, due to legal issues.} | |
31 | \twocolitem{\indexit{wxPCXHandler}}{For loading and saving (see below).} | |
32 | \twocolitem{\indexit{wxPNMHandler}}{For loading and saving (see below).} | |
b86e511a VS |
33 | \twocolitem{\indexit{wxTIFFHandler}}{For loading and saving.} |
34 | \twocolitem{\indexit{wxXPMHandler}}{For loading and saving.} | |
37b83ca6 | 35 | \twocolitem{\indexit{wxICOHandler}}{For loading and saving.} |
a61d25e6 | 36 | \twocolitem{\indexit{wxCURHandler}}{For loading and saving.} |
8727a1fe GRG |
37 | \end{twocollist} |
38 | ||
39 | When saving in PCX format, {\bf wxPCXHandler} will count the number of | |
40 | different colours in the image; if there are 256 or less colours, it will | |
41 | save as 8 bit, else it will save as 24 bit. | |
42 | ||
43 | Loading PNMs only works for ASCII or raw RGB images. When saving in | |
44 | PNM format, {\bf wxPNMHandler} will always save as raw RGB. | |
45 | ||
1e6d9499 JS |
46 | \wxheading{Derived from} |
47 | ||
48 | \helpref{wxObject}{wxobject} | |
49 | ||
954b8ae6 JS |
50 | \wxheading{Include files} |
51 | ||
52 | <wx/image.h> | |
53 | ||
1e6d9499 JS |
54 | \wxheading{See also} |
55 | ||
f6081a04 | 56 | \helpref{wxBitmap}{wxbitmap}, |
b5a4a47d | 57 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} |
1e6d9499 JS |
58 | |
59 | \latexignore{\rtfignore{\wxheading{Members}}} | |
60 | ||
61 | \membersection{wxImage::wxImage}\label{wximageconstr} | |
62 | ||
63 | \func{}{wxImage}{\void} | |
64 | ||
65 | Default constructor. | |
66 | ||
67 | \func{}{wxImage}{\param{const wxImage\& }{image}} | |
68 | ||
69 | Copy constructor. | |
70 | ||
71 | \func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}} | |
72 | ||
b06a6b20 VS |
73 | (Deprecated form, use \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage} |
74 | instead.) Constructs an image from a platform-dependent bitmap. This preserves | |
12a44087 RR |
75 | mask information so that bitmaps and images can be converted back |
76 | and forth without loss in that respect. | |
1e6d9499 JS |
77 | |
78 | \func{}{wxImage}{\param{int}{ width}, \param{int}{ height}} | |
79 | ||
80 | Creates an image with the given width and height. | |
81 | ||
e7240349 | 82 | \func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{unsigned char*}{ data}, \param{bool}{ static\_data=FALSE}} |
f6bcfd97 BP |
83 | |
84 | Creates an image from given data with the given width and height. If | |
e7240349 | 85 | {\it static\_data} is TRUE, then wxImage will not delete the actual |
f6bcfd97 BP |
86 | image data in its destructor, otherwise it will free it by calling |
87 | {\it free()}. | |
88 | ||
a61d25e6 | 89 | \func{}{wxImage}{\param{const wxString\& }{name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}} |
1e6d9499 | 90 | |
a61d25e6 | 91 | \func{}{wxImage}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}} |
9e9ee68e | 92 | |
1e6d9499 JS |
93 | Loads an image from a file. |
94 | ||
a61d25e6 | 95 | \func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}} |
45b5751f | 96 | |
a61d25e6 | 97 | \func{}{wxImage}{\param{wxInputStream\& }{stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}} |
9e9ee68e | 98 | |
45b5751f JS |
99 | Loads an image from an input stream. |
100 | ||
1e6d9499 JS |
101 | \wxheading{Parameters} |
102 | ||
103 | \docparam{width}{Specifies the width of the image.} | |
104 | ||
105 | \docparam{height}{Specifies the height of the image.} | |
106 | ||
31fd9b6b | 107 | \docparam{name}{Name of the file from which to load the image.} |
1e6d9499 | 108 | |
31fd9b6b | 109 | \docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.} |
45b5751f | 110 | |
1e6d9499 JS |
111 | \docparam{type}{May be one of the following: |
112 | ||
6be663cf | 113 | \twocolwidtha{5cm}% |
1e6d9499 | 114 | \begin{twocollist} |
606a3178 GT |
115 | \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} |
116 | \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} | |
117 | \twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.} | |
118 | \twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.} | |
119 | \twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.} | |
120 | \twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.} | |
121 | \twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.} | |
b86e511a | 122 | \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.} |
a61d25e6 VS |
123 | \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).} |
124 | \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).} | |
606a3178 | 125 | \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.} |
31fd9b6b | 126 | \end{twocollist}} |
1e6d9499 | 127 | |
9e9ee68e VS |
128 | \docparam{mimetype}{MIME type string (for example 'image/jpeg')} |
129 | ||
a61d25e6 VS |
130 | \docparam{index}{Index of the image to load in the case that the image file contains multiple images. |
131 | This is only used by ICO and TIFF handlers. The default value (-1) means | |
132 | "choose the default image" and is interpreted as the first image (index=0) by | |
133 | the TIFF handler and as the largest and most colourful one by the ICO handler.} | |
134 | ||
31fd9b6b GRG |
135 | \wxheading{Remarks} |
136 | ||
137 | Depending on how wxWindows has been configured, not all formats may be available. | |
138 | ||
fa482912 JS |
139 | Note: any handler other than BMP must be previously |
140 | initialized with \helpref{wxImage::AddHandler}{wximageaddhandler} or | |
31fd9b6b | 141 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}. |
0a9f2522 | 142 | |
a61d25e6 VS |
143 | Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the |
144 | hotspot for loaded cursor file: | |
145 | \begin{verbatim} | |
146 | int hotspot_x = image.GetOptionInt(wxCUR_HOTSPOT_X); | |
147 | int hotspot_y = image.GetOptionInt(wxCUR_HOTSPOT_Y); | |
148 | ||
149 | \end{verbatim} | |
150 | ||
1e6d9499 JS |
151 | \wxheading{See also} |
152 | ||
153 | \helpref{wxImage::LoadFile}{wximageloadfile} | |
154 | ||
f899db6d RD |
155 | \pythonnote{Constructors supported by wxPython are:\par |
156 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
157 | \twocolitem{{\bf wxImage(name, flag)}}{Loads an image from a file} |
158 | \twocolitem{{\bf wxNullImage()}}{Create a null image (has no size or | |
f899db6d | 159 | image data)} |
c9110876 | 160 | \twocolitem{{\bf wxEmptyImage(width, height)}}{Creates an empty image |
f899db6d | 161 | of the given size} |
c9110876 | 162 | \twocolitem{{\bf wxImageFromMime(name, mimetype}}{Creates an image from |
f899db6d | 163 | the given file of the given mimetype} |
c9110876 | 164 | \twocolitem{{\bf wxImageFromBitmap(bitmap)}}{Creates an image from a |
f899db6d RD |
165 | platform-dependent bitmap} |
166 | \end{twocollist}} | |
167 | } | |
168 | ||
5873607e VZ |
169 | \perlnote{Constructors supported by wxPerl are:\par |
170 | \begin{itemize} | |
171 | \item{Wx::Image->new( bitmap )} | |
172 | \item{Wx::Image->new( width, height )} | |
173 | \item{Wx::Image->new( name, type )} | |
174 | \item{Wx::Image->new( name, mimetype )} | |
175 | \end{itemize} | |
176 | } | |
177 | ||
1e6d9499 JS |
178 | \membersection{wxImage::\destruct{wxImage}} |
179 | ||
180 | \func{}{\destruct{wxImage}}{\void} | |
181 | ||
182 | Destructor. | |
183 | ||
184 | \membersection{wxImage::AddHandler}\label{wximageaddhandler} | |
185 | ||
186 | \func{static void}{AddHandler}{\param{wxImageHandler*}{ handler}} | |
187 | ||
188 | Adds a handler to the end of the static list of format handlers. | |
189 | ||
190 | \docparam{handler}{A new image format handler object. There is usually only one instance | |
191 | of a given handler class in an application session.} | |
192 | ||
193 | \wxheading{See also} | |
194 | ||
195 | \helpref{wxImageHandler}{wximagehandler} | |
196 | ||
e7240349 | 197 | \pythonnote{In wxPython this static method is named {\tt wxImage\_AddHandler}.} |
1e6d9499 JS |
198 | \membersection{wxImage::CleanUpHandlers} |
199 | ||
200 | \func{static void}{CleanUpHandlers}{\void} | |
201 | ||
202 | Deletes all image handlers. | |
203 | ||
204 | This function is called by wxWindows on exit. | |
205 | ||
206 | \membersection{wxImage::ConvertToBitmap}\label{wximageconverttobitmap} | |
207 | ||
208 | \constfunc{wxBitmap}{ConvertToBitmap}{\void} | |
209 | ||
b06a6b20 VS |
210 | Deprecated, use equivalent \helpref{wxBitmap constructor}{wxbitmapconstr} |
211 | (which takes wxImage and depth as its arguments) instead. | |
7468b994 | 212 | |
b06a6b20 | 213 | \membersection{wxImage::ConvertToMono}\label{wxbitmapconverttomono} |
1e6d9499 | 214 | |
b06a6b20 VS |
215 | \constfunc{wxImage}{ConvertToMono}{\param{unsigned char}{ r}, \param{unsigned char}{ g}, \param{unsigned char}{ b}} |
216 | ||
217 | Returns monochromatic version of the image. The returned image has white | |
218 | colour where the original has {\it (r,g,b)} colour and black colour | |
219 | everywhere else. | |
3ca6a5f0 | 220 | |
f6bcfd97 BP |
221 | \membersection{wxImage::Copy}\label{wximagecopy} |
222 | ||
223 | \constfunc{wxImage}{Copy}{\void} | |
224 | ||
225 | Returns an identical copy of the image. | |
226 | ||
1e6d9499 JS |
227 | \membersection{wxImage::Create}\label{wximagecreate} |
228 | ||
229 | \func{bool}{Create}{\param{int}{ width}, \param{int}{ height}} | |
230 | ||
231 | Creates a fresh image. | |
232 | ||
233 | \wxheading{Parameters} | |
234 | ||
235 | \docparam{width}{The width of the image in pixels.} | |
236 | ||
237 | \docparam{height}{The height of the image in pixels.} | |
238 | ||
239 | \wxheading{Return value} | |
240 | ||
241 | TRUE if the call succeeded, FALSE otherwise. | |
242 | ||
243 | \membersection{wxImage::Destroy}\label{wximagedestroy} | |
244 | ||
245 | \func{bool}{Destroy}{\void} | |
246 | ||
247 | Destroys the image data. | |
248 | ||
37b83ca6 VS |
249 | \membersection{wxImage::FindFirstUnusedColour}\label{wximagefindfirstunusedcolour} |
250 | ||
251 | \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}} | |
252 | ||
253 | \wxheading{Parameters} | |
254 | ||
255 | \docparam{r,g,b}{Pointers to variables to save the colour.} | |
256 | ||
257 | \docparam{startR,startG,startB}{Initial values of the colour. Returned colour | |
258 | will have RGB values equal to or greater than these.} | |
259 | ||
260 | Finds the first colour that is never used in the image. The search begins at | |
261 | given initial colour and continues by increasing R, G and B components (in this | |
262 | order) by 1 until an unused colour is found or the colour space exhausted. | |
263 | ||
264 | \wxheading{Return value} | |
265 | ||
266 | Returns FALSE if there is no unused colour left, TRUE on success. | |
267 | ||
268 | \wxheading{Notes} | |
269 | ||
270 | Note that this method involves computing the histogram, which is | |
271 | computationally intensive operation. | |
272 | ||
1e6d9499 JS |
273 | \membersection{wxImage::FindHandler} |
274 | ||
275 | \func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{name}} | |
276 | ||
277 | Finds the handler with the given name. | |
278 | ||
279 | \func{static wxImageHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{long}{ imageType}} | |
280 | ||
281 | Finds the handler associated with the given extension and type. | |
282 | ||
283 | \func{static wxImageHandler*}{FindHandler}{\param{long }{imageType}} | |
284 | ||
285 | Finds the handler associated with the given image type. | |
286 | ||
9e9ee68e VS |
287 | \func{static wxImageHandler*}{FindHandlerMime}{\param{const wxString\& }{mimetype}} |
288 | ||
289 | Finds the handler associated with the given MIME type. | |
290 | ||
1e6d9499 JS |
291 | \docparam{name}{The handler name.} |
292 | ||
293 | \docparam{extension}{The file extension, such as ``bmp".} | |
294 | ||
f6fcbb63 | 295 | \docparam{imageType}{The image type, such as wxBITMAP\_TYPE\_BMP.} |
1e6d9499 | 296 | |
9e9ee68e VS |
297 | \docparam{mimetype}{MIME type.} |
298 | ||
1e6d9499 JS |
299 | \wxheading{Return value} |
300 | ||
301 | A pointer to the handler if found, NULL otherwise. | |
302 | ||
303 | \wxheading{See also} | |
304 | ||
305 | \helpref{wxImageHandler}{wximagehandler} | |
306 | ||
307 | \membersection{wxImage::GetBlue}\label{wximagegetblue} | |
308 | ||
309 | \constfunc{unsigned char}{GetBlue}{\param{int}{ x}, \param{int}{ y}} | |
310 | ||
311 | Returns the blue intensity at the given coordinate. | |
312 | ||
313 | \membersection{wxImage::GetData}\label{wximagegetdata} | |
314 | ||
315 | \constfunc{unsigned char*}{GetData}{\void} | |
316 | ||
12a44087 RR |
317 | Returns the image data as an array. This is most often used when doing |
318 | direct image manipulation. The return value points to an array of | |
319 | chararcters in RGBGBRGB... format. | |
1e6d9499 JS |
320 | |
321 | \membersection{wxImage::GetGreen}\label{wximagegetgreen} | |
322 | ||
323 | \constfunc{unsigned char}{GetGreen}{\param{int}{ x}, \param{int}{ y}} | |
324 | ||
325 | Returns the green intensity at the given coordinate. | |
326 | ||
649d13e8 | 327 | \membersection{wxImage::GetImageCount}\label{wximagegetimagecount} |
a61d25e6 | 328 | |
649d13e8 | 329 | \func{static int}{GetImageCount}{\param{const wxString\&}{ filename}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}} |
a61d25e6 | 330 | |
649d13e8 | 331 | \func{static int}{GetImageCount}{\param{wxInputStream\&}{ stream}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}} |
a61d25e6 VS |
332 | |
333 | If the image file contains more than one image and the image handler is capable | |
334 | of retrieving these individually, this function will return the number of | |
335 | available images. | |
336 | ||
337 | \docparam{name}{Name of the file to query.} | |
338 | ||
339 | \docparam{stream}{Opened input stream with image data. Currently, the stream must support seeking.} | |
340 | ||
341 | \docparam{type}{May be one of the following: | |
342 | ||
343 | \twocolwidtha{5cm}% | |
344 | \begin{twocollist} | |
345 | \twocolitem{\indexit{wxBITMAP\_TYPE\_BMP}}{Load a Windows bitmap file.} | |
346 | \twocolitem{\indexit{wxBITMAP\_TYPE\_GIF}}{Load a GIF bitmap file.} | |
347 | \twocolitem{\indexit{wxBITMAP\_TYPE\_JPEG}}{Load a JPEG bitmap file.} | |
348 | \twocolitem{\indexit{wxBITMAP\_TYPE\_PNG}}{Load a PNG bitmap file.} | |
349 | \twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.} | |
350 | \twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.} | |
351 | \twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.} | |
352 | \twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.} | |
353 | \twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).} | |
354 | \twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).} | |
355 | \twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.} | |
356 | \end{twocollist}} | |
357 | ||
358 | \wxheading{Return value} | |
359 | ||
360 | Number of available images. For most image handlers, this is 1 (exceptions | |
361 | are TIFF and ICO formats). | |
362 | ||
1e6d9499 JS |
363 | \membersection{wxImage::GetRed}\label{wximagegetred} |
364 | ||
365 | \constfunc{unsigned char}{GetRed}{\param{int}{ x}, \param{int}{ y}} | |
366 | ||
367 | Returns the red intensity at the given coordinate. | |
368 | ||
369 | \membersection{wxImage::GetHandlers} | |
370 | ||
371 | \func{static wxList\&}{GetHandlers}{\void} | |
372 | ||
373 | Returns the static list of image format handlers. | |
374 | ||
375 | \wxheading{See also} | |
376 | ||
377 | \helpref{wxImageHandler}{wximagehandler} | |
378 | ||
379 | \membersection{wxImage::GetHeight}\label{wximagegetheight} | |
380 | ||
381 | \constfunc{int}{GetHeight}{\void} | |
382 | ||
383 | Gets the height of the image in pixels. | |
384 | ||
385 | \membersection{wxImage::GetMaskBlue}\label{wximagegetmaskblue} | |
386 | ||
387 | \constfunc{unsigned char}{GetMaskBlue}{\void} | |
388 | ||
389 | Gets the blue value of the mask colour. | |
390 | ||
391 | \membersection{wxImage::GetMaskGreen}\label{wximagegetmaskgreen} | |
392 | ||
393 | \constfunc{unsigned char}{GetMaskGreen}{\void} | |
394 | ||
395 | Gets the green value of the mask colour. | |
396 | ||
397 | \membersection{wxImage::GetMaskRed}\label{wximagegetmaskred} | |
398 | ||
399 | \constfunc{unsigned char}{GetMaskRed}{\void} | |
400 | ||
401 | Gets the red value of the mask colour. | |
402 | ||
3ca6a5f0 BP |
403 | \membersection{wxImage::GetPalette}\label{wximagegetpalette} |
404 | ||
405 | \constfunc{const wxPalette\&}{GetPalette}{\void} | |
406 | ||
407 | Returns the palette associated with the image. Currently the palette is only | |
b06a6b20 | 408 | used when converting to wxBitmap under Windows. |
3ca6a5f0 BP |
409 | |
410 | Eventually wxImage handlers will set the palette if one exists in the image file. | |
411 | ||
fc9c7c09 RR |
412 | \membersection{wxImage::GetSubImage}\label{wximagegetsubimage} |
413 | ||
7468b994 | 414 | \constfunc{wxImage}{GetSubImage}{\param{const wxRect\&}{ rect}} |
fc9c7c09 RR |
415 | |
416 | Returns a sub image of the current one as long as the rect belongs entirely to | |
417 | the image. | |
418 | ||
1e6d9499 JS |
419 | \membersection{wxImage::GetWidth}\label{wximagegetwidth} |
420 | ||
421 | \constfunc{int}{GetWidth}{\void} | |
422 | ||
423 | Gets the width of the image in pixels. | |
424 | ||
425 | \wxheading{See also} | |
426 | ||
427 | \helpref{wxImage::GetHeight}{wximagegetheight} | |
428 | ||
429 | \membersection{wxImage::HasMask}\label{wximagehasmask} | |
430 | ||
431 | \constfunc{bool}{HasMask}{\void} | |
432 | ||
433 | Returns TRUE if there is a mask active, FALSE otherwise. | |
434 | ||
5e5437e0 JS |
435 | \membersection{wxImage::GetOption}\label{wximagegetoption} |
436 | ||
437 | \constfunc{wxString}{GetOption}{\param{const wxString\&}{ name}} | |
438 | ||
439 | Gets a user-defined option. The function is case-insensitive to {\it name}. | |
440 | ||
441 | For example, when saving as a JPEG file, the option {\bf quality} is | |
442 | used, which is a number between 0 and 100 (0 is terrible, 100 is very good). | |
443 | ||
444 | \wxheading{See also} | |
445 | ||
446 | \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp | |
447 | \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp | |
448 | \helpref{wxImage::HasOption}{wximagehasoption} | |
449 | ||
450 | \membersection{wxImage::GetOptionInt}\label{wximagegetoptionint} | |
451 | ||
452 | \constfunc{int}{GetOptionInt}{\param{const wxString\&}{ name}} | |
453 | ||
454 | Gets a user-defined option as an integer. The function is case-insensitive to {\it name}. | |
455 | ||
456 | \wxheading{See also} | |
457 | ||
458 | \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp | |
459 | \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp | |
460 | \helpref{wxImage::HasOption}{wximagehasoption} | |
461 | ||
462 | \membersection{wxImage::HasOption}\label{wximagehasoption} | |
463 | ||
464 | \constfunc{bool}{HasOption}{\param{const wxString\&}{ name}} | |
465 | ||
466 | Returns TRUE if the given option is present. The function is case-insensitive to {\it name}. | |
467 | ||
468 | \wxheading{See also} | |
469 | ||
470 | \helpref{wxImage::SetOption}{wximagesetoption},\rtfsp | |
471 | \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp | |
472 | \helpref{wxImage::GetOptionInt}{wximagegetoptionint} | |
473 | ||
1e6d9499 JS |
474 | \membersection{wxImage::InitStandardHandlers} |
475 | ||
476 | \func{static void}{InitStandardHandlers}{\void} | |
477 | ||
a14e57f9 | 478 | Internal use only. Adds standard image format handlers. It only install BMP |
31fd9b6b | 479 | for the time being, which is used by wxBitmap. |
1e6d9499 | 480 | |
a14e57f9 SB |
481 | This function is called by wxWindows on startup, and shouldn't be called by |
482 | the user. | |
1e6d9499 JS |
483 | |
484 | \wxheading{See also} | |
485 | ||
fa482912 | 486 | \helpref{wxImageHandler}{wximagehandler}, |
b5a4a47d | 487 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} |
1e6d9499 JS |
488 | |
489 | \membersection{wxImage::InsertHandler} | |
490 | ||
491 | \func{static void}{InsertHandler}{\param{wxImageHandler*}{ handler}} | |
492 | ||
493 | Adds a handler at the start of the static list of format handlers. | |
494 | ||
495 | \docparam{handler}{A new image format handler object. There is usually only one instance | |
496 | of a given handler class in an application session.} | |
497 | ||
498 | \wxheading{See also} | |
499 | ||
500 | \helpref{wxImageHandler}{wximagehandler} | |
501 | ||
502 | \membersection{wxImage::LoadFile}\label{wximageloadfile} | |
503 | ||
a61d25e6 | 504 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{long}{ type = wxBITMAP\_TYPE\_ANY}, \param{int}{ index = -1}} |
1e6d9499 | 505 | |
a61d25e6 | 506 | \func{bool}{LoadFile}{\param{const wxString\&}{ name}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}} |
9e9ee68e | 507 | |
a14e57f9 | 508 | Loads an image from a file. If no handler type is provided, the library will |
31fd9b6b | 509 | try to autodetect the format. |
1e6d9499 | 510 | |
a61d25e6 | 511 | \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{long}{ type}, \param{int}{ index = -1}} |
45b5751f | 512 | |
a61d25e6 | 513 | \func{bool}{LoadFile}{\param{wxInputStream\&}{ stream}, \param{const wxString\&}{ mimetype}, \param{int}{ index = -1}} |
9e9ee68e | 514 | |
45b5751f JS |
515 | Loads an image from an input stream. |
516 | ||
1e6d9499 JS |
517 | \wxheading{Parameters} |
518 | ||
31fd9b6b | 519 | \docparam{name}{Name of the file from which to load the image.} |
1e6d9499 | 520 | |
31fd9b6b | 521 | \docparam{stream}{Opened input stream from which to load the image. Currently, the stream must support seeking.} |
45b5751f | 522 | |
1e6d9499 JS |
523 | \docparam{type}{One of the following values: |
524 | ||
6be663cf | 525 | \twocolwidtha{5cm}% |
1e6d9499 | 526 | \begin{twocollist} |
f6fcbb63 | 527 | \twocolitem{{\bf wxBITMAP\_TYPE\_BMP}}{Load a Windows image file.} |
a14e57f9 | 528 | \twocolitem{{\bf wxBITMAP\_TYPE\_GIF}}{Load a GIF image file.} |
48b4e302 | 529 | \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Load a JPEG image file.} |
a14e57f9 SB |
530 | \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Load a PCX image file.} |
531 | \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.} | |
532 | \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.} | |
31fd9b6b | 533 | \twocolitem{{\bf wxBITMAP\_TYPE\_TIF}}{Load a TIFF image file.} |
b86e511a | 534 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.} |
a61d25e6 VS |
535 | \twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).} |
536 | \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).} | |
31fd9b6b GRG |
537 | \twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.} |
538 | \end{twocollist}} | |
1e6d9499 | 539 | |
9e9ee68e VS |
540 | \docparam{mimetype}{MIME type string (for example 'image/jpeg')} |
541 | ||
a61d25e6 VS |
542 | \docparam{index}{Index of the image to load in the case that the image file contains multiple images. |
543 | This is only used by ICO and TIFF handlers. The default value (-1) means | |
544 | "choose the default image" and is interpreted as the first image (index=0) by | |
545 | the TIFF handler and as the largest and most colourful one by the ICO handler.} | |
546 | ||
31fd9b6b GRG |
547 | \wxheading{Remarks} |
548 | ||
549 | Depending on how wxWindows has been configured, not all formats may be available. | |
550 | ||
a61d25e6 VS |
551 | Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to get the |
552 | hotspot for loaded cursor file: | |
553 | \begin{verbatim} | |
554 | int hotspot_x = image.GetOptionInt(wxCUR_HOTSPOT_X); | |
555 | int hotspot_y = image.GetOptionInt(wxCUR_HOTSPOT_Y); | |
556 | ||
557 | \end{verbatim} | |
37b83ca6 | 558 | |
1e6d9499 JS |
559 | \wxheading{Return value} |
560 | ||
561 | TRUE if the operation succeeded, FALSE otherwise. | |
562 | ||
563 | \wxheading{See also} | |
564 | ||
565 | \helpref{wxImage::SaveFile}{wximagesavefile} | |
566 | ||
f899db6d RD |
567 | \pythonnote{In place of a single overloaded method name, wxPython |
568 | implements the following methods:\par | |
569 | \indented{2cm}{\begin{twocollist} | |
c9110876 | 570 | \twocolitem{{\bf LoadFile(filename, type)}}{Loads an image of the given |
f899db6d | 571 | type from a file} |
c9110876 | 572 | \twocolitem{{\bf LoadMimeFile(filename, mimetype)}}{Loads an image of the given |
f899db6d RD |
573 | mimetype from a file} |
574 | \end{twocollist}} | |
575 | } | |
576 | ||
5873607e VZ |
577 | \perlnote{Methods supported by wxPerl are:\par |
578 | \begin{itemize} | |
606a3178 GT |
579 | \item{bitmap->LoadFile( name, type )} |
580 | \item{bitmap->LoadFile( name, mimetype )} | |
5873607e VZ |
581 | \end{itemize} |
582 | } | |
583 | ||
f899db6d | 584 | |
1e6d9499 JS |
585 | \membersection{wxImage::Ok}\label{wximageok} |
586 | ||
587 | \constfunc{bool}{Ok}{\void} | |
588 | ||
589 | Returns TRUE if image data is present. | |
590 | ||
591 | \membersection{wxImage::RemoveHandler} | |
592 | ||
593 | \func{static bool}{RemoveHandler}{\param{const wxString\& }{name}} | |
594 | ||
595 | Finds the handler with the given name, and removes it. The handler | |
596 | is not deleted. | |
597 | ||
598 | \docparam{name}{The handler name.} | |
599 | ||
600 | \wxheading{Return value} | |
601 | ||
602 | TRUE if the handler was found and removed, FALSE otherwise. | |
603 | ||
604 | \wxheading{See also} | |
605 | ||
606 | \helpref{wxImageHandler}{wximagehandler} | |
607 | ||
608 | \membersection{wxImage::SaveFile}\label{wximagesavefile} | |
609 | ||
610 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{int}{ type}} | |
611 | ||
9e9ee68e VS |
612 | \func{bool}{SaveFile}{\param{const wxString\& }{name}, \param{const wxString\&}{ mimetype}} |
613 | ||
1e6d9499 JS |
614 | Saves a image in the named file. |
615 | ||
45b5751f JS |
616 | \func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int}{ type}} |
617 | ||
9e9ee68e VS |
618 | \func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{const wxString\&}{ mimetype}} |
619 | ||
45b5751f JS |
620 | Saves a image in the given stream. |
621 | ||
1e6d9499 JS |
622 | \wxheading{Parameters} |
623 | ||
31fd9b6b | 624 | \docparam{name}{Name of the file to save the image to.} |
1e6d9499 | 625 | |
31fd9b6b | 626 | \docparam{stream}{Opened output stream to save the image to.} |
45b5751f | 627 | |
7468b994 | 628 | \docparam{type}{Currently three types can be used: |
1e6d9499 | 629 | |
6be663cf | 630 | \twocolwidtha{5cm}% |
1e6d9499 | 631 | \begin{twocollist} |
48b4e302 | 632 | \twocolitem{{\bf wxBITMAP\_TYPE\_JPEG}}{Save a JPEG image file.} |
31fd9b6b GRG |
633 | \twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.} |
634 | \twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).} | |
635 | \twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).} | |
b86e511a VS |
636 | \twocolitem{{\bf wxBITMAP\_TYPE\_TIFF}}{Save a TIFF image file.} |
637 | \twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save a XPM image file.} | |
a61d25e6 VS |
638 | \twocolitem{{\bf wxBITMAP\_TYPE\_ICO}}{Save a ICO image file. } |
639 | \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).} | |
640 | \twocolitem{{\bf wxBITMAP\_TYPE\_CUR}}{Save a Windows cursor file (CUR).} | |
31fd9b6b | 641 | \end{twocollist}} |
1e6d9499 | 642 | |
9e9ee68e VS |
643 | \docparam{mimetype}{MIME type.} |
644 | ||
1e6d9499 JS |
645 | \wxheading{Return value} |
646 | ||
647 | TRUE if the operation succeeded, FALSE otherwise. | |
648 | ||
649 | \wxheading{Remarks} | |
650 | ||
651 | Depending on how wxWindows has been configured, not all formats may be available. | |
652 | ||
a61d25e6 VS |
653 | Note: you can use \helpref{GetOptionInt}{wximagegetoptionint} to set the |
654 | hotspot before saving an image into a cursor file (default hotspot is in | |
655 | the centre of the image): | |
656 | \begin{verbatim} | |
657 | image.SetOption(wxCUR_HOTSPOT_X, hotspotX); | |
658 | image.SetOption(wxCUR_HOTSPOT_Y, hotspotY); | |
659 | ||
660 | \end{verbatim} | |
661 | ||
1e6d9499 JS |
662 | \wxheading{See also} |
663 | ||
664 | \helpref{wxImage::LoadFile}{wximageloadfile} | |
665 | ||
f899db6d RD |
666 | \pythonnote{In place of a single overloaded method name, wxPython |
667 | implements the following methods:\par | |
668 | \indented{2cm}{\begin{twocollist} | |
c9110876 | 669 | \twocolitem{{\bf SaveFile(filename, type)}}{Saves the image using the given |
f899db6d | 670 | type to the named file} |
c9110876 | 671 | \twocolitem{{\bf SaveMimeFile(filename, mimetype)}}{Saves the image using the given |
f899db6d RD |
672 | mimetype to the named file} |
673 | \end{twocollist}} | |
674 | } | |
675 | ||
5873607e VZ |
676 | \perlnote{Methods supported by wxPerl are:\par |
677 | \begin{itemize} | |
606a3178 GT |
678 | \item{bitmap->SaveFile( name, type )} |
679 | \item{bitmap->SaveFile( name, mimetype )} | |
5873607e VZ |
680 | \end{itemize} |
681 | } | |
682 | ||
f6bcfd97 BP |
683 | \membersection{wxImage::Mirror}\label{wximagemirror} |
684 | ||
685 | \constfunc{wxImage}{Mirror}{\param{bool}{ horizontally = TRUE}} | |
686 | ||
687 | Returns a mirrored copy of the image. The parameter {\it horizontally} | |
688 | indicates the orientation. | |
689 | ||
7468b994 RR |
690 | \membersection{wxImage::Replace}\label{wximagereplace} |
691 | ||
692 | \func{void}{Replace}{\param{unsigned char}{ r1}, \param{unsigned char}{ g1}, \param{unsigned char}{ b1}, | |
693 | \param{unsigned char}{ r2}, \param{unsigned char}{ g2}, \param{unsigned char}{ b2}} | |
694 | ||
695 | Replaces the colour specified by {\it r1,g1,b1} by the colour {\it r2,g2,b2}. | |
696 | ||
ce9a75d2 VZ |
697 | \membersection{wxImage::Rescale}\label{wximagerescale} |
698 | ||
6e807169 | 699 | \func{wxImage \&}{Rescale}{\param{int}{ width}, \param{int}{ height}} |
ce9a75d2 | 700 | |
9c884972 RR |
701 | Changes the size of the image in-place: after a call to this function, the |
702 | image will have the given width and height. | |
ce9a75d2 | 703 | |
6e807169 VZ |
704 | Returns the (modified) image itself. |
705 | ||
ce9a75d2 VZ |
706 | \wxheading{See also} |
707 | ||
708 | \helpref{Scale}{wximagescale} | |
709 | ||
ed8297b9 | 710 | \membersection{wxImage::Rotate}\label{wximagerotate} |
7a632f10 JS |
711 | |
712 | \func{wxImage}{Rotate}{\param{double}{ angle}, \param{const wxPoint\& }{rotationCentre}, | |
713 | \param{bool}{ interpolating = TRUE}, \param{wxPoint*}{ offsetAfterRotation = NULL}} | |
714 | ||
715 | Rotates the image about the given point, by {\it angle} radians. Passing TRUE | |
b4e87ec3 GRG |
716 | to {\it interpolating} results in better image quality, but is slower. If the |
717 | image has a mask, then the mask colour is used for the uncovered pixels in the | |
718 | rotated image background. Else, black (rgb 0, 0, 0) will be used. | |
7a632f10 JS |
719 | |
720 | Returns the rotated image, leaving this image intact. | |
721 | ||
f6bcfd97 BP |
722 | \membersection{wxImage::Rotate90}\label{wximagerotate90} |
723 | ||
724 | \constfunc{wxImage}{Rotate90}{\param{bool}{ clockwise = TRUE}} | |
725 | ||
726 | Returns a copy of the image rotated 90 degrees in the direction | |
727 | indicated by {\it clockwise}. | |
728 | ||
1e6d9499 JS |
729 | \membersection{wxImage::Scale}\label{wximagescale} |
730 | ||
ce9a75d2 | 731 | \constfunc{wxImage}{Scale}{\param{int}{ width}, \param{int}{ height}} |
1e6d9499 | 732 | |
12a44087 RR |
733 | Returns a scaled version of the image. This is also useful for |
734 | scaling bitmaps in general as the only other way to scale bitmaps | |
ce9a75d2 VZ |
735 | is to blit a wxMemoryDC into another wxMemoryDC. |
736 | ||
7468b994 | 737 | It may be mentioned that the GTK port uses this function internally |
f6bcfd97 | 738 | to scale bitmaps when using mapping modes in wxDC. |
ce9a75d2 VZ |
739 | |
740 | Example: | |
741 | ||
742 | \begin{verbatim} | |
743 | // get the bitmap from somewhere | |
744 | wxBitmap bmp = ...; | |
745 | ||
746 | // rescale it to have size of 32*32 | |
747 | if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 ) | |
748 | { | |
749 | wxImage image(bmp); | |
b06a6b20 | 750 | bmp = wxBitmap(image.Scale(32, 32)); |
ce9a75d2 VZ |
751 | |
752 | // another possibility: | |
753 | image.Rescale(32, 32); | |
754 | bmp = image; | |
755 | } | |
756 | ||
757 | \end{verbatim} | |
758 | ||
759 | \wxheading{See also} | |
760 | ||
761 | \helpref{Rescale}{wximagerescale} | |
1e6d9499 JS |
762 | |
763 | \membersection{wxImage::SetData}\label{wximagesetdata} | |
764 | ||
765 | \func{void}{SetData}{\param{unsigned char*}{data}} | |
766 | ||
f899db6d | 767 | Sets the image data without performing checks. The data given must have |
12a44087 RR |
768 | the size (width*height*3) or results will be unexpected. Don't use this |
769 | method if you aren't sure you know what you are doing. | |
1e6d9499 JS |
770 | |
771 | \membersection{wxImage::SetMask}\label{wximagesetmask} | |
772 | ||
773 | \func{void}{SetMask}{\param{bool}{ hasMask = TRUE}} | |
774 | ||
775 | Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour. | |
776 | ||
777 | \membersection{wxImage::SetMaskColour}\label{wximagesetmaskcolour} | |
778 | ||
779 | \func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{blue}, \param{unsigned char }{green}} | |
780 | ||
b1170810 | 781 | Sets the mask colour for this image (and tells the image to use the mask). |
1e6d9499 | 782 | |
37b83ca6 VS |
783 | \membersection{wxImage::SetMaskFromImage}\label{wximagesetmaskfromimage} |
784 | ||
785 | \func{bool}{SetMaskFromImage}{\param{const wxImage\&}{ mask}, \param{unsigned char}{ mr}, \param{unsigned char}{ mg}, \param{unsigned char}{ mb}} | |
786 | ||
787 | \wxheading{Parameters} | |
788 | ||
789 | \docparam{mask}{The mask image to extract mask shape from. Must have same dimensions as the image.} | |
790 | ||
791 | \docparam{mr,mg,mb}{RGB value of pixels in {\it mask} that will be used to create the mask.} | |
792 | ||
793 | Sets image's mask so that the pixels that have RGB value of {\it mr,mg,mb} | |
794 | in {\it mask} will be masked in the image. This is done by first finding an | |
795 | unused colour in the image, setting this colour as the mask colour and then | |
796 | using this colour to draw all pixels in the image who corresponding pixel | |
797 | in {\it mask} has given RGB value. | |
798 | ||
799 | \wxheading{Return value} | |
800 | ||
801 | Returns FALSE if {\it mask} does not have same dimensions as the image or if | |
802 | there is no unused colour left. Returns TRUE if the mask was successfully | |
803 | applied. | |
804 | ||
805 | \wxheading{Notes} | |
806 | ||
807 | Note that this method involves computing the histogram, which is | |
808 | computationally intensive operation. | |
809 | ||
5e5437e0 JS |
810 | \membersection{wxImage::SetOption}\label{wximagesetoption} |
811 | ||
812 | \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{const wxString\&}{ value}} | |
813 | ||
814 | \func{void}{SetOption}{\param{const wxString\&}{ name}, \param{int}{ value}} | |
815 | ||
816 | Sets a user-defined option. The function is case-insensitive to {\it name}. | |
817 | ||
818 | For example, when saving as a JPEG file, the option {\bf quality} is | |
819 | used, which is a number between 0 and 100 (0 is terrible, 100 is very good). | |
820 | ||
821 | \wxheading{See also} | |
822 | ||
823 | \helpref{wxImage::GetOption}{wximagegetoption},\rtfsp | |
824 | \helpref{wxImage::GetOptionInt}{wximagegetoptionint},\rtfsp | |
825 | \helpref{wxImage::HasOption}{wximagehasoption} | |
826 | ||
3ca6a5f0 BP |
827 | \membersection{wxImage::SetPalette}\label{wximagesetpalette} |
828 | ||
829 | \func{void}{SetPalette}{\param{const wxPalette\&}{ palette}} | |
830 | ||
b06a6b20 VS |
831 | Associates a palette with the image. The palette may be used when converting |
832 | wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet). | |
3ca6a5f0 | 833 | |
1e6d9499 JS |
834 | \membersection{wxImage::SetRGB}\label{wximagesetrgb} |
835 | ||
f6bcfd97 | 836 | \func{void}{SetRGB}{\param{int }{x}, \param{int }{y}, \param{unsigned char }{red}, \param{unsigned char }{green}, \param{unsigned char }{blue}} |
1e6d9499 | 837 | |
12a44087 RR |
838 | Sets the pixel at the given coordinate. This routine performs bounds-checks |
839 | for the coordinate so it can be considered a safe way to manipulate the | |
840 | data, but in some cases this might be too slow so that the data will have to | |
7468b994 RR |
841 | be set directly. In that case you will have to get access to the image data |
842 | using the \helpref{GetData}{wximagegetdata} method. | |
1e6d9499 JS |
843 | |
844 | \membersection{wxImage::operator $=$} | |
845 | ||
846 | \func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}} | |
847 | ||
848 | Assignment operator. This operator does not copy any data, but instead | |
849 | passes a pointer to the data in {\it image} and increments a reference | |
850 | counter. It is a fast operation. | |
851 | ||
852 | \wxheading{Parameters} | |
853 | ||
854 | \docparam{image}{Image to assign.} | |
855 | ||
856 | \wxheading{Return value} | |
857 | ||
858 | Returns 'this' object. | |
859 | ||
860 | \membersection{wxImage::operator $==$} | |
861 | ||
862 | \func{bool}{operator $==$}{\param{const wxImage\& }{image}} | |
863 | ||
864 | Equality operator. This operator tests whether the internal data pointers are | |
865 | equal (a fast test). | |
866 | ||
867 | \wxheading{Parameters} | |
868 | ||
869 | \docparam{image}{Image to compare with 'this'} | |
870 | ||
871 | \wxheading{Return value} | |
872 | ||
873 | Returns TRUE if the images were effectively equal, FALSE otherwise. | |
874 | ||
875 | \membersection{wxImage::operator $!=$} | |
876 | ||
877 | \func{bool}{operator $!=$}{\param{const wxImage\& }{image}} | |
878 | ||
879 | Inequality operator. This operator tests whether the internal data pointers are | |
880 | unequal (a fast test). | |
881 | ||
882 | \wxheading{Parameters} | |
883 | ||
884 | \docparam{image}{Image to compare with 'this'} | |
885 | ||
886 | \wxheading{Return value} | |
887 | ||
888 | Returns TRUE if the images were unequal, FALSE otherwise. | |
889 | ||
890 | \section{\class{wxImageHandler}}\label{wximagehandler} | |
891 | ||
1e6d9499 JS |
892 | This is the base class for implementing image file loading/saving, and image creation from data. |
893 | It is used within wxImage and is not normally seen by the application. | |
894 | ||
895 | If you wish to extend the capabilities of wxImage, derive a class from wxImageHandler | |
896 | and add the handler using \helpref{wxImage::AddHandler}{wximageaddhandler} in your | |
897 | application initialisation. | |
898 | ||
48b4e302 VS |
899 | \wxheading{Note (Legal Issue)} |
900 | ||
954b8ae6 | 901 | This software is based in part on the work of the Independent JPEG Group. |
48b4e302 VS |
902 | |
903 | (Applies when wxWindows is linked with JPEG support. wxJPEGHandler uses libjpeg | |
904 | created by IJG.) | |
905 | ||
1e6d9499 JS |
906 | \wxheading{Derived from} |
907 | ||
908 | \helpref{wxObject}{wxobject} | |
909 | ||
954b8ae6 JS |
910 | \wxheading{Include files} |
911 | ||
912 | <wx/image.h> | |
913 | ||
1e6d9499 JS |
914 | \wxheading{See also} |
915 | ||
fa482912 | 916 | \helpref{wxImage}{wximage}, |
b5a4a47d | 917 | \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} |
1e6d9499 JS |
918 | |
919 | \latexignore{\rtfignore{\wxheading{Members}}} | |
920 | ||
921 | \membersection{wxImageHandler::wxImageHandler}\label{wximagehandlerconstr} | |
922 | ||
923 | \func{}{wxImageHandler}{\void} | |
924 | ||
925 | Default constructor. In your own default constructor, initialise the members | |
926 | m\_name, m\_extension and m\_type. | |
927 | ||
928 | \membersection{wxImageHandler::\destruct{wxImageHandler}} | |
929 | ||
930 | \func{}{\destruct{wxImageHandler}}{\void} | |
931 | ||
932 | Destroys the wxImageHandler object. | |
933 | ||
934 | \membersection{wxImageHandler::GetName} | |
935 | ||
936 | \constfunc{wxString}{GetName}{\void} | |
937 | ||
938 | Gets the name of this handler. | |
939 | ||
940 | \membersection{wxImageHandler::GetExtension} | |
941 | ||
942 | \constfunc{wxString}{GetExtension}{\void} | |
943 | ||
944 | Gets the file extension associated with this handler. | |
945 | ||
649d13e8 | 946 | \membersection{wxImageHandler::GetImageCount}\label{wximagehandlergetimagecount} |
7941ba11 | 947 | |
649d13e8 | 948 | \func{int}{GetImageCount}{\param{wxInputStream\&}{ stream}} |
7941ba11 RR |
949 | |
950 | If the image file contains more than one image and the image handler is capable | |
951 | of retrieving these individually, this function will return the number of | |
952 | available images. | |
953 | ||
31fd9b6b | 954 | \docparam{stream}{Opened input stream for reading image data. Currently, the stream must support seeking.} |
7941ba11 RR |
955 | |
956 | \wxheading{Return value} | |
957 | ||
a61d25e6 VS |
958 | Number of available images. For most image handlers, this is 1 (exceptions |
959 | are TIFF and ICO formats). | |
7941ba11 | 960 | |
1e6d9499 JS |
961 | \membersection{wxImageHandler::GetType} |
962 | ||
963 | \constfunc{long}{GetType}{\void} | |
964 | ||
965 | Gets the image type associated with this handler. | |
966 | ||
9e9ee68e VS |
967 | \membersection{wxImageHandler::GetMimeType} |
968 | ||
969 | \constfunc{wxString}{GetMimeType}{\void} | |
970 | ||
971 | Gets the MIME type associated with this handler. | |
972 | ||
1e6d9499 JS |
973 | \membersection{wxImageHandler::LoadFile}\label{wximagehandlerloadfile} |
974 | ||
7941ba11 | 975 | \func{bool}{LoadFile}{\param{wxImage* }{image}, \param{wxInputStream\&}{ stream}, \param{bool}{ verbose=TRUE}, \param{int}{ index=0}} |
1e6d9499 | 976 | |
7941ba11 RR |
977 | Loads a image from a stream, putting the resulting data into {\it image}. If the image file contains |
978 | more than one image and the image handler is capable of retrieving these individually, {\it index} | |
979 | indicates which image to read from the stream. | |
1e6d9499 JS |
980 | |
981 | \wxheading{Parameters} | |
982 | ||
983 | \docparam{image}{The image object which is to be affected by this operation.} | |
984 | ||
31fd9b6b | 985 | \docparam{stream}{Opened input stream for reading image data.} |
7941ba11 RR |
986 | |
987 | \docparam{verbose}{If set to TRUE, errors reported by the image handler will produce wxLogMessages.} | |
988 | ||
989 | \docparam{index}{The index of the image in the file (starting from zero).} | |
1e6d9499 JS |
990 | |
991 | \wxheading{Return value} | |
992 | ||
993 | TRUE if the operation succeeded, FALSE otherwise. | |
994 | ||
995 | \wxheading{See also} | |
996 | ||
fa482912 JS |
997 | \helpref{wxImage::LoadFile}{wximageloadfile}, |
998 | \helpref{wxImage::SaveFile}{wximagesavefile}, | |
1e6d9499 JS |
999 | \helpref{wxImageHandler::SaveFile}{wximagehandlersavefile} |
1000 | ||
1001 | \membersection{wxImageHandler::SaveFile}\label{wximagehandlersavefile} | |
1002 | ||
45b5751f | 1003 | \func{bool}{SaveFile}{\param{wxImage* }{image}, \param{wxOutputStream\& }{stream}} |
1e6d9499 | 1004 | |
45b5751f | 1005 | Saves a image in the output stream. |
1e6d9499 JS |
1006 | |
1007 | \wxheading{Parameters} | |
1008 | ||
1009 | \docparam{image}{The image object which is to be affected by this operation.} | |
1010 | ||
31fd9b6b | 1011 | \docparam{stream}{Opened output stream for writing the data.} |
1e6d9499 JS |
1012 | |
1013 | \wxheading{Return value} | |
1014 | ||
1015 | TRUE if the operation succeeded, FALSE otherwise. | |
1016 | ||
1017 | \wxheading{See also} | |
1018 | ||
fa482912 JS |
1019 | \helpref{wxImage::LoadFile}{wximageloadfile}, |
1020 | \helpref{wxImage::SaveFile}{wximagesavefile}, | |
1e6d9499 JS |
1021 | \helpref{wxImageHandler::LoadFile}{wximagehandlerloadfile} |
1022 | ||
1023 | \membersection{wxImageHandler::SetName} | |
1024 | ||
1025 | \func{void}{SetName}{\param{const wxString\& }{name}} | |
1026 | ||
1027 | Sets the handler name. | |
1028 | ||
1029 | \wxheading{Parameters} | |
1030 | ||
1031 | \docparam{name}{Handler name.} | |
1032 | ||
1033 | \membersection{wxImageHandler::SetExtension} | |
1034 | ||
1035 | \func{void}{SetExtension}{\param{const wxString\& }{extension}} | |
1036 | ||
1037 | Sets the handler extension. | |
1038 | ||
1039 | \wxheading{Parameters} | |
1040 | ||
1041 | \docparam{extension}{Handler extension.} | |
1042 | ||
f6bcfd97 | 1043 | \membersection{wxImageHandler::SetMimeType}\label{wximagehandlersetmimetype} |
1e6d9499 | 1044 | |
f6bcfd97 | 1045 | \func{void}{SetMimeType}{\param{const wxString\& }{mimetype}} |
1e6d9499 | 1046 | |
f6bcfd97 | 1047 | Sets the handler MIME type. |
1e6d9499 JS |
1048 | |
1049 | \wxheading{Parameters} | |
1050 | ||
f6bcfd97 | 1051 | \docparam{mimename}{Handler MIME type.} |
9e9ee68e | 1052 | |
f6bcfd97 | 1053 | \membersection{wxImageHandler::SetType} |
9e9ee68e | 1054 | |
f6bcfd97 | 1055 | \func{void}{SetType}{\param{long }{type}} |
9e9ee68e | 1056 | |
f6bcfd97 | 1057 | Sets the handler type. |
9e9ee68e VS |
1058 | |
1059 | \wxheading{Parameters} | |
1060 | ||
f6bcfd97 | 1061 | \docparam{name}{Handler type.} |
9e9ee68e | 1062 |