Microsoft KB Archive/48058

= Graphics Algorithm Different in QuickBasic Versus GW-Basic =

Article ID: 48058

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 1.01
 * Microsoft QuickBasic 1.02
 * Microsoft QuickBasic 2.01
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q48058



SUMMARY
When constructing an image with multiple-line statements, the image may not appear as fully symmetrical as the x and y coordinates indicate. The algorithm used by QuickBasic to draw the various graphic images executes the starting and ending coordinates in a specific order to produce the fastest results. This algorithm is different than that of GW-Basic, where each line is drawn literally.

This information applies to Microsoft QuickBasic Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50 for MS-DOS, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, to Microsoft Basic PDS Version 7.00, and to Microsoft GW-Basic Versions 3.20, 3.22, and 3.23 for MS-DOS.



MORE INFORMATION
The algorithm used by QuickBasic to draw the various graphic images determines the fastest way to draw the image and then constructs that image on the screen. The LINE statement is the best example, with the following syntax:

LINE (50,0) - (100,200)

LINE (150,0) - (100,200)

Under QuickBasic, the algorithm draws the initial line, from (50,0) to (100,200), then evaluates the next statement and draws the next line from (100,200) to (150,0). GW-Basic draws the first line similar to QuickBasic, but then draws the next line from (150,0) to (100,200).

This is not considered a problem, but is a feature of the QuickBasic graphics algorithm that makes it faster and more efficient than the interpreted sequential method of graphics. This difference is illustrated when using a medium to low resolution graphics screen, as in the following code example. The two lines drawn do not look symmetrical under QuickBasic, but are drawn identically under GW-Basic. The two lines are exactly the same, but one is inverted from the other.

Code Example
10 SCREEN 1 20 LINE (160, 90)-(140, 1), 1 30 LINE (162, 90)-(182, 1), 1

Additional query words: QuickBas BasicCom

Keywords: KB48058

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.