By default, a point is a pair of whole numbers, the X and Y coordinates,
and therefore it is highly device-dependent: using a Color Graphic Adapter
(CGA) mode, for instance, the valid coordinate range is
through
in 4-color mode,
and
and
in Black&White mode.
With a Hercules-monochrome adapter, the range becomes
through
, and so on;
is
always the upper left corner of the screen, contrary to mathematical
tradition. Note that BGI routines usually clip their parameters to
the screen rectangle.
Now PCSCHEME allows you to freely define the coordinate system you'd like to use. You only need to specify the desired coordinates of the upper left and bottom right corner, no matter which video adapter or other device is present. A typical sequence would be:
(set-world!![]()
) (init-graph) ; detect and initialize video adapter
(set-world!![]()
) ; set the screen coordinates with origin centered
(put-pixel![]()
) ; plot a blue pixel at center of screen
Note that the X and Y coordinates are now real numbers, so you are allowed to call SET-WORLD! with parameters like:
(set-world! `((- ,pi) . 1) `(,pi . -1)) ; ideal to plot a sine...
Of course, if you need to scan every pixel, you can use GET-MAX-XY to obtain the actual resolution of your screen adapter.
If you are urging to try BGI by yourself, skip to part ,
page
.
What follows is an extension to the BGI standard.