- Add "checked" property for toolbar tool elements in XRC.
- Allow customization of the locations where persistent settings are stored.
- Restore support for reusing ids more than 254 times (Armel Asselin).
+- Added wxIMAGE_OPTION_ORIGINAL_{WIDTH,HEIGHT} (Catalin Raceanu).
OSX:
#define wxIMAGE_OPTION_MAX_WIDTH wxString(wxT("MaxWidth"))
#define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxT("MaxHeight"))
+#define wxIMAGE_OPTION_ORIGINAL_WIDTH wxString(wxT("OriginalWidth"))
+#define wxIMAGE_OPTION_ORIGINAL_HEIGHT wxString(wxT("OriginalHeight"))
+
// constants used with wxIMAGE_OPTION_RESOLUTIONUNIT
//
// NB: don't change these values, they correspond to libjpeg constants
#define wxIMAGE_OPTION_RESOLUTIONUNIT wxString(wxT("ResolutionUnit"))
#define wxIMAGE_OPTION_MAX_WIDTH wxString(wxT("MaxWidth"))
#define wxIMAGE_OPTION_MAX_HEIGHT wxString(wxT("MaxHeight"))
+#define wxIMAGE_OPTION_ORIGINAL_WIDTH wxString(wxT("OriginalWidth"))
+#define wxIMAGE_OPTION_ORIGINAL_HEIGHT wxString(wxT("OriginalHeight"))
#define wxIMAGE_OPTION_BMP_FORMAT wxString(wxT("wxBMP_FORMAT"))
#define wxIMAGE_OPTION_CUR_HOTSPOT_X wxString(wxT("HotSpotX"))
handler, this is still what happens however). These options must be
set before calling LoadFile() to have any effect.
+ @li @c wxIMAGE_OPTION_ORIGINAL_WIDTH and @c wxIMAGE_OPTION_ORIGINAL_HEIGHT:
+ These options will return the original size of the image if either
+ @c wxIMAGE_OPTION_MAX_WIDTH or @c wxIMAGE_OPTION_MAX_HEIGHT is
+ specified.
+ @since 2.9.3
+
@li @c wxIMAGE_OPTION_QUALITY: JPEG quality used when saving. This is an
integer in 0..100 range with 0 meaning very poor and 100 excellent
(but very badly compressed). This option is currently ignored for
return;
}
+ int origWidth = image.GetOptionInt( wxIMAGE_OPTION_ORIGINAL_WIDTH );
+ int origHeight = image.GetOptionInt( wxIMAGE_OPTION_ORIGINAL_HEIGHT );
+
const long loadTime = sw.Time();
MyImageFrame * const frame = new MyImageFrame(this, filename, image);
- wxLogStatus(frame, "Loaded \"%s\" in %ldms", filename, loadTime);
+ wxLogStatus(frame, "Loaded \"%s\" in %ldms; original size was (%d, %d)",
+ filename, loadTime, origWidth, origHeight);
#else
wxLogError( wxT("Couldn't create file selector dialog") );
return;
}
if ( width != widthOrig || height != heightOrig )
+ {
+ // get the original size if it was set by the image handler
+ // but also in order to restore it after Rescale
+ int widthOrigOption = GetOptionInt(wxIMAGE_OPTION_ORIGINAL_WIDTH),
+ heightOrigOption = GetOptionInt(wxIMAGE_OPTION_ORIGINAL_HEIGHT);
+
Rescale(width, height, wxIMAGE_QUALITY_HIGH);
+
+ SetOption(wxIMAGE_OPTION_ORIGINAL_WIDTH, widthOrigOption ? widthOrigOption : widthOrig);
+ SetOption(wxIMAGE_OPTION_ORIGINAL_HEIGHT, heightOrigOption ? heightOrigOption : heightOrig);
+ }
}
// Set this after Rescale, which currently does not preserve it
image->SetOption(wxIMAGE_OPTION_RESOLUTIONUNIT, cinfo.density_unit);
}
+ if ( cinfo.image_width != cinfo.output_width || cinfo.image_height != cinfo.output_height )
+ {
+ // save the original image size
+ image->SetOption(wxIMAGE_OPTION_ORIGINAL_WIDTH, cinfo.image_width);
+ image->SetOption(wxIMAGE_OPTION_ORIGINAL_HEIGHT, cinfo.image_height);
+ }
+
jpeg_finish_decompress( &cinfo );
jpeg_destroy_decompress( &cinfo );
return true;