Instance
Recently made a visual inspection of the app project, which used to convert the pixel to the actual size, after the research learned some knowledge, here and you share.
The implementation steps are:
First get the physical parameters:
1. Cell phone pixel density (1 inches =x pixels) Dpix/dpiy
2. Ratio of actual pixel to logical pixel scale
then figure out how many pixels per millimeter (in our custom use millimeters or centimeters, so convert inches to millimeters, 1 inches = 25.4 millimeters)
Finally convert the virtual pixel to the actual pixel
"Actual resolution vs. Logical Resolution"
As we all know, the computer can be set to a variety of resolutions, can be different from the real pixel, so that will produce a real size and display size ratio, when the same ratio is set at 1, when not the same ratio is not 1, so if you want to get real resolution and size conversion must take advantage of this scale. For example, the actual pixel on the iphone5 is 640*1136, the logical resolution is 320*568, and the ratio is 2.
The conversion formula is: true resolution = logical Resolution X scale
The accurate conversion of pixel and dimension by actual resolution and logical resolution