Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
As converting from pixeles to millimeters?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00184560
Message ID:
00184694
Views:
13
>Note: I am use a traslator.
>
>Please, some of you can inform me as converting correctly from pixeles to millimeters and vice versa. Try to make it calculating the values they show in the properties of an image in several edition programs of graphics, but I have not been able to give with it formulates it correct.
>
Hi Mario,

If I understand correctly, you want the horizontal and vertical pixels per millimeter. The following should get you going in the right direction:
#define HORZSIZE 4  && Horizontal size in millimeters
#define VERTSIZE 6  && Vertical size in millimeters
#define HORZRES  8  && Horizontal width in pixels
#define VERTRES 10 && Vertical height in pixels
DECLARE INTEGER ReleaseDC IN Win32Api;
  INTEGER nwnd, INTEGER hdc
DECLARE INTEGER GetDC IN Win32API;
  INTEGER hWnd
DECLARE INTEGER GetDeviceCaps IN Win32API;
  INTEGER hdc, INTEGER nIndex
* Get a device context
lnhDC = GetDC(0)
* Get the horizontal size in millimeters
lnhorzsize = GetDeviceCaps(lnhDC, HORZSIZE)
* Get the horizontal width in pixels
lnhorzres = GetDeviceCaps(lnhDC, HORZRES)
* Horizontal pixels per millimeter
lnhpixels = lnhorzres / lnhorzsize
* Get the vertical size in millimeters
lnvertsize = GetDeviceCaps(lnhDC, VERTSIZE)
* Get the vertical width in pixels
lnvertres = GetDeviceCaps(lnhDC, VERTRES)
* Vertical pixels per millimeter
lnvpixels = lnvertres / lnvertsize
* Release the device context
= ReleaseDC(0, lnhDC)
hth,
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform