]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/image.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / interface / wx / image.h
index c47face205f06fcb64ff18faf9a6cdffdce76a6d..9ae1bb0a067b0f774f4b7491aa3a8380e8ac9c19 100644 (file)
@@ -2,7 +2,6 @@
 // Name:        image.h
 // Purpose:     interface of wxImageHandler and wxImage
 // Author:      wxWidgets team
-// RCS-ID:      $Id$
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -78,34 +77,36 @@ enum wxImagePNGType
 /**
    Image option names.
 */
-#define wxIMAGE_OPTION_QUALITY                          wxString(wxT("quality"))
-#define wxIMAGE_OPTION_FILENAME                         wxString(wxT("FileName"))
-#define wxIMAGE_OPTION_RESOLUTION                       wxString(wxT("Resolution"))
-#define wxIMAGE_OPTION_RESOLUTIONX                      wxString(wxT("ResolutionX"))
-#define wxIMAGE_OPTION_RESOLUTIONY                      wxString(wxT("ResolutionY"))
-#define wxIMAGE_OPTION_RESOLUTIONUNIT                   wxString(wxT("ResolutionUnit"))
-#define wxIMAGE_OPTION_MAX_WIDTH                        wxString(wxT("MaxWidth"))
-#define wxIMAGE_OPTION_MAX_HEIGHT                       wxString(wxT("MaxHeight"))
-
-#define wxIMAGE_OPTION_BMP_FORMAT                       wxString(wxT("wxBMP_FORMAT"))
-#define wxIMAGE_OPTION_CUR_HOTSPOT_X                    wxString(wxT("HotSpotX"))
-#define wxIMAGE_OPTION_CUR_HOTSPOT_Y                    wxString(wxT("HotSpotY"))
-
-#define wxIMAGE_OPTION_GIF_COMMENT                      wxString(wxT("GifComment"))
-
-#define wxIMAGE_OPTION_PNG_FORMAT                       wxString(wxT("PngFormat"))
-#define wxIMAGE_OPTION_PNG_BITDEPTH                     wxString(wxT("PngBitDepth"))
-#define wxIMAGE_OPTION_PNG_FILTER                       wxString(wxT("PngF"))
-#define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL            wxString(wxT("PngZL"))
-#define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL        wxString(wxT("PngZM"))
-#define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY         wxString(wxT("PngZS"))
-#define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE      wxString(wxT("PngZB"))
-
-#define wxIMAGE_OPTION_TIFF_BITSPERSAMPLE               wxString(wxT("BitsPerSample"))
-#define wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL             wxString(wxT("SamplesPerPixel"))
-#define wxIMAGE_OPTION_TIFF_COMPRESSION                 wxString(wxT("Compression"))
-#define wxIMAGE_OPTION_TIFF_PHOTOMETRIC                 wxString(wxT("Photometric"))
-#define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR             wxString(wxT("ImageDescriptor"))
+#define wxIMAGE_OPTION_QUALITY                          wxString("quality")
+#define wxIMAGE_OPTION_FILENAME                         wxString("FileName")
+#define wxIMAGE_OPTION_RESOLUTION                       wxString("Resolution")
+#define wxIMAGE_OPTION_RESOLUTIONX                      wxString("ResolutionX")
+#define wxIMAGE_OPTION_RESOLUTIONY                      wxString("ResolutionY")
+#define wxIMAGE_OPTION_RESOLUTIONUNIT                   wxString("ResolutionUnit")
+#define wxIMAGE_OPTION_MAX_WIDTH                        wxString("MaxWidth")
+#define wxIMAGE_OPTION_MAX_HEIGHT                       wxString("MaxHeight")
+#define wxIMAGE_OPTION_ORIGINAL_WIDTH                   wxString("OriginalWidth")
+#define wxIMAGE_OPTION_ORIGINAL_HEIGHT                  wxString("OriginalHeight")
+
+#define wxIMAGE_OPTION_BMP_FORMAT                       wxString("wxBMP_FORMAT")
+#define wxIMAGE_OPTION_CUR_HOTSPOT_X                    wxString("HotSpotX")
+#define wxIMAGE_OPTION_CUR_HOTSPOT_Y                    wxString("HotSpotY")
+
+#define wxIMAGE_OPTION_GIF_COMMENT                      wxString("GifComment")
+
+#define wxIMAGE_OPTION_PNG_FORMAT                       wxString("PngFormat")
+#define wxIMAGE_OPTION_PNG_BITDEPTH                     wxString("PngBitDepth")
+#define wxIMAGE_OPTION_PNG_FILTER                       wxString("PngF")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL            wxString("PngZL")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL        wxString("PngZM")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY         wxString("PngZS")
+#define wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE      wxString("PngZB")
+
+#define wxIMAGE_OPTION_TIFF_BITSPERSAMPLE               wxString("BitsPerSample")
+#define wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL             wxString("SamplesPerPixel")
+#define wxIMAGE_OPTION_TIFF_COMPRESSION                 wxString("Compression")
+#define wxIMAGE_OPTION_TIFF_PHOTOMETRIC                 wxString("Photometric")
+#define wxIMAGE_OPTION_TIFF_IMAGEDESCRIPTOR             wxString("ImageDescriptor")
 
 
 enum
