Add wxIMAGE_OPTION_GIF_TRANSPARENCY for GIF image loading

Allow to keep the originally defined transparent pixels colour instead
of replacing it with bright pink (which is still the default behaviour).

Closes #18014.
This commit is contained in:
Hugo Elias
2017-12-24 15:14:00 +01:00
committed by Vadim Zeitlin
parent 1ebc28787c
commit 28bf0e8687
4 changed files with 69 additions and 12 deletions

View File

@@ -93,6 +93,9 @@ enum wxImagePNGType
#define wxIMAGE_OPTION_CUR_HOTSPOT_Y wxString("HotSpotY")
#define wxIMAGE_OPTION_GIF_COMMENT wxString("GifComment")
#define wxIMAGE_OPTION_GIF_TRANSPARENCY wxString("Transparency")
#define wxIMAGE_OPTION_GIF_TRANSPARENCY_HIGHLIGHT wxString("Highlight")
#define wxIMAGE_OPTION_GIF_TRANSPARENCY_UNCHANGED wxString("Unchanged")
#define wxIMAGE_OPTION_PNG_FORMAT wxString("PngFormat")
#define wxIMAGE_OPTION_PNG_BITDEPTH wxString("PngBitDepth")
@@ -1287,6 +1290,19 @@ public:
PHOTOMETRIC_MINISWHITE or PHOTOMETRIC_MINISBLACK. The other values
are taken care of.
Options specific to wxGIFHandler:
@li @c wxIMAGE_OPTION_GIF_TRANSPARENCY: How to deal with transparent pixels.
By default, the color of transparent pixels is changed to bright pink, so
that if the image is accidentally drawn without transparency, it will be
obvious.
Normally, this would not be noticed, as these pixels will not be rendered.
But in some cases it might be useful to load a GIF without making any
modifications to its colours.
Use @c wxIMAGE_OPTION_GIF_TRANSPARENCY_UNCHANGED to keep the colors correct.
Use @c wxIMAGE_OPTION_GIF_TRANSPARENCY_HIGHLIGHT to convert transparent pixels
to pink (default).
This option has been added in wxWidgets 3.1.1.
@note
Be careful when combining the options @c wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL,
@c wxIMAGE_OPTION_TIFF_BITSPERSAMPLE, and @c wxIMAGE_OPTION_TIFF_PHOTOMETRIC.