]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: image.h | |
427c415b | 3 | // Purpose: interface of wxImageHandler and wxImage |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
09b898e0 VZ |
9 | /** |
10 | Possible values for the image resolution option. | |
11 | ||
12 | @see wxImage::GetOptionInt(). | |
13 | */ | |
14 | enum wxImageResolution | |
15 | { | |
16 | /// Resolution not specified. | |
17 | wxIMAGE_RESOLUTION_NONE = 0, | |
18 | ||
19 | /// Resolution specified in inches. | |
20 | wxIMAGE_RESOLUTION_INCHES = 1, | |
21 | ||
22 | /// Resolution specified in centimetres. | |
23 | wxIMAGE_RESOLUTION_CM = 2 | |
24 | }; | |
25 | ||
26 | /** | |
27 | Possible values for PNG image type option. | |
28 | ||
29 | @see wxImage::GetOptionInt(). | |
30 | */ | |
31 | enum wxImagePNGType | |
32 | { | |
33 | wxPNG_TYPE_COLOUR = 0, ///< Colour PNG image. | |
34 | wxPNG_TYPE_GREY = 2, ///< Greyscale PNG image converted from RGB. | |
35 | wxPNG_TYPE_GREY_RED = 3 ///< Greyscale PNG image using red as grey. | |
36 | }; | |
37 | ||
23324ae1 FM |
38 | /** |
39 | @class wxImageHandler | |
7c913512 | 40 | |
b3623ed5 RR |
41 | This is the base class for implementing image file loading/saving, and |
42 | image creation from data. | |
23324ae1 | 43 | It is used within wxImage and is not normally seen by the application. |
7c913512 | 44 | |
23324ae1 | 45 | If you wish to extend the capabilities of wxImage, derive a class from |
b3623ed5 | 46 | wxImageHandler and add the handler using wxImage::AddHandler in your |
23324ae1 | 47 | application initialisation. |
7c913512 | 48 | |
427c415b FM |
49 | Note that all wxImageHandlers provided by wxWidgets are part of |
50 | the @ref page_libs_wxcore library. | |
51 | For details about the default handlers, please see the section | |
52 | @ref image_handlers in the wxImage class documentation. | |
53 | ||
54 | ||
55 | @section imagehandler_note Note (Legal Issue) | |
56 | ||
57 | This software is based in part on the work of the Independent JPEG Group. | |
58 | (Applies when wxWidgets is linked with JPEG support. | |
59 | wxJPEGHandler uses libjpeg created by IJG.) | |
60 | ||
61 | ||
b3623ed5 RR |
62 | @stdobjects |
63 | ::wxNullImage | |
64 | ||
23324ae1 | 65 | @library{wxcore} |
427c415b | 66 | @category{misc} |
7c913512 | 67 | |
e54c96f1 | 68 | @see wxImage, wxInitAllImageHandlers() |
23324ae1 FM |
69 | */ |
70 | class wxImageHandler : public wxObject | |
71 | { | |
72 | public: | |
73 | /** | |
427c415b FM |
74 | Default constructor. |
75 | ||
76 | In your own default constructor, initialise the members | |
23324ae1 FM |
77 | m_name, m_extension and m_type. |
78 | */ | |
79 | wxImageHandler(); | |
80 | ||
81 | /** | |
82 | Destroys the wxImageHandler object. | |
83 | */ | |
adaaa686 | 84 | virtual ~wxImageHandler(); |
23324ae1 FM |
85 | |
86 | /** | |
87 | Gets the file extension associated with this handler. | |
88 | */ | |
427c415b | 89 | const wxString& GetExtension() const; |
23324ae1 FM |
90 | |
91 | /** | |
92 | If the image file contains more than one image and the image handler is capable | |
93 | of retrieving these individually, this function will return the number of | |
94 | available images. | |
3c4f71cc | 95 | |
7c913512 | 96 | @param stream |
427c415b FM |
97 | Opened input stream for reading image data. |
98 | Currently, the stream must support seeking. | |
3c4f71cc | 99 | |
d29a9a8a | 100 | @return Number of available images. For most image handlers, this is 1 |
427c415b | 101 | (exceptions are TIFF and ICO formats). |
23324ae1 | 102 | */ |
adaaa686 | 103 | virtual int GetImageCount(wxInputStream& stream); |
23324ae1 FM |
104 | |
105 | /** | |
106 | Gets the MIME type associated with this handler. | |
107 | */ | |
427c415b | 108 | const wxString& GetMimeType() const; |
23324ae1 FM |
109 | |
110 | /** | |
111 | Gets the name of this handler. | |
112 | */ | |
427c415b | 113 | const wxString& GetName() const; |
23324ae1 FM |
114 | |
115 | /** | |
116 | Gets the image type associated with this handler. | |
117 | */ | |
e98e625c | 118 | wxBitmapType GetType() const; |
23324ae1 FM |
119 | |
120 | /** | |
427c415b FM |
121 | Loads a image from a stream, putting the resulting data into @a image. |
122 | ||
123 | If the image file contains more than one image and the image handler is | |
124 | capable of retrieving these individually, @a index indicates which image | |
125 | to read from the stream. | |
3c4f71cc | 126 | |
7c913512 | 127 | @param image |
4cc4bfaf | 128 | The image object which is to be affected by this operation. |
7c913512 | 129 | @param stream |
4cc4bfaf | 130 | Opened input stream for reading image data. |
7c913512 | 131 | @param verbose |
4cc4bfaf | 132 | If set to @true, errors reported by the image handler will produce |
427c415b | 133 | wxLogMessages. |
7c913512 | 134 | @param index |
4cc4bfaf | 135 | The index of the image in the file (starting from zero). |
3c4f71cc | 136 | |
d29a9a8a | 137 | @return @true if the operation succeeded, @false otherwise. |
3c4f71cc | 138 | |
4cc4bfaf | 139 | @see wxImage::LoadFile, wxImage::SaveFile, SaveFile() |
23324ae1 | 140 | */ |
5267aefd FM |
141 | virtual bool LoadFile(wxImage* image, wxInputStream& stream, |
142 | bool verbose = true, int index = -1); | |
23324ae1 FM |
143 | |
144 | /** | |
145 | Saves a image in the output stream. | |
3c4f71cc | 146 | |
7c913512 | 147 | @param image |
4cc4bfaf | 148 | The image object which is to be affected by this operation. |
7c913512 | 149 | @param stream |
4cc4bfaf | 150 | Opened output stream for writing the data. |
f21dd16b FM |
151 | @param verbose |
152 | If set to @true, errors reported by the image handler will produce | |
153 | wxLogMessages. | |
3c4f71cc | 154 | |
d29a9a8a | 155 | @return @true if the operation succeeded, @false otherwise. |
3c4f71cc | 156 | |
4cc4bfaf | 157 | @see wxImage::LoadFile, wxImage::SaveFile, LoadFile() |
23324ae1 | 158 | */ |
5267aefd FM |
159 | virtual bool SaveFile(wxImage* image, wxOutputStream& stream, |
160 | bool verbose = true); | |
23324ae1 FM |
161 | |
162 | /** | |
163 | Sets the handler extension. | |
3c4f71cc | 164 | |
7c913512 | 165 | @param extension |
4cc4bfaf | 166 | Handler extension. |
23324ae1 FM |
167 | */ |
168 | void SetExtension(const wxString& extension); | |
169 | ||
170 | /** | |
171 | Sets the handler MIME type. | |
3c4f71cc | 172 | |
427c415b | 173 | @param mimetype |
4cc4bfaf | 174 | Handler MIME type. |
23324ae1 FM |
175 | */ |
176 | void SetMimeType(const wxString& mimetype); | |
177 | ||
178 | /** | |
179 | Sets the handler name. | |
3c4f71cc | 180 | |
7c913512 | 181 | @param name |
4cc4bfaf | 182 | Handler name. |
23324ae1 FM |
183 | */ |
184 | void SetName(const wxString& name); | |
185 | }; | |
186 | ||
187 | ||
427c415b FM |
188 | /** |
189 | Constant used to indicate the alpha value conventionally defined as | |
190 | the complete transparency. | |
191 | */ | |
192 | const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0; | |
193 | ||
194 | /** | |
195 | Constant used to indicate the alpha value conventionally defined as | |
196 | the complete opacity. | |
197 | */ | |
198 | const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff; | |
e54c96f1 | 199 | |
23324ae1 FM |
200 | /** |
201 | @class wxImage | |
7c913512 | 202 | |
427c415b FM |
203 | This class encapsulates a platform-independent image. |
204 | ||
205 | An image can be created from data, or using wxBitmap::ConvertToImage. | |
206 | An image can be loaded from a file in a variety of formats, and is extensible | |
207 | to new formats via image format handlers. Functions are available to set and | |
b3623ed5 | 208 | get image bits, so it can be used for basic image manipulation. |
7c913512 | 209 | |
427c415b FM |
210 | A wxImage cannot (currently) be drawn directly to a wxDC. |
211 | Instead, a platform-specific wxBitmap object must be created from it using | |
23324ae1 | 212 | the wxBitmap::wxBitmap(wxImage,int depth) constructor. |
b3623ed5 | 213 | This bitmap can then be drawn in a device context, using wxDC::DrawBitmap. |
7c913512 | 214 | |
23324ae1 | 215 | One colour value of the image may be used as a mask colour which will lead to |
65874118 | 216 | the automatic creation of a wxMask object associated to the bitmap object. |
7c913512 | 217 | |
427c415b FM |
218 | |
219 | @section image_alpha Alpha channel support | |
220 | ||
221 | Starting from wxWidgets 2.5.0 wxImage supports alpha channel data, that is | |
222 | in addition to a byte for the red, green and blue colour components for each | |
223 | pixel it also stores a byte representing the pixel opacity. | |
224 | ||
225 | An alpha value of 0 corresponds to a transparent pixel (null opacity) while | |
226 | a value of 255 means that the pixel is 100% opaque. | |
227 | The constants ::wxIMAGE_ALPHA_TRANSPARENT and ::wxIMAGE_ALPHA_OPAQUE can be | |
228 | used to indicate those values in a more readable form. | |
229 | ||
230 | Unlike RGB data, not all images have an alpha channel and before using | |
231 | wxImage::GetAlpha you should check if this image contains an alpha channel | |
232 | with wxImage::HasAlpha. Note that currently only the PNG format has full | |
233 | alpha channel support so only the images loaded from PNG files can have | |
234 | alpha and, if you initialize the image alpha channel yourself using | |
235 | wxImage::SetAlpha, you should save it in PNG format to avoid losing it. | |
236 | ||
237 | ||
238 | @section image_handlers Available image handlers | |
239 | ||
240 | The following image handlers are available. | |
241 | wxBMPHandler is always installed by default. | |
242 | To use other image formats, install the appropriate handler with | |
243 | wxImage::AddHandler or call ::wxInitAllImageHandlers(). | |
244 | ||
245 | - wxBMPHandler: For loading and saving, always installed. | |
246 | - wxPNGHandler: For loading (including alpha support) and saving. | |
247 | - wxJPEGHandler: For loading and saving. | |
248 | - wxGIFHandler: Only for loading, due to legal issues. | |
249 | - wxPCXHandler: For loading and saving (see below). | |
250 | - wxPNMHandler: For loading and saving (see below). | |
251 | - wxTIFFHandler: For loading and saving. | |
252 | - wxTGAHandler: For loading only. | |
253 | - wxIFFHandler: For loading only. | |
254 | - wxXPMHandler: For loading and saving. | |
255 | - wxICOHandler: For loading and saving. | |
256 | - wxCURHandler: For loading and saving. | |
257 | - wxANIHandler: For loading only. | |
258 | ||
259 | When saving in PCX format, wxPCXHandler will count the number of different | |
260 | colours in the image; if there are 256 or less colours, it will save as 8 bit, | |
261 | else it will save as 24 bit. | |
262 | ||
263 | Loading PNMs only works for ASCII or raw RGB images. | |
264 | When saving in PNM format, wxPNMHandler will always save as raw RGB. | |
265 | ||
266 | ||
23324ae1 FM |
267 | @library{wxcore} |
268 | @category{gdi} | |
7c913512 | 269 | |
65874118 FM |
270 | @stdobjects |
271 | ::wxNullImage | |
272 | ||
4e2cddc4 | 273 | @see wxBitmap, wxInitAllImageHandlers(), wxPixelData |
23324ae1 FM |
274 | */ |
275 | class wxImage : public wxObject | |
276 | { | |
277 | public: | |
427c415b FM |
278 | class RGBValue |
279 | { | |
280 | public: | |
281 | /** | |
282 | Constructor for RGBValue, an object that contains values for red, green | |
283 | and blue which represent the value of a color. | |
284 | ||
285 | It is used by wxImage::HSVtoRGB and wxImage::RGBtoHSV, which converts | |
286 | between HSV color space and RGB color space. | |
287 | */ | |
288 | RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0); | |
289 | }; | |
290 | ||
291 | class HSVValue | |
292 | { | |
293 | public: | |
294 | /** | |
295 | Constructor for HSVValue, an object that contains values for hue, saturation | |
296 | and value which represent the value of a color. | |
297 | ||
298 | It is used by wxImage::HSVtoRGB() and wxImage::RGBtoHSV(), which converts | |
299 | between HSV color space and RGB color space. | |
300 | */ | |
301 | HSVValue(double h=0.0, double s=0.0, double v=0.0); | |
302 | }; | |
303 | ||
304 | /** | |
305 | Creates an empty wxImage object without an alpha channel. | |
b3623ed5 RR |
306 | */ |
307 | wxImage(); | |
e98e625c | 308 | |
b3623ed5 | 309 | /** |
ff3050e1 VZ |
310 | Creates an image with the given size and clears it if requested. |
311 | ||
312 | Does not create an alpha channel. | |
e98e625c | 313 | |
b3623ed5 RR |
314 | @param width |
315 | Specifies the width of the image. | |
316 | @param height | |
317 | Specifies the height of the image. | |
ff3050e1 VZ |
318 | @param clear |
319 | If @true, initialize the image to black. | |
b3623ed5 RR |
320 | */ |
321 | wxImage(int width, int height, bool clear = true); | |
e98e625c | 322 | |
23324ae1 | 323 | /** |
427c415b | 324 | Creates an image from data in memory. If @a static_data is @false |
dd067e96 RR |
325 | then the wxImage will take ownership of the data and free it |
326 | afterwards. For this, it has to be allocated with @e malloc. | |
e98e625c | 327 | |
7c913512 | 328 | @param width |
4cc4bfaf | 329 | Specifies the width of the image. |
7c913512 | 330 | @param height |
4cc4bfaf | 331 | Specifies the height of the image. |
dd067e96 RR |
332 | @param data |
333 | A pointer to RGB data | |
4e2cddc4 RR |
334 | @param static_data |
335 | Indicates if the data should be free'd after use | |
e98e625c | 336 | |
dd067e96 | 337 | */ |
dd067e96 | 338 | wxImage(int width, int height, unsigned char* data, bool static_data = false); |
e98e625c | 339 | |
dd067e96 | 340 | /** |
427c415b | 341 | Creates an image from data in memory. If @a static_data is @false |
b3623ed5 RR |
342 | then the wxImage will take ownership of the data and free it |
343 | afterwards. For this, it has to be allocated with @e malloc. | |
e98e625c | 344 | |
dd067e96 RR |
345 | @param width |
346 | Specifies the width of the image. | |
347 | @param height | |
348 | Specifies the height of the image. | |
b3623ed5 RR |
349 | @param data |
350 | A pointer to RGB data | |
351 | @param alpha | |
352 | A pointer to alpha-channel data | |
353 | @param static_data | |
354 | Indicates if the data should be free'd after use | |
e98e625c | 355 | |
4e2cddc4 | 356 | */ |
427c415b FM |
357 | wxImage(int width, int height, unsigned char* data, unsigned char* alpha, |
358 | bool static_data = false ); | |
e98e625c | 359 | |
dd067e96 RR |
360 | /** |
361 | Creates an image from XPM data. | |
e98e625c | 362 | |
dd067e96 RR |
363 | @param xpmData |
364 | A pointer to XPM image data. | |
365 | */ | |
366 | wxImage(const char* const* xpmData); | |
e98e625c | 367 | |
dd067e96 | 368 | /** |
b3623ed5 | 369 | Creates an image from a file. |
e98e625c | 370 | |
7c913512 | 371 | @param name |
4cc4bfaf | 372 | Name of the file from which to load the image. |
7c913512 | 373 | @param type |
4cc4bfaf | 374 | May be one of the following: |
4e2cddc4 RR |
375 | @li wxBITMAP_TYPE_BMP: Load a Windows bitmap file. |
376 | @li wxBITMAP_TYPE_GIF: Load a GIF bitmap file. | |
377 | @li wxBITMAP_TYPE_JPEG: Load a JPEG bitmap file. | |
378 | @li wxBITMAP_TYPE_PNG: Load a PNG bitmap file. | |
379 | @li wxBITMAP_TYPE_PCX: Load a PCX bitmap file. | |
380 | @li wxBITMAP_TYPE_PNM: Load a PNM bitmap file. | |
381 | @li wxBITMAP_TYPE_TIF: Load a TIFF bitmap file. | |
382 | @li wxBITMAP_TYPE_TGA: Load a TGA bitmap file. | |
383 | @li wxBITMAP_TYPE_XPM: Load a XPM bitmap file. | |
384 | @li wxBITMAP_TYPE_ICO: Load a Windows icon file (ICO). | |
385 | @li wxBITMAP_TYPE_CUR: Load a Windows cursor file (CUR). | |
386 | @li wxBITMAP_TYPE_ANI: Load a Windows animated cursor file (ANI). | |
387 | @li wxBITMAP_TYPE_ANY: Will try to autodetect the format. | |
4cc4bfaf FM |
388 | @param index |
389 | Index of the image to load in the case that the image file contains | |
dd067e96 RR |
390 | multiple images. This is only used by GIF, ICO and TIFF handlers. |
391 | The default value (-1) means "choose the default image" and is | |
392 | interpreted as the first image (index=0) by the GIF and TIFF handler | |
393 | and as the largest and most colourful one by the ICO handler. | |
3c4f71cc | 394 | |
427c415b FM |
395 | @remarks Depending on how wxWidgets has been configured and by which |
396 | handlers have been loaded, not all formats may be available. | |
397 | Any handler other than BMP must be previously initialized with | |
398 | wxImage::AddHandler or wxInitAllImageHandlers. | |
399 | ||
400 | @note | |
401 | You can use GetOptionInt() to get the hotspot when loading cursor files: | |
402 | @code | |
403 | int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X); | |
404 | int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y); | |
405 | @endcode | |
3c4f71cc | 406 | |
4cc4bfaf | 407 | @see LoadFile() |
23324ae1 | 408 | */ |
e98e625c VZ |
409 | wxImage(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1); |
410 | ||
b3623ed5 RR |
411 | /** |
412 | Creates an image from a file using MIME-types to specify the type. | |
e98e625c | 413 | |
b3623ed5 RR |
414 | @param name |
415 | Name of the file from which to load the image. | |
b3623ed5 RR |
416 | @param mimetype |
417 | MIME type string (for example 'image/jpeg') | |
418 | @param index | |
427c415b | 419 | See description in wxImage(const wxString&, wxBitmapType, int) overload. |
b3623ed5 | 420 | */ |
dd067e96 | 421 | wxImage(const wxString& name, const wxString& mimetype, int index = -1); |
e98e625c | 422 | |
b3623ed5 RR |
423 | /** |
424 | Creates an image from a stream. | |
e98e625c | 425 | |
b3623ed5 RR |
426 | @param stream |
427 | Opened input stream from which to load the image. Currently, | |
428 | the stream must support seeking. | |
429 | @param type | |
427c415b | 430 | See description in wxImage(const wxString&, wxBitmapType, int) overload. |
b3623ed5 | 431 | @param index |
427c415b | 432 | See description in wxImage(const wxString&, wxBitmapType, int) overload. |
b3623ed5 | 433 | */ |
e98e625c VZ |
434 | wxImage(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1); |
435 | ||
b3623ed5 RR |
436 | /** |
437 | Creates an image from a stream using MIME-types to specify the type. | |
e98e625c | 438 | |
b3623ed5 RR |
439 | @param stream |
440 | Opened input stream from which to load the image. Currently, | |
441 | the stream must support seeking. | |
442 | @param mimetype | |
443 | MIME type string (for example 'image/jpeg') | |
444 | @param index | |
427c415b | 445 | See description in wxImage(const wxString&, wxBitmapType, int) overload. |
b3623ed5 | 446 | */ |
dd067e96 | 447 | wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1); |
e98e625c | 448 | |
23324ae1 FM |
449 | |
450 | /** | |
451 | Destructor. | |
427c415b FM |
452 | |
453 | See @ref overview_refcount_destruct "reference-counted object destruction" | |
454 | for more info. | |
23324ae1 | 455 | */ |
adaaa686 | 456 | virtual ~wxImage(); |
23324ae1 | 457 | |
23324ae1 | 458 | /** |
b3623ed5 | 459 | Register an image handler. |
23324ae1 FM |
460 | */ |
461 | static void AddHandler(wxImageHandler* handler); | |
23324ae1 FM |
462 | |
463 | /** | |
b3623ed5 | 464 | Blurs the image in both horizontal and vertical directions by the |
427c415b | 465 | specified pixel @a blurRadius. This should not be used when using |
b3623ed5 | 466 | a single mask colour for transparency. |
3c4f71cc | 467 | |
b3623ed5 | 468 | @see BlurHorizontal(), BlurVertical() |
23324ae1 | 469 | */ |
adaaa686 | 470 | wxImage Blur(int blurRadius) const; |
23324ae1 FM |
471 | |
472 | /** | |
473 | Blurs the image in the horizontal direction only. This should not be used | |
474 | when using a single mask colour for transparency. | |
3c4f71cc | 475 | |
b3623ed5 | 476 | @see Blur(), BlurVertical() |
23324ae1 | 477 | */ |
adaaa686 | 478 | wxImage BlurHorizontal(int blurRadius) const; |
23324ae1 FM |
479 | |
480 | /** | |
481 | Blurs the image in the vertical direction only. This should not be used | |
482 | when using a single mask colour for transparency. | |
3c4f71cc | 483 | |
b3623ed5 | 484 | @see Blur(), BlurHorizontal() |
23324ae1 | 485 | */ |
adaaa686 | 486 | wxImage BlurVertical(int blurRadius) const; |
e98e625c | 487 | |
b3623ed5 RR |
488 | /** |
489 | Returns @true if the current image handlers can read this file | |
490 | */ | |
adaaa686 | 491 | static bool CanRead(const wxString& filename); |
23324ae1 FM |
492 | |
493 | /** | |
494 | Deletes all image handlers. | |
23324ae1 FM |
495 | This function is called by wxWidgets on exit. |
496 | */ | |
497 | static void CleanUpHandlers(); | |
498 | ||
499 | /** | |
4cc4bfaf | 500 | Computes the histogram of the image. @a histogram is a reference to |
23324ae1 FM |
501 | wxImageHistogram object. wxImageHistogram is a specialization of |
502 | wxHashMap "template" and is defined as follows: | |
3c4f71cc | 503 | |
427c415b FM |
504 | @code |
505 | class WXDLLEXPORT wxImageHistogramEntry | |
506 | { | |
507 | public: | |
508 | wxImageHistogramEntry() : index(0), value(0) {} | |
509 | unsigned long index; | |
510 | unsigned long value; | |
511 | }; | |
512 | ||
513 | WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry, | |
514 | wxIntegerHash, wxIntegerEqual, | |
515 | wxImageHistogram); | |
516 | @endcode | |
517 | ||
d29a9a8a | 518 | @return Returns number of colours in the histogram. |
23324ae1 | 519 | */ |
328f5751 | 520 | unsigned long ComputeHistogram(wxImageHistogram& histogram) const; |
23324ae1 | 521 | |
c1099d92 | 522 | //@{ |
23324ae1 | 523 | /** |
427c415b FM |
524 | If the image has alpha channel, this method converts it to mask. |
525 | ||
c1099d92 VZ |
526 | If the image has an alpha channel, all pixels with alpha value less |
527 | than @a threshold are replaced with the mask colour and the alpha | |
528 | channel is removed. Otherwise nothing is done. | |
529 | ||
530 | The mask colour is chosen automatically using | |
531 | FindFirstUnusedColour() by this function, see the overload below if you | |
532 | this is not appropriate. | |
3c4f71cc | 533 | |
d29a9a8a | 534 | @return @false if FindFirstUnusedColour returns @false, @true otherwise. |
23324ae1 | 535 | */ |
5267aefd | 536 | bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); |
23324ae1 | 537 | |
c1099d92 VZ |
538 | /** |
539 | If the image has alpha channel, this method converts it to mask using | |
540 | the specified colour as the mask colour. | |
541 | ||
542 | If the image has an alpha channel, all pixels with alpha value less | |
543 | than @a threshold are replaced with the mask colour and the alpha | |
544 | channel is removed. Otherwise nothing is done. | |
545 | ||
546 | @since 2.9.0 | |
547 | ||
548 | @param mr | |
549 | The red component of the mask colour. | |
550 | @param mg | |
551 | The green component of the mask colour. | |
552 | @param mb | |
553 | The blue component of the mask colour. | |
554 | @param threshold | |
555 | Pixels with alpha channel values below the given threshold are | |
556 | considered to be transparent, i.e. the corresponding mask pixels | |
557 | are set. Pixels with the alpha values above the threshold are | |
558 | considered to be opaque. | |
559 | ||
560 | */ | |
561 | void ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb, | |
562 | unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD); | |
563 | //@} | |
564 | ||
23324ae1 | 565 | /** |
427c415b FM |
566 | Returns a greyscale version of the image. |
567 | ||
568 | The returned image uses the luminance component of the original to | |
569 | calculate the greyscale. Defaults to using the standard ITU-T BT.601 | |
570 | when converting to YUV, where every pixel equals | |
571 | (R * @a lr) + (G * @a lg) + (B * @a lb). | |
23324ae1 | 572 | */ |
5267aefd | 573 | wxImage ConvertToGreyscale(double lr = 0.299, double lg = 0.587, double lb = 1.114) const; |
23324ae1 FM |
574 | |
575 | /** | |
427c415b FM |
576 | Returns monochromatic version of the image. |
577 | ||
578 | The returned image has white colour where the original has @e (r,g,b) | |
579 | colour and black colour everywhere else. | |
23324ae1 | 580 | */ |
427c415b | 581 | wxImage ConvertToMono(unsigned char r, unsigned char g, unsigned char b) const; |
23324ae1 FM |
582 | |
583 | /** | |
584 | Returns an identical copy of the image. | |
585 | */ | |
328f5751 | 586 | wxImage Copy() const; |
23324ae1 FM |
587 | |
588 | /** | |
ff3050e1 VZ |
589 | Creates a fresh image. |
590 | ||
591 | If @a clear is @true, the new image will be initialized to black. | |
23324ae1 | 592 | Otherwise, the image data will be uninitialized. |
3c4f71cc | 593 | |
7c913512 | 594 | @param width |
4cc4bfaf | 595 | The width of the image in pixels. |
7c913512 | 596 | @param height |
4cc4bfaf | 597 | The height of the image in pixels. |
ff3050e1 | 598 | @param clear |
fc3762b5 | 599 | If @true, initialize the image data with zeroes. |
3c4f71cc | 600 | |
d29a9a8a | 601 | @return @true if the call succeeded, @false otherwise. |
23324ae1 | 602 | */ |
4cc4bfaf | 603 | bool Create(int width, int height, bool clear = true); |
23324ae1 | 604 | |
fc3762b5 FM |
605 | /** |
606 | Initialize the image data with zeroes (the default) or with the | |
607 | byte value given as @a value. | |
608 | ||
609 | @since 2.9.0 | |
610 | */ | |
611 | void Clear(unsigned char value = 0); | |
612 | ||
23324ae1 FM |
613 | /** |
614 | Destroys the image data. | |
615 | */ | |
616 | void Destroy(); | |
617 | ||
618 | /** | |
427c415b FM |
619 | Finds the first colour that is never used in the image. |
620 | The search begins at given initial colour and continues by increasing | |
621 | R, G and B components (in this order) by 1 until an unused colour is | |
622 | found or the colour space exhausted. | |
623 | ||
624 | The parameters @a r, @a g, @a b are pointers to variables to save the colour. | |
625 | ||
626 | The parameters @a startR, @a startG, @a startB define the initial values | |
627 | of the colour. | |
628 | The returned colour will have RGB values equal to or greater than these. | |
3c4f71cc | 629 | |
d29a9a8a | 630 | @return Returns @false if there is no unused colour left, @true on success. |
427c415b FM |
631 | |
632 | @note | |
633 | This method involves computing the histogram, which is a | |
634 | computationally intensive operation. | |
23324ae1 | 635 | */ |
4cc4bfaf | 636 | bool FindFirstUnusedColour(unsigned char* r, unsigned char* g, |
adaaa686 | 637 | unsigned char* b, unsigned char startR = 1, |
23324ae1 | 638 | unsigned char startG = 0, |
adaaa686 | 639 | unsigned char startB = 0) const; |
23324ae1 | 640 | |
23324ae1 | 641 | /** |
427c415b | 642 | Finds the handler with the given name. |
3c4f71cc | 643 | |
7c913512 | 644 | @param name |
4cc4bfaf | 645 | The handler name. |
427c415b FM |
646 | |
647 | @return A pointer to the handler if found, @NULL otherwise. | |
648 | ||
649 | @see wxImageHandler | |
650 | */ | |
651 | static wxImageHandler* FindHandler(const wxString& name); | |
652 | ||
653 | /** | |
654 | Finds the handler associated with the given extension and type. | |
655 | ||
7c913512 | 656 | @param extension |
4cc4bfaf | 657 | The file extension, such as "bmp". |
7c913512 | 658 | @param imageType |
427c415b | 659 | The image type; one of the ::wxBitmapType values. |
3c4f71cc | 660 | |
d29a9a8a | 661 | @return A pointer to the handler if found, @NULL otherwise. |
3c4f71cc | 662 | |
4cc4bfaf | 663 | @see wxImageHandler |
23324ae1 | 664 | */ |
7c913512 | 665 | static wxImageHandler* FindHandler(const wxString& extension, |
e98e625c | 666 | wxBitmapType imageType); |
427c415b FM |
667 | |
668 | /** | |
669 | Finds the handler associated with the given image type. | |
670 | ||
671 | @param imageType | |
672 | The image type; one of the ::wxBitmapType values. | |
673 | ||
674 | @return A pointer to the handler if found, @NULL otherwise. | |
675 | ||
676 | @see wxImageHandler | |
677 | */ | |
e98e625c | 678 | static wxImageHandler* FindHandler(wxBitmapType imageType); |
427c415b FM |
679 | |
680 | /** | |
681 | Finds the handler associated with the given MIME type. | |
682 | ||
683 | @param mimetype | |
684 | MIME type. | |
685 | ||
686 | @return A pointer to the handler if found, @NULL otherwise. | |
687 | ||
688 | @see wxImageHandler | |
689 | */ | |
7c913512 | 690 | static wxImageHandler* FindHandlerMime(const wxString& mimetype); |
23324ae1 | 691 | |
b3623ed5 RR |
692 | /** |
693 | Return alpha value at given pixel location. | |
694 | */ | |
695 | unsigned char GetAlpha(int x, int y) const; | |
e98e625c | 696 | |
23324ae1 | 697 | /** |
427c415b FM |
698 | Returns pointer to the array storing the alpha values for this image. |
699 | ||
700 | This pointer is @NULL for the images without the alpha channel. If the image | |
23324ae1 | 701 | does have it, this pointer may be used to directly manipulate the alpha values |
b3623ed5 | 702 | which are stored as the RGB ones. |
23324ae1 | 703 | */ |
0a98423e | 704 | unsigned char* GetAlpha() const; |
23324ae1 FM |
705 | |
706 | /** | |
707 | Returns the blue intensity at the given coordinate. | |
708 | */ | |
328f5751 | 709 | unsigned char GetBlue(int x, int y) const; |
23324ae1 FM |
710 | |
711 | /** | |
427c415b FM |
712 | Returns the image data as an array. |
713 | ||
714 | This is most often used when doing direct image manipulation. | |
715 | The return value points to an array of characters in RGBRGBRGB... format | |
716 | in the top-to-bottom, left-to-right order, that is the first RGB triplet | |
717 | corresponds to the pixel first pixel of the first row, the second one --- | |
718 | to the second pixel of the first row and so on until the end of the first | |
719 | row, with second row following after it and so on. | |
720 | ||
721 | You should not delete the returned pointer nor pass it to SetData(). | |
23324ae1 | 722 | */ |
328f5751 | 723 | unsigned char* GetData() const; |
23324ae1 FM |
724 | |
725 | /** | |
726 | Returns the green intensity at the given coordinate. | |
727 | */ | |
328f5751 | 728 | unsigned char GetGreen(int x, int y) const; |
23324ae1 FM |
729 | |
730 | /** | |
731 | Returns the static list of image format handlers. | |
3c4f71cc | 732 | |
4cc4bfaf | 733 | @see wxImageHandler |
23324ae1 | 734 | */ |
382f12e4 | 735 | static wxList& GetHandlers(); |
23324ae1 FM |
736 | |
737 | /** | |
738 | Gets the height of the image in pixels. | |
c74b07ac FM |
739 | |
740 | @see GetWidth(), GetSize() | |
23324ae1 | 741 | */ |
328f5751 | 742 | int GetHeight() const; |
23324ae1 FM |
743 | |
744 | //@{ | |
745 | /** | |
427c415b FM |
746 | If the image file contains more than one image and the image handler is |
747 | capable of retrieving these individually, this function will return the | |
748 | number of available images. | |
749 | ||
750 | For the overload taking the parameter @a filename, that's the name | |
751 | of the file to query. | |
752 | For the overload taking the parameter @a stream, that's the ppened input | |
753 | stream with image data. Currently, the stream must support seeking. | |
754 | ||
755 | The parameter @a type may be one of the following values: | |
756 | @li wxBITMAP_TYPE_BMP: Load a Windows bitmap file. | |
757 | @li wxBITMAP_TYPE_GIF: Load a GIF bitmap file. | |
758 | @li wxBITMAP_TYPE_JPEG: Load a JPEG bitmap file. | |
759 | @li wxBITMAP_TYPE_PNG: Load a PNG bitmap file. | |
760 | @li wxBITMAP_TYPE_PCX: Load a PCX bitmap file. | |
761 | @li wxBITMAP_TYPE_PNM: Load a PNM bitmap file. | |
762 | @li wxBITMAP_TYPE_TIF: Load a TIFF bitmap file. | |
763 | @li wxBITMAP_TYPE_TGA: Load a TGA bitmap file. | |
764 | @li wxBITMAP_TYPE_XPM: Load a XPM bitmap file. | |
765 | @li wxBITMAP_TYPE_ICO: Load a Windows icon file (ICO). | |
766 | @li wxBITMAP_TYPE_CUR: Load a Windows cursor file (CUR). | |
767 | @li wxBITMAP_TYPE_ANI: Load a Windows animated cursor file (ANI). | |
768 | @li wxBITMAP_TYPE_ANY: Will try to autodetect the format. | |
3c4f71cc | 769 | |
d29a9a8a | 770 | @return Number of available images. For most image handlers, this is 1 |
427c415b | 771 | (exceptions are TIFF and ICO formats). |
23324ae1 FM |
772 | */ |
773 | static int GetImageCount(const wxString& filename, | |
e98e625c | 774 | wxBitmapType type = wxBITMAP_TYPE_ANY); |
7c913512 | 775 | static int GetImageCount(wxInputStream& stream, |
e98e625c | 776 | wxBitmapType type = wxBITMAP_TYPE_ANY); |
23324ae1 FM |
777 | //@} |
778 | ||
779 | /** | |
780 | Iterates all registered wxImageHandler objects, and returns a string containing | |
427c415b FM |
781 | file extension masks suitable for passing to file open/save dialog boxes. |
782 | ||
783 | @return The format of the returned string is @c "(*.ext1;*.ext2)|*.ext1;*.ext2". | |
784 | It is usually a good idea to prepend a description before passing | |
785 | the result to the dialog. | |
786 | Example: | |
787 | @code | |
788 | wxFileDialog FileDlg( this, "Choose Image", ::wxGetCwd(), "", | |
789 | _("Image Files ") + wxImage::GetImageExtWildcard(), | |
790 | wxFD_OPEN ); | |
791 | @endcode | |
3c4f71cc | 792 | |
4cc4bfaf | 793 | @see wxImageHandler |
23324ae1 FM |
794 | */ |
795 | static wxString GetImageExtWildcard(); | |
796 | ||
797 | /** | |
798 | Gets the blue value of the mask colour. | |
799 | */ | |
328f5751 | 800 | unsigned char GetMaskBlue() const; |
23324ae1 FM |
801 | |
802 | /** | |
803 | Gets the green value of the mask colour. | |
804 | */ | |
328f5751 | 805 | unsigned char GetMaskGreen() const; |
23324ae1 FM |
806 | |
807 | /** | |
808 | Gets the red value of the mask colour. | |
809 | */ | |
328f5751 | 810 | unsigned char GetMaskRed() const; |
23324ae1 FM |
811 | |
812 | /** | |
09b898e0 | 813 | Gets a user-defined string-valued option. |
427c415b | 814 | |
09b898e0 | 815 | Currently the only defined string option is |
d19ce8c4 | 816 | @li @c wxIMAGE_OPTION_FILENAME: The name of the file from which the image |
09b898e0 | 817 | was loaded. |
3c4f71cc | 818 | |
09b898e0 VZ |
819 | @param name |
820 | The name of the option, case-insensitive. | |
821 | @return | |
822 | The value of the option or an empty string if not found. Use | |
823 | HasOption() if an empty string can be a valid option value. | |
d19ce8c4 FM |
824 | |
825 | @see SetOption(), GetOptionInt(), HasOption() | |
23324ae1 | 826 | */ |
328f5751 | 827 | wxString GetOption(const wxString& name) const; |
23324ae1 FM |
828 | |
829 | /** | |
09b898e0 VZ |
830 | Gets a user-defined integer-valued option. |
831 | ||
427c415b FM |
832 | The function is case-insensitive to @a name. |
833 | If the given option is not present, the function returns 0. | |
4e2cddc4 | 834 | Use HasOption() is 0 is a possibly valid value for the option. |
427c415b | 835 | |
09b898e0 | 836 | Generic options: |
d19ce8c4 | 837 | @li @c wxIMAGE_OPTION_MAX_WIDTH and @c wxIMAGE_OPTION_MAX_HEIGHT: If either |
36abe9d4 VZ |
838 | of these options is specified, the loaded image will be scaled down |
839 | (preserving its aspect ratio) so that its width is less than the | |
840 | max width given if it is not 0 @em and its height is less than the | |
841 | max height given if it is not 0. This is typically used for loading | |
842 | thumbnails and the advantage of using these options compared to | |
843 | calling Rescale() after loading is that some handlers (only JPEG | |
844 | one right now) support rescaling the image during loading which is | |
845 | vastly more efficient than loading the entire huge image and | |
846 | rescaling it later (if these options are not supported by the | |
847 | handler, this is still what happens however). These options must be | |
848 | set before calling LoadFile() to have any effect. | |
849 | ||
d19ce8c4 | 850 | @li @c wxIMAGE_OPTION_QUALITY: JPEG quality used when saving. This is an |
09b898e0 VZ |
851 | integer in 0..100 range with 0 meaning very poor and 100 excellent |
852 | (but very badly compressed). This option is currently ignored for | |
853 | the other formats. | |
854 | ||
d19ce8c4 | 855 | @li @c wxIMAGE_OPTION_RESOLUTIONUNIT: The value of this option determines |
09b898e0 VZ |
856 | whether the resolution of the image is specified in centimetres or |
857 | inches, see wxImageResolution enum elements. | |
858 | ||
d19ce8c4 FM |
859 | @li @c wxIMAGE_OPTION_RESOLUTION, @c wxIMAGE_OPTION_RESOLUTIONX and |
860 | @c wxIMAGE_OPTION_RESOLUTIONY: These options define the resolution of | |
861 | the image in the units corresponding to @c wxIMAGE_OPTION_RESOLUTIONUNIT | |
09b898e0 VZ |
862 | options value. The first option can be set before saving the image |
863 | to set both horizontal and vertical resolution to the same value. | |
864 | The X and Y options are set by the image handlers if they support | |
865 | the image resolution (currently BMP, JPEG and TIFF handlers do) and | |
866 | the image provides the resolution information and can be queried | |
867 | after loading the image. | |
868 | ||
869 | Options specific to wxPNGHandler: | |
d19ce8c4 | 870 | @li @c wxIMAGE_OPTION_PNG_FORMAT: Format for saving a PNG file, see |
09b898e0 | 871 | wxImagePNGType for the supported values. |
d19ce8c4 FM |
872 | @li @c wxIMAGE_OPTION_PNG_BITDEPTH: Bit depth for every channel (R/G/B/A). |
873 | @li @c wxIMAGE_OPTION_PNG_FILTER: Filter for saving a PNG file, see libpng | |
874 | (http://www.libpng.org/pub/png/libpng-1.2.5-manual.html) for possible values | |
875 | (e.g. PNG_FILTER_NONE, PNG_FILTER_SUB, PNG_FILTER_UP, etc). | |
876 | @li @c wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL: Compression level (0..9) for | |
877 | saving a PNG file. An high value creates smaller-but-slower PNG file. | |
878 | Note that unlike other formats (e.g. JPEG) the PNG format is always | |
879 | lossless and thus this compression level doesn't tradeoff the image | |
880 | quality. | |
881 | @li @c wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL: Compression memory usage | |
882 | level (1..9) for saving a PNG file. An high value means the saving | |
883 | process consumes more memory, but may create smaller PNG file. | |
884 | @li @c wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY: Possible values are 0 for | |
885 | default strategy, 1 for filter, and 2 for Huffman-only. | |
886 | You can use OptiPNG (http://optipng.sourceforge.net/) to get a suitable | |
887 | value for your application. | |
888 | @li @c wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE: Internal buffer size | |
889 | (in bytes) for saving a PNG file. Ideally this should be as big as | |
890 | the resulting PNG file. Use this option if your application produces | |
891 | images with small size variation. | |
09b898e0 VZ |
892 | |
893 | @param name | |
894 | The name of the option, case-insensitive. | |
895 | @return | |
d19ce8c4 FM |
896 | The value of the option or 0 if not found. |
897 | Use HasOption() if 0 can be a valid option value. | |
898 | ||
899 | @see SetOption(), GetOption() | |
23324ae1 | 900 | */ |
328f5751 | 901 | int GetOptionInt(const wxString& name) const; |
23324ae1 FM |
902 | |
903 | /** | |
904 | Get the current mask colour or find a suitable unused colour that could be | |
905 | used as a mask colour. Returns @true if the image currently has a mask. | |
906 | */ | |
5267aefd FM |
907 | bool GetOrFindMaskColour(unsigned char* r, unsigned char* g, |
908 | unsigned char* b) const; | |
23324ae1 FM |
909 | |
910 | /** | |
427c415b FM |
911 | Returns the palette associated with the image. |
912 | Currently the palette is only used when converting to wxBitmap under Windows. | |
913 | ||
914 | Some of the wxImage handlers have been modified to set the palette if | |
915 | one exists in the image file (usually 256 or less colour images in | |
916 | GIF or PNG format). | |
23324ae1 | 917 | */ |
427c415b | 918 | const wxPalette& GetPalette() const; |
23324ae1 FM |
919 | |
920 | /** | |
921 | Returns the red intensity at the given coordinate. | |
922 | */ | |
328f5751 | 923 | unsigned char GetRed(int x, int y) const; |
23324ae1 FM |
924 | |
925 | /** | |
427c415b FM |
926 | Returns a sub image of the current one as long as the rect belongs entirely |
927 | to the image. | |
23324ae1 | 928 | */ |
328f5751 | 929 | wxImage GetSubImage(const wxRect& rect) const; |
23324ae1 | 930 | |
c74b07ac FM |
931 | /** |
932 | Returns the size of the image in pixels. | |
933 | ||
934 | @since 2.9.0 | |
935 | ||
936 | @see GetHeight(), GetWidth() | |
937 | */ | |
938 | wxSize GetSize() const; | |
939 | ||
591d3fa2 | 940 | /** |
427c415b FM |
941 | Gets the type of image found by LoadFile() or specified with SaveFile(). |
942 | ||
591d3fa2 VZ |
943 | @since 2.9.0 |
944 | */ | |
945 | wxBitmapType GetType() const; | |
946 | ||
23324ae1 FM |
947 | /** |
948 | Gets the width of the image in pixels. | |
3c4f71cc | 949 | |
c74b07ac | 950 | @see GetHeight(), GetSize() |
23324ae1 | 951 | */ |
328f5751 | 952 | int GetWidth() const; |
23324ae1 | 953 | |
23324ae1 FM |
954 | /** |
955 | Converts a color in HSV color space to RGB color space. | |
956 | */ | |
5267aefd | 957 | static wxImage::RGBValue HSVtoRGB(const wxImage::HSVValue& hsv); |
23324ae1 FM |
958 | |
959 | /** | |
960 | Returns @true if this image has alpha channel, @false otherwise. | |
3c4f71cc | 961 | |
4cc4bfaf | 962 | @see GetAlpha(), SetAlpha() |
23324ae1 | 963 | */ |
328f5751 | 964 | bool HasAlpha() const; |
23324ae1 FM |
965 | |
966 | /** | |
967 | Returns @true if there is a mask active, @false otherwise. | |
968 | */ | |
328f5751 | 969 | bool HasMask() const; |
23324ae1 FM |
970 | |
971 | /** | |
427c415b FM |
972 | Returns @true if the given option is present. |
973 | The function is case-insensitive to @a name. | |
3c4f71cc | 974 | |
d19ce8c4 FM |
975 | The lists of the currently supported options are in GetOption() and |
976 | GetOptionInt() function docs. | |
977 | ||
4cc4bfaf | 978 | @see SetOption(), GetOption(), GetOptionInt() |
23324ae1 | 979 | */ |
328f5751 | 980 | bool HasOption(const wxString& name) const; |
23324ae1 FM |
981 | |
982 | /** | |
427c415b FM |
983 | Initializes the image alpha channel data. |
984 | ||
985 | It is an error to call it if the image already has alpha data. | |
986 | If it doesn't, alpha data will be by default initialized to all pixels | |
987 | being fully opaque. But if the image has a mask colour, all mask pixels | |
988 | will be completely transparent. | |
23324ae1 FM |
989 | */ |
990 | void InitAlpha(); | |
991 | ||
992 | /** | |
427c415b FM |
993 | Internal use only. Adds standard image format handlers. |
994 | It only install wxBMPHandler for the time being, which is used by wxBitmap. | |
995 | ||
23324ae1 FM |
996 | This function is called by wxWidgets on startup, and shouldn't be called by |
997 | the user. | |
3c4f71cc | 998 | |
e54c96f1 | 999 | @see wxImageHandler, wxInitAllImageHandlers(), wxQuantize |
23324ae1 FM |
1000 | */ |
1001 | static void InitStandardHandlers(); | |
1002 | ||
1003 | /** | |
1004 | Adds a handler at the start of the static list of format handlers. | |
3c4f71cc | 1005 | |
7c913512 | 1006 | @param handler |
4cc4bfaf FM |
1007 | A new image format handler object. There is usually only one instance |
1008 | of a given handler class in an application session. | |
3c4f71cc | 1009 | |
4cc4bfaf | 1010 | @see wxImageHandler |
23324ae1 FM |
1011 | */ |
1012 | static void InsertHandler(wxImageHandler* handler); | |
1013 | ||
1014 | /** | |
1015 | Returns @true if image data is present. | |
1016 | */ | |
328f5751 | 1017 | bool IsOk() const; |
23324ae1 FM |
1018 | |
1019 | /** | |
1020 | Returns @true if the given pixel is transparent, i.e. either has the mask | |
1021 | colour if this image has a mask or if this image has alpha channel and alpha | |
427c415b | 1022 | value of this pixel is strictly less than @a threshold. |
23324ae1 | 1023 | */ |
5267aefd FM |
1024 | bool IsTransparent(int x, int y, |
1025 | unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const; | |
23324ae1 | 1026 | |
23324ae1 FM |
1027 | /** |
1028 | Loads an image from an input stream. | |
3c4f71cc | 1029 | |
7c913512 | 1030 | @param stream |
427c415b FM |
1031 | Opened input stream from which to load the image. |
1032 | Currently, the stream must support seeking. | |
7c913512 | 1033 | @param type |
dd067e96 | 1034 | May be one of the following: |
4e2cddc4 RR |
1035 | @li wxBITMAP_TYPE_BMP: Load a Windows bitmap file. |
1036 | @li wxBITMAP_TYPE_GIF: Load a GIF bitmap file. | |
1037 | @li wxBITMAP_TYPE_JPEG: Load a JPEG bitmap file. | |
1038 | @li wxBITMAP_TYPE_PNG: Load a PNG bitmap file. | |
1039 | @li wxBITMAP_TYPE_PCX: Load a PCX bitmap file. | |
1040 | @li wxBITMAP_TYPE_PNM: Load a PNM bitmap file. | |
1041 | @li wxBITMAP_TYPE_TIF: Load a TIFF bitmap file. | |
1042 | @li wxBITMAP_TYPE_TGA: Load a TGA bitmap file. | |
1043 | @li wxBITMAP_TYPE_XPM: Load a XPM bitmap file. | |
1044 | @li wxBITMAP_TYPE_ICO: Load a Windows icon file (ICO). | |
1045 | @li wxBITMAP_TYPE_CUR: Load a Windows cursor file (CUR). | |
1046 | @li wxBITMAP_TYPE_ANI: Load a Windows animated cursor file (ANI). | |
1047 | @li wxBITMAP_TYPE_ANY: Will try to autodetect the format. | |
7c913512 | 1048 | @param index |
4cc4bfaf | 1049 | Index of the image to load in the case that the image file contains |
dd067e96 RR |
1050 | multiple images. This is only used by GIF, ICO and TIFF handlers. |
1051 | The default value (-1) means "choose the default image" and is | |
1052 | interpreted as the first image (index=0) by the GIF and TIFF handler | |
1053 | and as the largest and most colourful one by the ICO handler. | |
3c4f71cc | 1054 | |
427c415b FM |
1055 | @return @true if the operation succeeded, @false otherwise. |
1056 | If the optional index parameter is out of range, @false is | |
1057 | returned and a call to wxLogError() takes place. | |
3c4f71cc | 1058 | |
23324ae1 | 1059 | @remarks Depending on how wxWidgets has been configured, not all formats |
4cc4bfaf | 1060 | may be available. |
3c4f71cc | 1061 | |
427c415b FM |
1062 | @note |
1063 | You can use GetOptionInt() to get the hotspot when loading cursor files: | |
1064 | @code | |
1065 | int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X); | |
1066 | int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y); | |
1067 | @endcode | |
1068 | ||
4cc4bfaf | 1069 | @see SaveFile() |
23324ae1 | 1070 | */ |
0a98423e FM |
1071 | virtual bool LoadFile(wxInputStream& stream, |
1072 | wxBitmapType type = wxBITMAP_TYPE_ANY, | |
1073 | int index = -1); | |
427c415b FM |
1074 | |
1075 | /** | |
1076 | Loads an image from a file. | |
1077 | If no handler type is provided, the library will try to autodetect the format. | |
1078 | ||
1079 | @param name | |
1080 | Name of the file from which to load the image. | |
1081 | @param type | |
1082 | See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload. | |
1083 | @param index | |
1084 | See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload. | |
1085 | */ | |
7323ff1a FM |
1086 | virtual bool LoadFile(const wxString& name, |
1087 | wxBitmapType type = wxBITMAP_TYPE_ANY, | |
1088 | int index = -1); | |
427c415b FM |
1089 | |
1090 | /** | |
1091 | Loads an image from a file. | |
1092 | If no handler type is provided, the library will try to autodetect the format. | |
1093 | ||
1094 | @param name | |
1095 | Name of the file from which to load the image. | |
1096 | @param mimetype | |
1097 | MIME type string (for example 'image/jpeg') | |
1098 | @param index | |
1099 | See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload. | |
1100 | */ | |
fadc2df6 FM |
1101 | virtual bool LoadFile(const wxString& name, const wxString& mimetype, |
1102 | int index = -1); | |
427c415b FM |
1103 | |
1104 | ||
1105 | /** | |
1106 | Loads an image from an input stream. | |
1107 | ||
1108 | @param stream | |
1109 | Opened input stream from which to load the image. | |
1110 | Currently, the stream must support seeking. | |
1111 | @param mimetype | |
1112 | MIME type string (for example 'image/jpeg') | |
1113 | @param index | |
1114 | See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload. | |
1115 | */ | |
7323ff1a FM |
1116 | virtual bool LoadFile(wxInputStream& stream, const wxString& mimetype, |
1117 | int index = -1); | |
23324ae1 FM |
1118 | |
1119 | /** | |
427c415b FM |
1120 | Returns a mirrored copy of the image. |
1121 | The parameter @a horizontally indicates the orientation. | |
23324ae1 | 1122 | */ |
328f5751 | 1123 | wxImage Mirror(bool horizontally = true) const; |
23324ae1 FM |
1124 | |
1125 | /** | |
4cc4bfaf | 1126 | Copy the data of the given @a image to the specified position in this image. |
23324ae1 FM |
1127 | */ |
1128 | void Paste(const wxImage& image, int x, int y); | |
1129 | ||
23324ae1 FM |
1130 | /** |
1131 | Converts a color in RGB color space to HSV color space. | |
1132 | */ | |
5267aefd | 1133 | static wxImage::HSVValue RGBtoHSV(const wxImage::RGBValue& rgb); |
23324ae1 FM |
1134 | |
1135 | /** | |
427c415b FM |
1136 | Finds the handler with the given name, and removes it. |
1137 | The handler is not deleted. | |
3c4f71cc | 1138 | |
7c913512 | 1139 | @param name |
4cc4bfaf | 1140 | The handler name. |
3c4f71cc | 1141 | |
d29a9a8a | 1142 | @return @true if the handler was found and removed, @false otherwise. |
3c4f71cc | 1143 | |
4cc4bfaf | 1144 | @see wxImageHandler |
23324ae1 FM |
1145 | */ |
1146 | static bool RemoveHandler(const wxString& name); | |
1147 | ||
1148 | /** | |
1149 | Replaces the colour specified by @e r1,g1,b1 by the colour @e r2,g2,b2. | |
1150 | */ | |
1151 | void Replace(unsigned char r1, unsigned char g1, | |
1152 | unsigned char b1, unsigned char r2, | |
1153 | unsigned char g2, unsigned char b2); | |
1154 | ||
1155 | /** | |
1156 | Changes the size of the image in-place by scaling it: after a call to this | |
427c415b FM |
1157 | function,the image will have the given width and height. |
1158 | ||
4cc4bfaf | 1159 | For a description of the @a quality parameter, see the Scale() function. |
23324ae1 | 1160 | Returns the (modified) image itself. |
3c4f71cc | 1161 | |
4cc4bfaf | 1162 | @see Scale() |
23324ae1 | 1163 | */ |
5267aefd | 1164 | wxImage& Rescale(int width, int height, |
23324ae1 FM |
1165 | int quality = wxIMAGE_QUALITY_NORMAL); |
1166 | ||
1167 | /** | |
1168 | Changes the size of the image in-place without scaling it by adding either a | |
427c415b FM |
1169 | border with the given colour or cropping as necessary. |
1170 | ||
1171 | The image is pasted into a new image with the given @a size and background | |
1172 | colour at the position @a pos relative to the upper left of the new image. | |
1173 | ||
1174 | If @a red = green = blue = -1 then use either the current mask colour | |
1175 | if set or find, use, and set a suitable mask colour for any newly exposed | |
1176 | areas. | |
1177 | ||
1178 | @return The (modified) image itself. | |
3c4f71cc | 1179 | |
4cc4bfaf | 1180 | @see Size() |
23324ae1 | 1181 | */ |
5267aefd FM |
1182 | wxImage& Resize(const wxSize& size, const wxPoint& pos, int red = -1, |
1183 | int green = -1, int blue = -1); | |
23324ae1 FM |
1184 | |
1185 | /** | |
427c415b FM |
1186 | Rotates the image about the given point, by @a angle radians. |
1187 | ||
1188 | Passing @true to @a interpolating results in better image quality, but is slower. | |
1189 | ||
1190 | If the image has a mask, then the mask colour is used for the uncovered | |
1191 | pixels in the rotated image background. Else, black (rgb 0, 0, 0) will be used. | |
1192 | ||
23324ae1 FM |
1193 | Returns the rotated image, leaving this image intact. |
1194 | */ | |
1195 | wxImage Rotate(double angle, const wxPoint& rotationCentre, | |
4cc4bfaf | 1196 | bool interpolating = true, |
adaaa686 | 1197 | wxPoint* offsetAfterRotation = NULL) const; |
23324ae1 FM |
1198 | |
1199 | /** | |
1200 | Returns a copy of the image rotated 90 degrees in the direction | |
427c415b | 1201 | indicated by @a clockwise. |
23324ae1 | 1202 | */ |
328f5751 | 1203 | wxImage Rotate90(bool clockwise = true) const; |
23324ae1 FM |
1204 | |
1205 | /** | |
1206 | Rotates the hue of each pixel in the image by @e angle, which is a double in | |
1207 | the range of -1.0 to +1.0, where -1.0 corresponds to -360 degrees and +1.0 | |
427c415b | 1208 | corresponds to +360 degrees. |
23324ae1 FM |
1209 | */ |
1210 | void RotateHue(double angle); | |
1211 | ||
23324ae1 FM |
1212 | /** |
1213 | Saves an image in the given stream. | |
3c4f71cc | 1214 | |
7c913512 | 1215 | @param stream |
4cc4bfaf | 1216 | Opened output stream to save the image to. |
427c415b FM |
1217 | @param mimetype |
1218 | MIME type. | |
1219 | ||
1220 | @return @true if the operation succeeded, @false otherwise. | |
1221 | ||
1222 | @remarks Depending on how wxWidgets has been configured, not all formats | |
1223 | may be available. | |
1224 | ||
1225 | @note | |
1226 | You can use SetOption() to set the hotspot when saving an image | |
1227 | into a cursor file (default hotspot is in the centre of the image): | |
1228 | @code | |
1229 | image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotspotX); | |
1230 | image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotspotY); | |
1231 | @endcode | |
1232 | ||
1233 | @see LoadFile() | |
1234 | */ | |
fadc2df6 FM |
1235 | virtual bool SaveFile(wxOutputStream& stream, |
1236 | const wxString& mimetype) const; | |
427c415b FM |
1237 | |
1238 | /** | |
1239 | Saves an image in the named file. | |
1240 | ||
1241 | @param name | |
1242 | Name of the file to save the image to. | |
7c913512 | 1243 | @param type |
4cc4bfaf | 1244 | Currently these types can be used: |
4e2cddc4 RR |
1245 | @li wxBITMAP_TYPE_BMP: Save a BMP image file. |
1246 | @li wxBITMAP_TYPE_JPEG: Save a JPEG image file. | |
1247 | @li wxBITMAP_TYPE_PNG: Save a PNG image file. | |
427c415b FM |
1248 | @li wxBITMAP_TYPE_PCX: Save a PCX image file |
1249 | (tries to save as 8-bit if possible, falls back to 24-bit otherwise). | |
4e2cddc4 RR |
1250 | @li wxBITMAP_TYPE_PNM: Save a PNM image file (as raw RGB always). |
1251 | @li wxBITMAP_TYPE_TIFF: Save a TIFF image file. | |
1252 | @li wxBITMAP_TYPE_XPM: Save a XPM image file. | |
427c415b FM |
1253 | @li wxBITMAP_TYPE_ICO: Save a Windows icon file (ICO). |
1254 | The size may be up to 255 wide by 127 high. A single image is saved | |
1255 | in 8 colors at the size supplied. | |
4e2cddc4 | 1256 | @li wxBITMAP_TYPE_CUR: Save a Windows cursor file (CUR). |
427c415b | 1257 | */ |
7323ff1a | 1258 | virtual bool SaveFile(const wxString& name, wxBitmapType type) const; |
427c415b FM |
1259 | |
1260 | /** | |
1261 | Saves an image in the named file. | |
1262 | ||
1263 | @param name | |
1264 | Name of the file to save the image to. | |
7c913512 | 1265 | @param mimetype |
4cc4bfaf | 1266 | MIME type. |
427c415b | 1267 | */ |
fadc2df6 | 1268 | virtual bool SaveFile(const wxString& name, const wxString& mimetype) const; |
3c4f71cc | 1269 | |
427c415b FM |
1270 | /** |
1271 | Saves an image in the named file. | |
3c4f71cc | 1272 | |
427c415b FM |
1273 | File type is determined from the extension of the file name. |
1274 | Note that this function may fail if the extension is not recognized! | |
1275 | You can use one of the forms above to save images to files with | |
1276 | non-standard extensions. | |
3c4f71cc | 1277 | |
427c415b FM |
1278 | @param name |
1279 | Name of the file to save the image to. | |
23324ae1 | 1280 | */ |
7323ff1a | 1281 | virtual bool SaveFile(const wxString& name) const; |
427c415b FM |
1282 | |
1283 | /** | |
1284 | Saves an image in the given stream. | |
1285 | ||
1286 | @param stream | |
1287 | Opened output stream to save the image to. | |
1288 | @param type | |
1289 | MIME type. | |
1290 | */ | |
7323ff1a | 1291 | virtual bool SaveFile(wxOutputStream& stream, wxBitmapType type) const; |
23324ae1 FM |
1292 | |
1293 | /** | |
427c415b FM |
1294 | Returns a scaled version of the image. |
1295 | ||
1296 | This is also useful for scaling bitmaps in general as the only other way | |
1297 | to scale bitmaps is to blit a wxMemoryDC into another wxMemoryDC. | |
1298 | ||
1299 | The parameter @a quality determines what method to use for resampling the image. | |
1300 | Can be one of the following: | |
1301 | - wxIMAGE_QUALITY_NORMAL: Uses the normal default scaling method of pixel | |
1302 | replication | |
1303 | - wxIMAGE_QUALITY_HIGH: Uses bicubic and box averaging resampling methods | |
1304 | for upsampling and downsampling respectively | |
1305 | ||
1306 | It should be noted that although using @c wxIMAGE_QUALITY_HIGH produces much nicer | |
1307 | looking results it is a slower method. Downsampling will use the box averaging | |
1308 | method which seems to operate very fast. If you are upsampling larger images using | |
23324ae1 | 1309 | this method you will most likely notice that it is a bit slower and in extreme |
427c415b FM |
1310 | cases it will be quite substantially slower as the bicubic algorithm has to process a |
1311 | lot of data. | |
1312 | ||
23324ae1 FM |
1313 | It should also be noted that the high quality scaling may not work as expected |
1314 | when using a single mask colour for transparency, as the scaling will blur the | |
1315 | image and will therefore remove the mask partially. Using the alpha channel | |
1316 | will work. | |
e98e625c | 1317 | |
427c415b FM |
1318 | Example: |
1319 | @code | |
1320 | // get the bitmap from somewhere | |
1321 | wxBitmap bmp = ...; | |
1322 | ||
1323 | // rescale it to have size of 32*32 | |
1324 | if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 ) | |
1325 | { | |
1326 | wxImage image = bmp.ConvertToImage(); | |
1327 | bmp = wxBitmap(image.Scale(32, 32)); | |
1328 | ||
1329 | // another possibility: | |
1330 | image.Rescale(32, 32); | |
1331 | bmp = image; | |
1332 | } | |
1333 | @endcode | |
3c4f71cc | 1334 | |
4cc4bfaf | 1335 | @see Rescale() |
23324ae1 FM |
1336 | */ |
1337 | wxImage Scale(int width, int height, | |
328f5751 | 1338 | int quality = wxIMAGE_QUALITY_NORMAL) const; |
23324ae1 | 1339 | |
e98e625c | 1340 | /** |
427c415b FM |
1341 | This function is similar to SetData() and has similar restrictions. |
1342 | ||
1343 | The pointer passed to it may however be @NULL in which case the function | |
1344 | will allocate the alpha array internally -- this is useful to add alpha | |
1345 | channel data to an image which doesn't have any. | |
1346 | ||
1347 | If the pointer is not @NULL, it must have one byte for each image pixel | |
1348 | and be allocated with malloc(). | |
1349 | wxImage takes ownership of the pointer and will free it unless @a static_data | |
1350 | parameter is set to @true -- in this case the caller should do it. | |
23324ae1 | 1351 | */ |
4cc4bfaf FM |
1352 | void SetAlpha(unsigned char* alpha = NULL, |
1353 | bool static_data = false); | |
e98e625c | 1354 | |
b3623ed5 | 1355 | /** |
427c415b FM |
1356 | Sets the alpha value for the given pixel. |
1357 | This function should only be called if the image has alpha channel data, | |
1358 | use HasAlpha() to check for this. | |
b3623ed5 | 1359 | */ |
7c913512 | 1360 | void SetAlpha(int x, int y, unsigned char alpha); |
23324ae1 | 1361 | |
0a98423e | 1362 | //@{ |
23324ae1 | 1363 | /** |
427c415b FM |
1364 | Sets the image data without performing checks. |
1365 | ||
1366 | The data given must have the size (width*height*3) or results will be | |
1367 | unexpected. Don't use this method if you aren't sure you know what you | |
1368 | are doing. | |
1369 | ||
23324ae1 FM |
1370 | The data must have been allocated with @c malloc(), @b NOT with |
1371 | @c operator new. | |
427c415b | 1372 | |
23324ae1 FM |
1373 | After this call the pointer to the data is owned by the wxImage object, |
1374 | that will be responsible for deleting it. | |
427c415b | 1375 | Do not pass to this function a pointer obtained through GetData(). |
23324ae1 | 1376 | */ |
0a98423e FM |
1377 | void SetData(unsigned char* data, bool static_data = false); |
1378 | void SetData(unsigned char* data, int new_width, int new_height, | |
1379 | bool static_data = false); | |
1380 | //@} | |
23324ae1 FM |
1381 | |
1382 | /** | |
427c415b FM |
1383 | Specifies whether there is a mask or not. |
1384 | ||
1385 | The area of the mask is determined by the current mask colour. | |
23324ae1 | 1386 | */ |
4cc4bfaf | 1387 | void SetMask(bool hasMask = true); |
23324ae1 FM |
1388 | |
1389 | /** | |
1390 | Sets the mask colour for this image (and tells the image to use the mask). | |
1391 | */ | |
1392 | void SetMaskColour(unsigned char red, unsigned char green, | |
1393 | unsigned char blue); | |
1394 | ||
1395 | /** | |
427c415b FM |
1396 | Sets image's mask so that the pixels that have RGB value of mr,mg,mb in |
1397 | mask will be masked in the image. | |
1398 | ||
1399 | This is done by first finding an unused colour in the image, setting | |
1400 | this colour as the mask colour and then using this colour to draw all | |
1401 | pixels in the image who corresponding pixel in mask has given RGB value. | |
1402 | ||
1403 | The parameter @a mask is the mask image to extract mask shape from. | |
1404 | It must have the same dimensions as the image. | |
1405 | ||
1406 | The parameters @a mr, @a mg, @a mb are the RGB values of the pixels in | |
1407 | mask that will be used to create the mask. | |
3c4f71cc | 1408 | |
d29a9a8a | 1409 | @return Returns @false if mask does not have same dimensions as the image |
427c415b FM |
1410 | or if there is no unused colour left. Returns @true if the mask |
1411 | was successfully applied. | |
1412 | ||
1413 | @note | |
1414 | Note that this method involves computing the histogram, which is a | |
1415 | computationally intensive operation. | |
23324ae1 FM |
1416 | */ |
1417 | bool SetMaskFromImage(const wxImage& mask, unsigned char mr, | |
1418 | unsigned char mg, | |
1419 | unsigned char mb); | |
1420 | ||
1421 | //@{ | |
1422 | /** | |
427c415b FM |
1423 | Sets a user-defined option. The function is case-insensitive to @a name. |
1424 | ||
23324ae1 FM |
1425 | For example, when saving as a JPEG file, the option @b quality is |
1426 | used, which is a number between 0 and 100 (0 is terrible, 100 is very good). | |
3c4f71cc | 1427 | |
d19ce8c4 FM |
1428 | The lists of the currently supported options are in GetOption() and |
1429 | GetOptionInt() function docs. | |
1430 | ||
4cc4bfaf | 1431 | @see GetOption(), GetOptionInt(), HasOption() |
23324ae1 FM |
1432 | */ |
1433 | void SetOption(const wxString& name, const wxString& value); | |
7c913512 | 1434 | void SetOption(const wxString& name, int value); |
23324ae1 FM |
1435 | //@} |
1436 | ||
1437 | /** | |
427c415b FM |
1438 | Associates a palette with the image. |
1439 | ||
1440 | The palette may be used when converting wxImage to wxBitmap (MSW only at present) | |
1441 | or in file save operations (none as yet). | |
23324ae1 FM |
1442 | */ |
1443 | void SetPalette(const wxPalette& palette); | |
1444 | ||
1445 | /** | |
427c415b FM |
1446 | Sets the colour of the pixels within the given rectangle. |
1447 | ||
1448 | This routine performs bounds-checks for the coordinate so it can be considered | |
1449 | a safe way to manipulate the data. | |
23324ae1 | 1450 | */ |
0a98423e FM |
1451 | void SetRGB(const wxRect& rect, |
1452 | unsigned char red, | |
4cc4bfaf FM |
1453 | unsigned char green, |
1454 | unsigned char blue); | |
23324ae1 | 1455 | |
9d1c7e84 VZ |
1456 | /** |
1457 | Set the type of image returned by GetType(). | |
1458 | ||
1459 | This method is mostly used internally by the library but can also be | |
1460 | called from the user code if the image was created from data in the | |
1461 | given bitmap format without using LoadFile() (which would set the type | |
1462 | correctly automatically). | |
1463 | ||
1464 | Notice that the image must be created before this function is called. | |
1465 | ||
1466 | @since 2.9.0 | |
1467 | ||
1468 | @param type | |
1469 | One of bitmap type constants, @c wxBITMAP_TYPE_INVALID is a valid | |
1470 | value for it and can be used to reset the bitmap type to default | |
1471 | but @c wxBITMAP_TYPE_MAX is not allowed here. | |
1472 | */ | |
1473 | void SetType(wxBitmapType type); | |
1474 | ||
23324ae1 FM |
1475 | /** |
1476 | Returns a resized version of this image without scaling it by adding either a | |
427c415b FM |
1477 | border with the given colour or cropping as necessary. |
1478 | ||
1479 | The image is pasted into a new image with the given @a size and background | |
1480 | colour at the position @a pos relative to the upper left of the new image. | |
1481 | ||
1482 | If @a red = green = blue = -1 then the areas of the larger image not covered | |
1483 | by this image are made transparent by filling them with the image mask colour | |
1484 | (which will be allocated automatically if it isn't currently set). | |
1485 | ||
1486 | Otherwise, the areas will be filled with the colour with the specified RGB components. | |
3c4f71cc | 1487 | |
4cc4bfaf | 1488 | @see Resize() |
23324ae1 | 1489 | */ |
427c415b | 1490 | wxImage Size(const wxSize& size, const wxPoint& pos, int red = -1, |
328f5751 | 1491 | int green = -1, int blue = -1) const; |
23324ae1 FM |
1492 | |
1493 | /** | |
427c415b | 1494 | Assignment operator, using @ref overview_refcount "reference counting". |
3c4f71cc | 1495 | |
7c913512 | 1496 | @param image |
4cc4bfaf | 1497 | Image to assign. |
3c4f71cc | 1498 | |
d29a9a8a | 1499 | @return Returns 'this' object. |
23324ae1 | 1500 | */ |
5267aefd | 1501 | wxImage& operator=(const wxImage& image); |
23324ae1 FM |
1502 | }; |
1503 | ||
336aecf1 FM |
1504 | /** |
1505 | An instance of an empty image without an alpha channel. | |
1506 | */ | |
1507 | wxImage wxNullImage; | |
1508 | ||
1509 | ||
23324ae1 FM |
1510 | // ============================================================================ |
1511 | // Global functions/macros | |
1512 | // ============================================================================ | |
1513 | ||
b21126db | 1514 | /** @addtogroup group_funcmacro_appinitterm */ |
8cd06fb5 BP |
1515 | //@{ |
1516 | ||
23324ae1 FM |
1517 | /** |
1518 | Initializes all available image handlers. For a list of available handlers, | |
1519 | see wxImage. | |
7c913512 | 1520 | |
4cc4bfaf | 1521 | @see wxImage, wxImageHandler |
027c1c27 BP |
1522 | |
1523 | @header{wx/image.h} | |
23324ae1 FM |
1524 | */ |
1525 | void wxInitAllImageHandlers(); | |
1526 | ||
8cd06fb5 BP |
1527 | //@} |
1528 |