+
+ // get the resolution from the image options or fall back to 72dpi standard
+ // for the BMP format if not specified
+ int hres, vres;
+ switch ( GetResolutionFromOptions(*image, &hres, &vres) )
+ {
+ default:
+ wxFAIL_MSG( wxT("unexpected image resolution units") );
+ // fall through
+
+ case wxIMAGE_RESOLUTION_NONE:
+ hres =
+ vres = 72;
+ // fall through to convert it to correct units
+
+ case wxIMAGE_RESOLUTION_INCHES:
+ // convert resolution in inches to resolution in centimeters
+ hres = (int)(10*mm2inches*hres);
+ vres = (int)(10*mm2inches*vres);
+ // fall through to convert it to resolution in meters
+
+ case wxIMAGE_RESOLUTION_CM:
+ // convert resolution in centimeters to resolution in meters
+ hres *= 100;
+ vres *= 100;
+ break;
+ }
+
+ hdr.h_res = wxUINT32_SWAP_ON_BE(hres);
+ hdr.v_res = wxUINT32_SWAP_ON_BE(vres);