Re: Monitor aspect ratio
- From: "Wessam Bahnassi" <wbahnassi@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 22 Aug 2005 00:34:11 +0300
Well there is an assumption here. I assume that the user has his desktop
resolution set to give a square pixel (it's uncommon that people leave their
working
desktop resolution stretched). So, given that his screen's square pixel
is at an aspect ratio of 1.6, then you can calculate the ratio you need for
the resolution you'll be running at...
If the user has his desktop set to a resolution that doesn't preserve square
pixels, then his whole Windows experience is stretched, and the square
pixels might look strange to him in the end :)
Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez
"Robert Dunlop [MS MVP]" <rdunlop@xxxxxxxx> wrote in message
news:uS3OiNlpFHA.3516@xxxxxxxxxxxxxxxxxxxxxxx
> "Wessam Bahnassi" <wbahnassi@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> message news:er7dO0hpFHA.1464@xxxxxxxxxxxxxxxxxxxxxxx
>> You can read the current display mode of the monitor before changing the
>> display mode yourself in D3D. Since the current display mode reflects the
>> user's desktop aspect ratio, then just divide its width by its height and
>> voiala... On my laptop's widescreen, the display mode is 1680x1050, which
>> means its aspect ratio is 1.6...
>
> You are assuming here that the pixels are square? If you were to measure
> your desktop, is the ratio of physical width to height 1.6:1? I don't
> think this can be assumed, for example in my desktop control panel I have
> 5 different resolutions with 1280 columns, ranging from 1280x720 to
> 1280x1024. So while the physical aspect ratio of the monitor is 4:3
> (1.3333), the ratio of horizontal to vertical pixels could be 1.77778,
> 1.66667, 1.6, 1.33333, or 1.25, depending on the selected desktop
> resolution.
>
> You can use the GDI function GetDeviceCaps to read the dimensions of a
> display referenced by a device context:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_88s3.asp?frame=true
>
> For example, I've used the following code for reading the physical
> dimensions of the desktop device:
>
> HDC hdc;
> hdc=GetDC(0);
> int widthInMM=GetDeviceCaps(hdc,HORZSIZE);
> int heightInMM=GetDeviceCaps(hdc,VERTSIZE);
>
> To determine the aspect ratio of a monitor on a multimonitor systems, you
> would want to use a DC for the specific monitor in question.
>
>
> --
> Robert Dunlop
> The X-Zone
> http://www.directxzone.com/
> Microsoft DirectX MVP
> -------------
> The opinions expressed in this message are my own personal views and do
> not reflect the official views of the Microsoft Corporation.
> The MVP program does not constitute employment or contractual obligation
> with Microsoft.
>
.
- References:
- Monitor aspect ratio
- From: Fiorina Entertainment
- Re: Monitor aspect ratio
- From: Wessam Bahnassi
- Re: Monitor aspect ratio
- From: Robert Dunlop [MS MVP]
- Monitor aspect ratio
- Prev by Date: Re: Monitor aspect ratio
- Next by Date: Re: managed pool question
- Previous by thread: Re: Monitor aspect ratio
- Next by thread: depth complexity
- Index(es):
Relevant Pages
|