added support for reading resolution information from TIFF, JPEG and BMP formats; corrected some bugs with saving resolution; added command allowing to see the image resolution (if available) to the sample (heavily modified patch 1790546)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-09-08 18:32:36 +00:00
parent 66e2ba91b2
commit 37ba70a520
5 changed files with 192 additions and 25 deletions

View File

@@ -310,6 +310,17 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
}
}
// set up resolution if available: it's part of optional JFIF APP0 chunk
if ( cinfo.saw_JFIF_marker )
{
image->SetOption(wxIMAGE_OPTION_RESOLUTIONX, cinfo.X_density);
image->SetOption(wxIMAGE_OPTION_RESOLUTIONY, cinfo.Y_density);
// we use the same values for this option as libjpeg so we don't need
// any conversion here
image->SetOption(wxIMAGE_OPTION_RESOLUTIONUNIT, cinfo.density_unit);
}
jpeg_finish_decompress( &cinfo );
jpeg_destroy_decompress( &cinfo );
return true;