X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/999836aacade840a5d9a0cbb5fad7b1d4de62c93..6ed8156e8ac28d5edabcb19a0213f3969955ebd5:/src/common/imagjpeg.cpp diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index a35e1e57e5..d2d50a0e5d 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -40,6 +40,9 @@ extern "C" { + #if defined(__WXMSW__) + #define XMD_H + #endif #include "jpeglib.h" } @@ -356,6 +359,21 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo if (image->HasOption(wxT("quality"))) jpeg_set_quality(&cinfo, image->GetOptionInt(wxT("quality")), TRUE); + // sets the resolution fields in the output file + if (image->HasOption(wxIMAGE_OPTION_RESOLUTION)) + { + cinfo.X_density = + cinfo.Y_density = image->GetOptionInt(wxIMAGE_OPTION_RESOLUTION); + } + + // sets the resolution unit field in the output file + // wxIMAGE_RESOLUTION_INCHES for inches + // wxIMAGE_RESOLUTION_CM for centimeters + if (image->HasOption(wxIMAGE_OPTION_RESOLUTIONUNIT)) + { + cinfo.density_unit = image->GetOptionInt(wxIMAGE_OPTION_RESOLUTIONUNIT); + } + jpeg_start_compress(&cinfo, TRUE); stride = cinfo.image_width * 3; /* JSAMPLEs per row in image_buffer */