X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c3b10b44346cc1003c9430ee6b65f934d9d9ce1d..9485b24f43766ad97ba1b77a70c7c1f2a40184a6:/src/common/imagpng.cpp diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 5d91abbe17..44c21654ec 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -33,7 +33,7 @@ #include "wx/stream.h" #endif -#include +#include "png.h" // For memcpy #include @@ -710,6 +710,21 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos : PNG_COLOR_TYPE_GRAY; } + if (image->HasOption(wxIMAGE_OPTION_PNG_FILTER)) + png_set_filter( png_ptr, PNG_FILTER_TYPE_BASE, image->GetOptionInt(wxIMAGE_OPTION_PNG_FILTER) ); + + if (image->HasOption(wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL)) + png_set_compression_level( png_ptr, image->GetOptionInt(wxIMAGE_OPTION_PNG_COMPRESSION_LEVEL) ); + + if (image->HasOption(wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL)) + png_set_compression_mem_level( png_ptr, image->GetOptionInt(wxIMAGE_OPTION_PNG_COMPRESSION_MEM_LEVEL) ); + + if (image->HasOption(wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY)) + png_set_compression_strategy( png_ptr, image->GetOptionInt(wxIMAGE_OPTION_PNG_COMPRESSION_STRATEGY) ); + + if (image->HasOption(wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE)) + png_set_compression_buffer_size( png_ptr, image->GetOptionInt(wxIMAGE_OPTION_PNG_COMPRESSION_BUFFER_SIZE) ); + png_set_IHDR( png_ptr, info_ptr, image->GetWidth(), image->GetHeight(), iBitDepth, iPngColorType, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,