Solved

D2: Pixel aspect ratio

Posted on 1997-08-25
3
426 Views
Last Modified: 2010-04-06
How do i obtain the pixel aspect ratio (its physical height vs width in millimeters) in Delphi 2
0
Comment
Question by:gk082597
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
Comment Utility
try this, e.g.

const INCHES_PER_MILIMETER : Real  = 0.04;

....

var PixX, PixY : integer;
    PixPerMMX, PixPerMMY : real;
    AspectRatio : real;

PixX := GetDeviceCaps({Device Context}, LOGPIXELSX);
PixY := GetDeviceCaps({Device Context}, LOGPIXELSY);

PixMMX := INCHES_PER_MILIMETER * PixX;
PixMMY := INCHES_PER_MILIMETER  * PixY;

AspectRatio := PixMMY/PixMMX;
....


{Device Context} e.g. Printer.Handle

From Delphi help :

The GetDeviceCaps function retrieves device-specific information about a specified device.

int GetDeviceCaps(

    HDC  hdc,      // device-context handle
    int  nIndex       // index of capability to query  
   );

hdc

Identifies the device context.

nIndex

Specifies the item to return. This parameter can be one of the following values: I recommend you should look at these!!!!

Have fun,
c.u. ZifNab;
0
 

Author Comment

by:gk082597
Comment Utility
It workt just fine. Thanks
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
Glad I could help.

Have fun,
c.u. BanZif;
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now