I have an MFC application displaying images where I need to display the image in true-size i.e. the image should be rendered such that phys开发者_开发知识库ical length of the object captured on the image should be same as the displayed length. For example, if I captured a object of 5 cm length the image should be displayed such that if I take a scale and measure its length on the monitor it should be 5 cm. I know the distance between the pixels in the image. But I need to display these images on different types of monitors. How do I get the physical distance between the pixels on the monitor? Any clues? Or is there any other way to implement it?
The proper way would be calling GetDeviceCaps
with LOGPIXELSX
and LOGPIXELSY
. For a screen device context, however, it is very likely that the value will simply be set to 96 (it is set by the user in a control panel). The function works fine for printer DCs.
As you rightly point out you need to know the size of the monitor. Short of asking the user to input the size you are unable to do this.
精彩评论