]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/image.h
Add wxEventFilter and related functionality.
[wxWidgets.git] / interface / wx / image.h
index cc0e1abe7836341dd076d9f67f33fa0066b03c74..8f19e19969400f87cf4bee1fff579ebcec791376 100644 (file)
@@ -74,6 +74,57 @@ enum wxImagePNGType
     wxPNG_TYPE_PALETTE = 4      ///< Palette encoding.
 };
 
     wxPNG_TYPE_PALETTE = 4      ///< Palette encoding.
 };
 
+
+/**
+   Image option names.
+*/
+#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
+{
+    wxBMP_24BPP        = 24, // default, do not need to set
+    //wxBMP_16BPP      = 16, // wxQuantize can only do 236 colors?
+    wxBMP_8BPP         =  8, // 8bpp, quantized colors
+    wxBMP_8BPP_GREY    =  9, // 8bpp, rgb averaged to greys
+    wxBMP_8BPP_GRAY    =  wxBMP_8BPP_GREY,
+    wxBMP_8BPP_RED     = 10, // 8bpp, red used as greyscale
+    wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette
+    wxBMP_4BPP         =  4, // 4bpp, quantized colors
+    wxBMP_1BPP         =  1, // 1bpp, quantized "colors"
+    wxBMP_1BPP_BW      =  2  // 1bpp, black & white from red
+};
+
+
 /**
     @class wxImageHandler
 
 /**
     @class wxImageHandler
 
@@ -407,6 +458,10 @@ public:
             between HSV color space and RGB color space.
         */
         RGBValue(unsigned char r=0, unsigned char g=0, unsigned char b=0);
             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;
     };
 
     /**
     };
 
     /**
@@ -423,6 +478,10 @@ public:
             between HSV color space and RGB color space.
         */
         HSVValue(double h=0.0, double s=0.0, double v=0.0);
             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;        
     };
 
     /**
     };
 
     /**
@@ -494,7 +553,7 @@ public:
     /**
         @overload
     */
     /**
         @overload
     */
-    wxImage(const wxSize& sz, unsigned char* data, unsigned char* data, unsigned char* alpha,
+    wxImage(const wxSize& sz, unsigned char* data, unsigned char* alpha,
             bool static_data = false);
 
     /**
             bool static_data = false);
 
     /**
@@ -1125,6 +1184,12 @@ public:
             handler, this is still what happens however). These options must be
             set before calling LoadFile() to have any effect.
 
             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
         @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
@@ -1829,6 +1894,30 @@ public:
     static wxImage::RGBValue HSVtoRGB(const wxImage::HSVValue& hsv);
 };
 
     static wxImage::RGBValue HSVtoRGB(const wxImage::HSVValue& hsv);
 };
 
+
+class wxImageHistogram : public wxImageHistogramBase
+{
+public:
+    wxImageHistogram();
+
+    // get the key in the histogram for the given RGB values
+    static unsigned long MakeKey(unsigned char r,
+                                 unsigned char g,
+                                 unsigned char b);
+
+    // find first colour that is not used in the image and has higher
+    // RGB values than RGB(startR, startG, startB)
+    //
+    // returns true and puts this colour in r, g, b (each of which may be NULL)
+    // on success or returns false if there are no more free colours
+    bool FindFirstUnusedColour(unsigned char *r,
+                               unsigned char *g,
+                               unsigned char *b,
+                               unsigned char startR = 1,
+                               unsigned char startG = 0,
+                               unsigned char startB = 0 ) const;
+};
+
 /**
     An instance of an empty image without an alpha channel.
 */
 /**
     An instance of an empty image without an alpha channel.
 */