[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] How to control the physical size of displayed objects?



On Thu, Feb 28, 2013 at 01:28:01PM +0100, Mathieu Dubois wrote:
>
>
> Le 27/02/2013 22:33, Julian a écrit :
>> On 02/27/2013 04:23 PM, Mathieu Dubois wrote:
>>> Just a last question: do you think the horizontal and vertical factors
>>> has to be the same? Because list_modes() tells me that my monitor can
>>> display: 1280x800 (ratio: 1.6), 1024x768 (ratio: 1.33), 800x600
>>> (ratio: 1.33), 640x480 (ratio: 1.33).
>>
>> You mean dealing with wrong aspect ratios? That's a tough one because
>> different drivers handle it differently; some distort the picture, some
>> zoom it while maintaining the aspect ratio, some don't zoom it at all. I
>> would say that it's best to either assume there is no distortion of
>> aspect ratio (i.e. a square is a square), or allow a horizontal
>> adjustment that normally syncs with the vertical adjustment.
>
> I'm not sure to understand the difference between the 2 solutions you  
> suggest but it seems reasonnable to assume that the horizontal and  
> vertical ratios are the same (a square image of say 256x256 pixels will  
> be displayed as a square).
>
> I will try to code a simple application in order to test.
>
> Mathieu
>

Unfortunately, no you cannot assume a square aspect ratio. A widescreen 
monitor could be using a non-widescreen resolution, or vice-versa. There 
is no reliable way to know.

I discovered that The Gimp uses on-screen rulers to calibrate DPI, you 
might want to look at how it is done there. (Edit->Preferences->Display 
and then click the calibrate button)

---
James Paige