wxIMAGE_RESOLUTION_CM = 2
};
+/**
+ Image resize algorithm.
+
+ This is used with wxImage::Scale() and wxImage::Rescale().
+ */
+enum wxImageResizeQuality
+{
+ /// Simplest and fastest algorithm.
+ wxIMAGE_QUALITY_NEAREST,
+
+ /// Compromise between wxIMAGE_QUALITY_NEAREST and wxIMAGE_QUALITY_BICUBIC.
+ wxIMAGE_QUALITY_BILINEAR,
+
+ /// Highest quality but slowest execution time.
+ wxIMAGE_QUALITY_BICUBIC,
+
+ /// Default image resizing algorithm used by wxImage::Scale().
+ wxIMAGE_QUALITY_NORMAL,
+
+ /// Best image resizing algorithm, currently same as wxIMAGE_QUALITY_BICUBIC.
+ wxIMAGE_QUALITY_HIGH
+};
+
/**
Possible values for PNG image type option.
The constants ::wxIMAGE_ALPHA_TRANSPARENT and ::wxIMAGE_ALPHA_OPAQUE can be
used to indicate those values in a more readable form.
- Unlike RGB data, not all images have an alpha channel and before using
- wxImage::GetAlpha you should check if this image contains an alpha channel
- with wxImage::HasAlpha. Note that currently only the PNG format has full
- alpha channel support so only the images loaded from PNG files can have
+ While all images have RGB data, not all images have an alpha channel. Before
+ using wxImage::GetAlpha you should check if this image contains an alpha
+ channel with wxImage::HasAlpha. Note that currently only the PNG format has
+ full alpha channel support so only the images loaded from PNG files can have
alpha and, if you initialize the image alpha channel yourself using
wxImage::SetAlpha, you should save it in PNG format to avoid losing it.
@see Scale()
*/
wxImage& Rescale(int width, int height,
- int quality = wxIMAGE_QUALITY_NORMAL);
+ wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL);
/**
Changes the size of the image in-place without scaling it by adding either a
This is also useful for scaling bitmaps in general as the only other way
to scale bitmaps is to blit a wxMemoryDC into another wxMemoryDC.
- The parameter @a quality determines what method to use for resampling the image.
- Can be one of the following:
- - wxIMAGE_QUALITY_NORMAL: Uses the normal default scaling method of pixel
- replication
- - wxIMAGE_QUALITY_HIGH: Uses bicubic and box averaging resampling methods
- for upsampling and downsampling respectively
+ The parameter @a quality determines what method to use for resampling
+ the image, see wxImageResizeQuality documentation.
It should be noted that although using @c wxIMAGE_QUALITY_HIGH produces much nicer
looking results it is a slower method. Downsampling will use the box averaging
@see Rescale()
*/
wxImage Scale(int width, int height,
- int quality = wxIMAGE_QUALITY_NORMAL) const;
+ wxImageResizeQuality quality = wxIMAGE_QUALITY_NORMAL) const;
/**
Returns a resized version of this image without scaling it by adding either a