@@ -333,6 +334,24 @@ public:
         @since 2.9.2
      */
      static wxVersionInfo GetLibraryVersionInfo();
+
+protected:
+    /**
+       Called to get the number of images available in a multi-image file
+       type, if supported.
+       
+       NOTE: this function is allowed to change the current stream position
+             since GetImageCount() will take care of restoring it later
+    */
+    virtual int DoGetImageCount( wxInputStream& stream );
+
+    /**
+       Called to test if this handler can read an image from the given stream.
+       
+       NOTE: this function is allowed to change the current stream position
+             since CallDoCanRead() will take care of restoring it later
+    */
+    virtual bool DoCanRead( wxInputStream& stream ) = 0;
 };
 
 
@@ -348,6 +367,9 @@ const unsigned char wxIMAGE_ALPHA_TRANSPARENT = 0;
 */
 const unsigned char wxIMAGE_ALPHA_OPAQUE = 0xff;
 
+const unsigned char wxIMAGE_ALPHA_THRESHOLD = 0x80;
+
+
 /**
     @class wxImage
 
@@ -456,6 +478,10 @@ public:
             between HSV color space and RGB color space.
         */
         RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0);
+
+        unsigned char red;
+        unsigned char green;
+        unsigned char blue;
     };
 
     /**
@@ -472,6 +498,10 @@ public:
             between HSV color space and RGB color space.
         */
         HSVValue(double h=0.0, double s=0.0, double v=0.0);
+
+        double hue;
+        double saturation;
+        double value;        
     };
 
     /**
@@ -1064,7 +1094,7 @@ public:
         This is most often used when doing direct image manipulation.
         The return value points to an array of characters in RGBRGBRGB... format
         in the top-to-bottom, left-to-right order, that is the first RGB triplet
-        corresponds to the pixel first pixel of the first row, the second one ---
+        corresponds to the first pixel of the first row, the second one ---
         to the second pixel of the first row and so on until the end of the first
         row, with second row following after it and so on.
 
@@ -1174,6 +1204,12 @@ public:
             handler, this is still what happens however). These options must be
             set before calling LoadFile() to have any effect.
 
+        @li @c wxIMAGE_OPTION_ORIGINAL_WIDTH and @c wxIMAGE_OPTION_ORIGINAL_HEIGHT:
+            These options will return the original size of the image if either
+            @c wxIMAGE_OPTION_MAX_WIDTH or @c wxIMAGE_OPTION_MAX_HEIGHT is
+            specified.
+            @since 2.9.3
+
         @li @c wxIMAGE_OPTION_QUALITY: JPEG quality used when saving. This is an
             integer in 0..100 range with 0 meaning very poor and 100 excellent
             (but very badly compressed). This option is currently ignored for
@@ -1319,7 +1355,7 @@ public:
     bool IsOk() const;
 
     /**
-        Returns @true if the given pixel is transparent, i.e. either has the mask
+        Returns @true if the given pixel is transparent, i.e.\ either has the mask
         colour if this image has a mask or if this image has alpha channel and alpha
         value of this pixel is strictly less than @a threshold.
     */