]> git.saurik.com Git - wxWidgets.git/blob - include/wx/image.h
Store property name and value in wxPropertyGridEvent, keep track of live event instan...
[wxWidgets.git] / include / wx / image.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/image.h
3 // Purpose: wxImage class
4 // Author: Robert Roebling
5 // RCS-ID: $Id$
6 // Copyright: (c) Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_IMAGE_H_
11 #define _WX_IMAGE_H_
12
13 #include "wx/defs.h"
14
15 #if wxUSE_IMAGE
16
17 #include "wx/object.h"
18 #include "wx/string.h"
19 #include "wx/gdicmn.h"
20 #include "wx/hashmap.h"
21 #include "wx/arrstr.h"
22
23 #if wxUSE_STREAMS
24 # include "wx/stream.h"
25 #endif
26
27 // on some systems (Unixware 7.x) index is defined as a macro in the headers
28 // which breaks the compilation below
29 #undef index
30
31 #define wxIMAGE_OPTION_QUALITY wxString(wxT("quality"))
32 #define wxIMAGE_OPTION_FILENAME wxString(wxT("FileName"))
33
34 #define wxIMAGE_OPTION_RESOLUTION wxString(wxT("Resolution"))
35 #define wxIMAGE_OPTION_RESOLUTIONX wxString(wxT("ResolutionX"))
36 #define wxIMAGE_OPTION_RESOLUTIONY wxString(wxT("ResolutionY"))
37
38 #define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxT("ResolutionUnit"))
39
40 #define wxIMAGE_OPTION_MAX_WIDTH wxString(wxT("MaxWidth"))
41 #define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxT("MaxHeight"))
42
43 // constants used with wxIMAGE_OPTION_RESOLUTIONUNIT
44 //
45 // NB: don't change these values, they correspond to libjpeg constants
46 enum wxImageResolution
47 {
48 // Resolution not specified
49 wxIMAGE_RESOLUTION_NONE = 0,
50
51 // Resolution specified in inches
52 wxIMAGE_RESOLUTION_INCHES = 1,
53
54 // Resolution specified in centimeters
55 wxIMAGE_RESOLUTION_CM = 2
56 };
57
58 // Constants for wxImage::Scale() for determining the level of quality
59 enum wxImageResizeQuality
60 {
61 // different image resizing algorithms used by Scale() and Rescale()
62 wxIMAGE_QUALITY_NEAREST = 0,
63 wxIMAGE_QUALITY_BILINEAR = 1,
64 wxIMAGE_QUALITY_BICUBIC = 2,
65
66 // default quality is low (but fast)
67 wxIMAGE_QUALITY_NORMAL = wxIMAGE_QUALITY_NEAREST,
68
69 // highest (but best) quality
70 wxIMAGE_QUALITY_HIGH = wxIMAGE_QUALITY_BICUBIC
71 };
72
73 // alpha channel values: fully transparent, default threshold separating
74 // transparent pixels from opaque for a few functions dealing with alpha and
75 // fully opaque
76 const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0;
77 const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80;
78 const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff;
79
80 //-----------------------------------------------------------------------------
81 // classes
82 //-----------------------------------------------------------------------------
83
84 class WXDLLIMPEXP_FWD_CORE wxImageHandler;
85 class WXDLLIMPEXP_FWD_CORE wxImage;
86 class WXDLLIMPEXP_FWD_CORE wxPalette;
87
88 //-----------------------------------------------------------------------------
89 // wxVariant support
90 //-----------------------------------------------------------------------------
91
92 #if wxUSE_VARIANT
93 #include "wx/variant.h"
94 DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLIMPEXP_CORE)
95 #endif
96
97 //-----------------------------------------------------------------------------
98 // wxImageHandler
99 //-----------------------------------------------------------------------------
100
101 class WXDLLIMPEXP_CORE wxImageHandler: public wxObject
102 {
103 public:
104 wxImageHandler()
105 : m_name(wxEmptyString), m_extension(wxEmptyString), m_mime(), m_type(wxBITMAP_TYPE_INVALID)
106 { }
107
108 #if wxUSE_STREAMS
109 // NOTE: LoadFile and SaveFile are not pure virtuals to allow derived classes
110 // to implement only one of the two
111 virtual bool LoadFile( wxImage *WXUNUSED(image), wxInputStream& WXUNUSED(stream),
112 bool WXUNUSED(verbose)=true, int WXUNUSED(index)=-1 )
113 { return false; }
114 virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream),
115 bool WXUNUSED(verbose)=true )
116 { return false; }
117
118 int GetImageCount( wxInputStream& stream );
119 // save the stream position, call DoGetImageCount() and restore the position
120
121 bool CanRead( wxInputStream& stream ) { return CallDoCanRead(stream); }
122 bool CanRead( const wxString& name );
123 #endif // wxUSE_STREAMS
124
125 void SetName(const wxString& name) { m_name = name; }
126 void SetExtension(const wxString& ext) { m_extension = ext; }
127 void SetAltExtensions(const wxArrayString& exts) { m_altExtensions = exts; }
128 void SetType(wxBitmapType type) { m_type = type; }
129 void SetMimeType(const wxString& type) { m_mime = type; }
130 const wxString& GetName() const { return m_name; }
131 const wxString& GetExtension() const { return m_extension; }
132 const wxArrayString& GetAltExtensions() const { return m_altExtensions; }
133 wxBitmapType GetType() const { return m_type; }
134 const wxString& GetMimeType() const { return m_mime; }
135
136 #if WXWIN_COMPATIBILITY_2_8
137 wxDEPRECATED(
138 void SetType(long type) { SetType((wxBitmapType)type); }
139 )
140 #endif // WXWIN_COMPATIBILITY_2_8
141
142 protected:
143 #if wxUSE_STREAMS
144 // NOTE: this function is allowed to change the current stream position
145 // since GetImageCount() will take care of restoring it later
146 virtual int DoGetImageCount( wxInputStream& WXUNUSED(stream) )
147 { return 1; } // default return value is 1 image
148
149 // NOTE: this function is allowed to change the current stream position
150 // since CallDoCanRead() will take care of restoring it later
151 virtual bool DoCanRead( wxInputStream& stream ) = 0;
152
153 // save the stream position, call DoCanRead() and restore the position
154 bool CallDoCanRead(wxInputStream& stream);
155 #endif // wxUSE_STREAMS
156
157 // helper for the derived classes SaveFile() implementations: returns the
158 // values of x- and y-resolution options specified as the image options if
159 // any
160 static wxImageResolution
161 GetResolutionFromOptions(const wxImage& image, int *x, int *y);
162
163
164 wxString m_name;
165 wxString m_extension;
166 wxArrayString m_altExtensions;
167 wxString m_mime;
168 wxBitmapType m_type;
169
170 private:
171 DECLARE_CLASS(wxImageHandler)
172 };
173
174 //-----------------------------------------------------------------------------
175 // wxImageHistogram
176 //-----------------------------------------------------------------------------
177
178 class WXDLLIMPEXP_CORE wxImageHistogramEntry
179 {
180 public:
181 wxImageHistogramEntry() { index = value = 0; }
182 unsigned long index;
183 unsigned long value;
184 };
185
186 WX_DECLARE_EXPORTED_HASH_MAP(unsigned long, wxImageHistogramEntry,
187 wxIntegerHash, wxIntegerEqual,
188 wxImageHistogramBase);
189
190 class WXDLLIMPEXP_CORE wxImageHistogram : public wxImageHistogramBase
191 {
192 public:
193 wxImageHistogram() : wxImageHistogramBase(256) { }
194
195 // get the key in the histogram for the given RGB values
196 static unsigned long MakeKey(unsigned char r,
197 unsigned char g,
198 unsigned char b)
199 {
200 return (r << 16) | (g << 8) | b;
201 }
202
203 // find first colour that is not used in the image and has higher
204 // RGB values than RGB(startR, startG, startB)
205 //
206 // returns true and puts this colour in r, g, b (each of which may be NULL)
207 // on success or returns false if there are no more free colours
208 bool FindFirstUnusedColour(unsigned char *r,
209 unsigned char *g,
210 unsigned char *b,
211 unsigned char startR = 1,
212 unsigned char startG = 0,
213 unsigned char startB = 0 ) const;
214 };
215
216 //-----------------------------------------------------------------------------
217 // wxImage
218 //-----------------------------------------------------------------------------
219
220 class WXDLLIMPEXP_CORE wxImage: public wxObject
221 {
222 public:
223 // red, green and blue are 8 bit unsigned integers in the range of 0..255
224 // We use the identifier RGBValue instead of RGB, since RGB is #defined
225 class RGBValue
226 {
227 public:
228 RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0)
229 : red(r), green(g), blue(b) {}
230 unsigned char red;
231 unsigned char green;
232 unsigned char blue;
233 };
234
235 // hue, saturation and value are doubles in the range 0.0..1.0
236 class HSVValue
237 {
238 public:
239 HSVValue(double h=0.0, double s=0.0, double v=0.0)
240 : hue(h), saturation(s), value(v) {}
241 double hue;
242 double saturation;
243 double value;
244 };
245
246 wxImage() {}
247 wxImage( int width, int height, bool clear = true )
248 { Create( width, height, clear ); }
249 wxImage( int width, int height, unsigned char* data, bool static_data = false )
250 { Create( width, height, data, static_data ); }
251 wxImage( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false )
252 { Create( width, height, data, alpha, static_data ); }
253
254 // ctor variants using wxSize:
255 wxImage( const wxSize& sz, bool clear = true )
256 { Create( sz, clear ); }
257 wxImage( const wxSize& sz, unsigned char* data, bool static_data = false )
258 { Create( sz, data, static_data ); }
259 wxImage( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false )
260 { Create( sz, data, alpha, static_data ); }
261
262 wxImage( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 )
263 { LoadFile( name, type, index ); }
264 wxImage( const wxString& name, const wxString& mimetype, int index = -1 )
265 { LoadFile( name, mimetype, index ); }
266 wxImage( const char* const* xpmData )
267 { Create(xpmData); }
268
269 #if wxUSE_STREAMS
270 wxImage( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 )
271 { LoadFile( stream, type, index ); }
272 wxImage( wxInputStream& stream, const wxString& mimetype, int index = -1 )
273 { LoadFile( stream, mimetype, index ); }
274 #endif // wxUSE_STREAMS
275
276 bool Create( const char* const* xpmData );
277 #ifdef __BORLANDC__
278 // needed for Borland 5.5
279 wxImage( char** xpmData ) { Create(const_cast<const char* const*>(xpmData)); }
280 bool Create( char** xpmData ) { return Create(const_cast<const char* const*>(xpmData)); }
281 #endif
282
283 bool Create( int width, int height, bool clear = true );
284 bool Create( int width, int height, unsigned char* data, bool static_data = false );
285 bool Create( int width, int height, unsigned char* data, unsigned char* alpha, bool static_data = false );
286
287 // Create() variants using wxSize:
288 bool Create( const wxSize& sz, bool clear = true )
289 { return Create(sz.GetWidth(), sz.GetHeight(), clear); }
290 bool Create( const wxSize& sz, unsigned char* data, bool static_data = false )
291 { return Create(sz.GetWidth(), sz.GetHeight(), data, static_data); }
292 bool Create( const wxSize& sz, unsigned char* data, unsigned char* alpha, bool static_data = false )
293 { return Create(sz.GetWidth(), sz.GetHeight(), data, alpha, static_data); }
294
295 void Destroy();
296
297 // initialize the image data with zeroes
298 void Clear(unsigned char value = 0);
299
300 // creates an identical copy of the image (the = operator
301 // just raises the ref count)
302 wxImage Copy() const;
303
304 // return the new image with size width*height
305 wxImage GetSubImage( const wxRect& rect) const;
306
307 // Paste the image or part of this image into an image of the given size at the pos
308 // any newly exposed areas will be filled with the rgb colour
309 // by default if r = g = b = -1 then fill with this image's mask colour or find and
310 // set a suitable mask colour
311 wxImage Size( const wxSize& size, const wxPoint& pos,
312 int r = -1, int g = -1, int b = -1 ) const;
313
314 // pastes image into this instance and takes care of
315 // the mask colour and out of bounds problems
316 void Paste( const wxImage &image, int x, int y );
317
318 // return the new image with size width*height
319 wxImage Scale( int width, int height,
320 wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL ) const;
321
322 // box averager and bicubic filters for up/down sampling
323 wxImage ResampleNearest(int width, int height) const;
324 wxImage ResampleBox(int width, int height) const;
325 wxImage ResampleBilinear(int width, int height) const;
326 wxImage ResampleBicubic(int width, int height) const;
327
328 // blur the image according to the specified pixel radius
329 wxImage Blur(int radius) const;
330 wxImage BlurHorizontal(int radius) const;
331 wxImage BlurVertical(int radius) const;
332
333 wxImage ShrinkBy( int xFactor , int yFactor ) const ;
334
335 // rescales the image in place
336 wxImage& Rescale( int width, int height,
337 wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL )
338 { return *this = Scale(width, height, quality); }
339
340 // resizes the image in place
341 wxImage& Resize( const wxSize& size, const wxPoint& pos,
342 int r = -1, int g = -1, int b = -1 ) { return *this = Size(size, pos, r, g, b); }
343
344 // Rotates the image about the given point, 'angle' radians.
345 // Returns the rotated image, leaving this image intact.
346 wxImage Rotate(double angle, const wxPoint & centre_of_rotation,
347 bool interpolating = true, wxPoint * offset_after_rotation = NULL) const;
348
349 wxImage Rotate90( bool clockwise = true ) const;
350 wxImage Mirror( bool horizontally = true ) const;
351
352 // replace one colour with another
353 void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
354 unsigned char r2, unsigned char g2, unsigned char b2 );
355
356 // Convert to greyscale image. Uses the luminance component (Y) of the image.
357 // The luma value (YUV) is calculated using (R * weight_r) + (G * weight_g) + (B * weight_b), defaults to ITU-T BT.601
358 wxImage ConvertToGreyscale(double weight_r, double weight_g, double weight_b) const;
359 wxImage ConvertToGreyscale(void) const;
360
361 // convert to monochrome image (<r,g,b> will be replaced by white,
362 // everything else by black)
363 wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const;
364
365 // Convert to disabled (dimmed) image.
366 wxImage ConvertToDisabled(unsigned char brightness = 255) const;
367
368 // these routines are slow but safe
369 void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b );
370 void SetRGB( const wxRect& rect, unsigned char r, unsigned char g, unsigned char b );
371 unsigned char GetRed( int x, int y ) const;
372 unsigned char GetGreen( int x, int y ) const;
373 unsigned char GetBlue( int x, int y ) const;
374
375 void SetAlpha(int x, int y, unsigned char alpha);
376 unsigned char GetAlpha(int x, int y) const;
377
378 // find first colour that is not used in the image and has higher
379 // RGB values than <startR,startG,startB>
380 bool FindFirstUnusedColour( unsigned char *r, unsigned char *g, unsigned char *b,
381 unsigned char startR = 1, unsigned char startG = 0,
382 unsigned char startB = 0 ) const;
383 // Set image's mask to the area of 'mask' that has <r,g,b> colour
384 bool SetMaskFromImage(const wxImage & mask,
385 unsigned char mr, unsigned char mg, unsigned char mb);
386
387 // converts image's alpha channel to mask (choosing mask colour
388 // automatically or using the specified colour for the mask), if it has
389 // any, does nothing otherwise:
390 bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
391 void ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb,
392 unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
393
394
395 // This method converts an image where the original alpha
396 // information is only available as a shades of a colour
397 // (actually shades of grey) typically when you draw anti-
398 // aliased text into a bitmap. The DC drawinf routines
399 // draw grey values on the black background although they
400 // actually mean to draw white with differnt alpha values.
401 // This method reverses it, assuming a black (!) background
402 // and white text (actually only the red channel is read).
403 // The method will then fill up the whole image with the
404 // colour given.
405 bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b );
406
407 static bool CanRead( const wxString& name );
408 static int GetImageCount( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY );
409 virtual bool LoadFile( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
410 virtual bool LoadFile( const wxString& name, const wxString& mimetype, int index = -1 );
411
412 #if wxUSE_STREAMS
413 static bool CanRead( wxInputStream& stream );
414 static int GetImageCount( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY );
415 virtual bool LoadFile( wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 );
416 virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype, int index = -1 );
417 #endif
418
419 virtual bool SaveFile( const wxString& name ) const;
420 virtual bool SaveFile( const wxString& name, wxBitmapType type ) const;
421 virtual bool SaveFile( const wxString& name, const wxString& mimetype ) const;
422
423 #if wxUSE_STREAMS
424 virtual bool SaveFile( wxOutputStream& stream, wxBitmapType type ) const;
425 virtual bool SaveFile( wxOutputStream& stream, const wxString& mimetype ) const;
426 #endif
427
428 bool Ok() const { return IsOk(); }
429 bool IsOk() const;
430 int GetWidth() const;
431 int GetHeight() const;
432
433 wxSize GetSize() const
434 { return wxSize(GetWidth(), GetHeight()); }
435
436 // Gets the type of image found by LoadFile or specified with SaveFile
437 wxBitmapType GetType() const;
438
439 // Set the image type, this is normally only called if the image is being
440 // created from data in the given format but not using LoadFile() (e.g.
441 // wxGIFDecoder uses this)
442 void SetType(wxBitmapType type);
443
444 // these functions provide fastest access to wxImage data but should be
445 // used carefully as no checks are done
446 unsigned char *GetData() const;
447 void SetData( unsigned char *data, bool static_data=false );
448 void SetData( unsigned char *data, int new_width, int new_height, bool static_data=false );
449
450 unsigned char *GetAlpha() const; // may return NULL!
451 bool HasAlpha() const { return GetAlpha() != NULL; }
452 void SetAlpha(unsigned char *alpha = NULL, bool static_data=false);
453 void InitAlpha();
454
455 // return true if this pixel is masked or has alpha less than specified
456 // threshold
457 bool IsTransparent(int x, int y,
458 unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const;
459
460 // Mask functions
461 void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
462 // Get the current mask colour or find a suitable colour
463 // returns true if using current mask colour
464 bool GetOrFindMaskColour( unsigned char *r, unsigned char *g, unsigned char *b ) const;
465 unsigned char GetMaskRed() const;
466 unsigned char GetMaskGreen() const;
467 unsigned char GetMaskBlue() const;
468 void SetMask( bool mask = true );
469 bool HasMask() const;
470
471 #if wxUSE_PALETTE
472 // Palette functions
473 bool HasPalette() const;
474 const wxPalette& GetPalette() const;
475 void SetPalette(const wxPalette& palette);
476 #endif // wxUSE_PALETTE
477
478 // Option functions (arbitrary name/value mapping)
479 void SetOption(const wxString& name, const wxString& value);
480 void SetOption(const wxString& name, int value);
481 wxString GetOption(const wxString& name) const;
482 int GetOptionInt(const wxString& name) const;
483 bool HasOption(const wxString& name) const;
484
485 unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 ) const;
486
487 // Computes the histogram of the image and fills a hash table, indexed
488 // with integer keys built as 0xRRGGBB, containing wxImageHistogramEntry
489 // objects. Each of them contains an 'index' (useful to build a palette
490 // with the image colours) and a 'value', which is the number of pixels
491 // in the image with that colour.
492 // Returned value: # of entries in the histogram
493 unsigned long ComputeHistogram( wxImageHistogram &h ) const;
494
495 // Rotates the hue of each pixel of the image. angle is a double in the range
496 // -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees
497 void RotateHue(double angle);
498
499 static wxList& GetHandlers() { return sm_handlers; }
500 static void AddHandler( wxImageHandler *handler );
501 static void InsertHandler( wxImageHandler *handler );
502 static bool RemoveHandler( const wxString& name );
503 static wxImageHandler *FindHandler( const wxString& name );
504 static wxImageHandler *FindHandler( const wxString& extension, wxBitmapType imageType );
505 static wxImageHandler *FindHandler( wxBitmapType imageType );
506
507 static wxImageHandler *FindHandlerMime( const wxString& mimetype );
508
509 static wxString GetImageExtWildcard();
510
511 static void CleanUpHandlers();
512 static void InitStandardHandlers();
513
514 static HSVValue RGBtoHSV(const RGBValue& rgb);
515 static RGBValue HSVtoRGB(const HSVValue& hsv);
516
517 #if WXWIN_COMPATIBILITY_2_8
518 wxDEPRECATED_CONSTRUCTOR(
519 wxImage(const wxString& name, long type, int index = -1)
520 {
521 LoadFile(name, (wxBitmapType)type, index);
522 }
523 )
524
525 #if wxUSE_STREAMS
526 wxDEPRECATED_CONSTRUCTOR(
527 wxImage(wxInputStream& stream, long type, int index = -1)
528 {
529 LoadFile(stream, (wxBitmapType)type, index);
530 }
531 )
532
533 wxDEPRECATED(
534 bool LoadFile(wxInputStream& stream, long type, int index = -1)
535 {
536 return LoadFile(stream, (wxBitmapType)type, index);
537 }
538 )
539
540 wxDEPRECATED(
541 bool SaveFile(wxOutputStream& stream, long type) const
542 {
543 return SaveFile(stream, (wxBitmapType)type);
544 }
545 )
546 #endif // wxUSE_STREAMS
547
548 wxDEPRECATED(
549 bool LoadFile(const wxString& name, long type, int index = -1)
550 {
551 return LoadFile(name, (wxBitmapType)type, index);
552 }
553 )
554
555 wxDEPRECATED(
556 bool SaveFile(const wxString& name, long type) const
557 {
558 return SaveFile(name, (wxBitmapType)type);
559 }
560 )
561
562 wxDEPRECATED(
563 static wxImageHandler *FindHandler(const wxString& ext, long type)
564 {
565 return FindHandler(ext, (wxBitmapType)type);
566 }
567 )
568
569 wxDEPRECATED(
570 static wxImageHandler *FindHandler(long imageType)
571 {
572 return FindHandler((wxBitmapType)imageType);
573 }
574 )
575 #endif // WXWIN_COMPATIBILITY_2_8
576
577 protected:
578 static wxList sm_handlers;
579
580 // return the index of the point with the given coordinates or -1 if the
581 // image is invalid of the coordinates are out of range
582 //
583 // note that index must be multiplied by 3 when using it with RGB array
584 long XYToIndex(int x, int y) const;
585
586 virtual wxObjectRefData* CreateRefData() const;
587 virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const;
588
589 private:
590 friend class WXDLLIMPEXP_FWD_CORE wxImageHandler;
591
592 #if wxUSE_STREAMS
593 // read the image from the specified stream updating image type if
594 // successful
595 bool DoLoad(wxImageHandler& handler, wxInputStream& stream, int index);
596
597 // write the image to the specified stream and also update the image type
598 // if successful
599 bool DoSave(wxImageHandler& handler, wxOutputStream& stream) const;
600 #endif // wxUSE_STREAMS
601
602 DECLARE_DYNAMIC_CLASS(wxImage)
603 };
604
605
606 extern void WXDLLIMPEXP_CORE wxInitAllImageHandlers();
607
608 extern WXDLLIMPEXP_DATA_CORE(wxImage) wxNullImage;
609
610 //-----------------------------------------------------------------------------
611 // wxImage handlers
612 //-----------------------------------------------------------------------------
613
614 #include "wx/imagbmp.h"
615 #include "wx/imagpng.h"
616 #include "wx/imaggif.h"
617 #include "wx/imagpcx.h"
618 #include "wx/imagjpeg.h"
619 #include "wx/imagtga.h"
620 #include "wx/imagtiff.h"
621 #include "wx/imagpnm.h"
622 #include "wx/imagxpm.h"
623 #include "wx/imagiff.h"
624
625 #endif // wxUSE_IMAGE
626
627 #endif
628 // _WX_IMAGE_H_