Resolution Refers To The Number of Lines and Columns On Computer Screen. Default Screen Has
Resolution Refers To The Number of Lines and Columns On Computer Screen. Default Screen Has
Resolution Refers To The Number of Lines and Columns On Computer Screen. Default Screen Has
Usman Akmal
GRAPHICS IN QBASIC
All graphics on computers are composed of many pixels. Lines, boxes and circles really are
just groups of pixels turned on while others are turned off.
The upper-left pixel is called the home location; this pixel is located at column 0, row 0 and,
therefore, has the designation (0, 0). As a rule, the column number is listed first in a pixel’s
designation. A pixel located at (34, 50), for example, is an intersection of graphics column 34
and graphics row 50.
When pixel’s location is designated with its row and column intersection, the location is known
as coordinate. The columns across the screen are known as x-coordinates, whereas the rows
down the screen are known as y-coordinates. The coordinate (9,56), therefore, refers to x-
position 9 and y-position 56.
The operating state in which one places a program by choosing among a set of operating options
is called program’s mode. To display graphics, screen must be in graphics mode. If text mode
is changed to graphics mode (using screen command), program erases text on-screen in making
the mode change.
Mode can be any value listed in Table 1. Screen mode 0 supports only text mode.
Screen Description
Mode
0 QBasic default for text resolution of 80×25. Supports up to 16 colors (0 – 15)
320 × 200 graphics resolution. Also supports 40 × 25 text mode and 4 of 16
1
colors.
Page 1 of 3
Computer Programing Graphics in QBasic Dr. Usman Akmal
Screen Description
Mode
640 × 200 graphics resolution. Also supports 80 × 25 text mode and 2 of 16
2
colors (Black and White).
320 × 200 graphics resolution. Also supports 40 × 25 text mode and 16
7
colors.
640 × 200 graphics resolution. Also supports 80 × 25 text mode and 16
8
colors.
640 × 350 graphics resolution. Also supports 80 × 25 text mode and 16
9
colors.
10 640 × 350 graphics resolution. Also supports 80 × 25 text mode and 2 colors.
11 640 × 480 graphics resolution. Also supports 80 × 25 text mode and 2 colors.
640 × 480 graphics resolution. Also supports 80 × 30 text mode and 16
12
colors.
320 × 200 graphics resolution. Also supports 40 × 25 text mode and 256
13
colors.
PSET Statement
Syntax
Where
(x,y) specify the screen coordinate where you want to draw a point.
Use the optional STEP keyword indicates that the (x,y) values are relative, not absolute. The
coordinates are treated as distances from the most recent location of the graphics cursor, not
distances from the (0,0) screen coordinate.
Example
This example draws a line from (0,0) to (100,100), then erases the line by writing over it with
the background color.
Page 2 of 3
Computer Programing Graphics in QBasic Dr. Usman Akmal
SCREEN
FOR I = 0 TO 100
PSET (I, I)
NEXT I
LOCATE 16, 2: INPUT “Press any key to erase the line “, Gar$
For I = 0 TO 100
NEXT I
Page 3 of 3