Supported Browsers Home   
MGL_setAlphaValue Previous   
MGL_setBackColor Next   
External Functions Up   

MGL_setAspectRatio

Sets the current video mode's aspect ratio.

Declaration

void MGLAPI MGL_setAspectRatio(
    int aspectRatio)

Prototype In

mgraph.h

Parameters

aspectRatio

New value for the aspect ratio

 

Description

This function sets the aspect ratio for the device context to a new value. This ratio is equal to:

pixel x size
------------  * 1000
pixel y size

The device context aspect ratio can be used to display circles and squares on the device by approximating them with ellipses and rectangles of the appropriate dimensions. Thus in order to determine the number of pixels in the y direction for a square with 100 pixels in the x direction, we can simply use the code:

y_pixels = ((long)x_pixels * 1000) / aspectratio

Note the cast to a long to avoid arithmetic overflow, as the aspect ratio is returned as an integer value with 1000 being a 1:1 aspect ratio.

See Also

MGL_getAspectRatio

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com