SetAspect(XAspect, YAspect)
Sets the horizontal and vertical portions of the aspect ratio used in circle drawing.
The three different video modes that the GRAFIX program supports each have a different number of points horizontally than vertically. For example, the 640x200x16 color graphics mode has 640 points horizontally by 200 points vertically. Another factor is the computer monitor you are using. Computer monitors are just like televisions sets in that ratio to the number of points horizontally to the number of points vertically is 4:3. These two factors mean that when you draw a shape on the graphics screen it will look out of proportion to its size. For example a 100x100 box drawn on the 640x200 graphics screen would like approximately like this:
********The box is 100 points high by 100 points wide, yet it is not square. Any shape drawn in any one of the three graphics mode will suffer the same result unless the points are scaled in proportion to the 4:3 ratio of the computer monitor and to the number of horizontal and vertical points for the graphics mode being used. The scaling factor used in drawing circles is called the aspect ratio. This is calculated by dividing the number of points horizontally by the number of points vertically. Divide this number by 4 and then multiply by 3. The aspect ratio for the 640x200 graphics mode is 2.4 ((640 / 200) / 4) * 3). There is a problem in that the GRAFIX program cannot accept fractional numbers as a parameter. The solution here is to break the aspect ratio into two parts: a horizontal portion and vertical portion. This can be done for any graphics mode by dividing down the number of horizontal and vertical points until they both cannot be divided evenly anymore and scaling the horizontal portion. The 640x200 mode would work like this:
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
********
640 64 16 16 / 4 4 4 * 3 12
--- : -- : -- : -- : - : - : --
200 20 5 5 5 5 5
The final answer is 12:5. First we divided 640:200 down to 16:5. The horizontal portion was then scaled by dividing by 4 and multiplying by 3. You will notice that 12 divided by 5 happens to be 2.4.
Each graphics mode has a default aspect ratio so that circles drawn will be perfectly round. The reason you are allowed to change the aspect ratio with this function is that you may not want to draw a perfectly round circle every time. By changing the aspect ratio values you can draw a circle that is more elongated either horizontally or vertically. This gives you much more flexibility in drawing circular shapes.
Parameters
XAspect - Horizontal portion of the aspect ratio
YAspect - Vertical portion of the aspect ratio
Examples
BASIC
CALL SetAspect(12, 5)PASCAL
SetAspect(12, 5);BGI equivalent
void setaspectratio(int xasp, int yasp);