⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fgkslib.old

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 OLD
📖 第 1 页 / 共 3 页
字号:
:H1.Using the WATCOM Graphical Kernel System
.*
:H2.Supported Operating Systems
.*
:I1.WATCOM GKS:I2.using DOS
WATCOM GKS runs under the DOS operating system in 16-bit real mode.
.*
:H2.Supported Devices
.*
:I1.WATCOM GKS:I2.see also GKS
WATCOM GKS supports the following devices:
:I1.GKS:I2.devices supported
:UL compact.
:I1.CGA
:LI.IBM Colour/Graphics Display Adapter (CGA)
:I1.PCjr
:LI.IBM PCjr Colour Graphics Adapter (PCjr)
:I1.EGA
:LI.IBM Enhanced Graphics Adapter (EGA)
:I1.VGA
:LI.IBM Video Graphics Array (VGA)
:I1.MCGA
:LI.IBM Multi-Colour Graphics Adapter (MCGA)
:I1.IBM Graphics Printer
:LI.IBM Graphics Printer
:I1.Hercules adapter
:LI.Hercules Monochrome Graphics Adapter
:I1.character graphics
:LI.Character graphics on non-graphic displays
:I1.metafiles
:I1.pixel arrays
:LI.Pixel Arrays (a bit map file or virtual display)
:I1.GKS metafiles
:LI.GKS Metafiles
:eUL.
.np
WATCOM GKS is described in the
:CIT.
WATCOM GKS Graphics Tutorial and Reference
:eCIT.
manual.
.*
:H2.Components of the WATCOM GKS Support
.*
:I1.GKS:I2.running applications
The following files are necessary to use the WATCOM GKS subroutine
library.
.begnote $break
:I1.GKS:I2.libraries required
.note WGKS.EXE
:I1.GKS:I2.WGKS.EXE
:I1.WGKS.EXE
This program file, located in "&pathnamup\BIN", contains the WATCOM
Graphical Kernel System support code.
Normally, this program should be run before the application that
requires it is run.
WGKS is a terminate-and-stay-resident program that can be loaded and
unloaded (by specifying the "quit" argument).
.note HERCBIOS.COM
:I1.GKS:I2.HERCBIOS.COM
:I1.HERCBIOS.COM
This program, located in "&pathnamup\BIN", must be run before using
the WATCOM GKS software with a Hercules Graphics adapter.
This program supports the output of non-graphical text to the screen
when in a graphics mode using the Hercules Graphics Adapter.
It is also a terminate-and-stay-resident program that can be loaded
and unloaded (by specifying the "quit" argument).
.note WGKS.LIB
:I1.GKS:I2.WGKS.LIB
:I1.WGKS.LIB
:I1.library files:I2.WGKS.LIB
This file contains a number of object files which define the interface
to the WATCOM GKS library routines contained in "WGKS.EXE".
It is located in "&pathnamup\LIB286\DOS".
This library is required when linking any FORTRAN application that
uses WATCOM GKS graphics routines.
.note WGKSCVR.LIB
:I1.GKS:I2.WGKSCVR.LIB
:I1.WGKSCVR.LIB
:I1.library files:I2.WGKSCVR.LIB
This file includes cover routines which simplify the use of GKS.
It is located in "&pathnamup\LIB286\DOS".
These cover routines are described in this chapter.
.note GKSDEMOS <DIR>
The files in the "&pathnamup\SRC\FORTRAN\GKSDEMOS" directory are
demonstration programs.
They are described below.
.begnote $break
.note GERHND.FOR, GERLOG.FOR
:I1.GKS:I2.error handling and logging
:I1.error handling and logging:I2.GKS
:I1.GERHND.FOR
:I1.GERLOG.FOR
The FORTRAN source files "GERHND.FOR" and "GERLOG.FOR" contain error
handling and logging routines which can be used with WATCOM GKS.
These files are provided as a model for writing your own error handling
routines and are not required to run graphics applications.
Default error handling and logging subroutines are used if you do not
provide your own.
.note GKS1.FOR - GKS21.FOR
:I1.GKS:I2.GKSx.FOR
:I1.GKSx.FOR
These are example programs that are described in the "WATCOM GKS Graphics
Tutorial and Reference" manual.
.note GKSDEMO.FOR
:I1.GKS:I2.GKSDEMO.FOR
:I1.GKSDEMO.FOR
This is a GKS sample program that demonstrates some of the
capabilities of WATCOM GKS.
.note GKSHAT.FOR
:I1.GKS:I2.GKSHAT.FOR
:I1.GKSHAT.FOR
This is another GKS sample program that demonstrates some of the
capabilities of WATCOM GKS.
.note CUBEDEMO.FOR
:I1.GKS:I2.CUBEDEMO.FOR
:I1.CUBEDEMO.FOR
This file contains a rotating cube demonstration.
In addition to animation techniques, this program illustrates the
implementation of three-dimensional graphics on top of the
two-dimensional Graphical Kernel System.
.note PLOTDEMO.FOR
:I1.GKS:I2.PLOTDEMO.FOR
:I1.PLOTDEMO.FOR
This file contains a demonstration of the graph subroutines found in
"GRAPH.FOR".
It produces a number of interesting X-Y graphs.
.note GRAPH.FOR
This file contains the following subroutines:
.millust
GRINIT
GRAPH
GRPLOT
GRCLEAR
GRFINI
.emillust
.np
They can be used to plot simple graphs on an X-Y axis.
Using the GRAPH subroutine, minimum and maximum X-Y values, a plot
title and X-axis and Y-axis labels are specified.
The GRPLOT subroutine is used to plot a graph.
The program contained in "PLOTDEMO.FOR" demonstrates the graph
subroutines.
.note BLOCK.FOR, BOX.FOR, CIRCARC.FOR, CIRCLE.FOR COLOURMA.FOR, DOG.FOR, ELLARC.FOR, ELLIPSE.FOR LINE.FOR, PAINT.FOR, PICTURE.FOR, SLICE.FOR, TEXT.FOR
These files illustrate the use of the cover graphics subprograms.
They are described later in the section entitled "Example Programs".
.endnote
.note GKSCOVER <DIR>
The files in the "&pathnamup\SRC\FORTRAN\GKSCOVER" directory are the
source code to the WATCOM GKS graphics "cover" subprograms.
Their names are listed below.
.millust
BLOCK.FOR     BOX.FOR       CIRCLE.FOR
CIRC_ARC.FOR  CLEARSCR.FOR  COLOURMA.FOR
ELLIPSE.FOR   ELL_ARC.FOR   FINISH.FOR
GERHND.FOR    GETDOT.FOR    GETPIC.FOR
GKSDEFN.FOR   INIT.FOR      LINE.FOR
PAINT.FOR     PAINT_BO.FOR  PUTDOT.FOR
PUTPIC.FOR    PUTPIC_A.FOR  SLICE.FOR
TEXT.FOR
.emillust
.pc
These files have been compiled and placed in the "WGKSCVR" library.
.begnote $break
.note GKSDEFN.FOR
This file defines various GKS attributes and is included by the
subprograms in "&pathnamup\SRC\FORTRAN\GKSCOVER".
It should also be included by any program which uses these attributes.
.endnote
.endnote
.*
:H2.Creating Applications that Use the WATCOM GKS Library
.*
Let us use the demonstration program contained in "GKSDEMO.FOR" as an
example of how to compile, link and execute a graphics application.
This file is located in the "&pathnamup\SRC\FORTRAN\GKSDEMOS"
directory.
In our discussion, we are assuming that the &product software is
installed on the default drive.
If it is not then you must include the drive specification when
attempting to repeat this example.
We also assume that you have included "&pathnamup\BIN" and
"&pathnamup\BINB" in the
.ev PATH
environment string so that you need not specify a path when using the
&product software.
.np
:I1.GKS:I2.WGKS.LIB
:I1.WGKS.LIB
:I1.library files:I2.WGKS.LIB
The GKS library file "WGKS.LIB" consists of small subprograms that
issue requests to a memory-resident GKS to perform various tasks.
We will require this library whenever building an application that
is going to use GKS.
We can compile and link the application by entering commands similar
to the following:
:I1.GKS:I2.GKSDEMO.FOR
:I1.GKS:I2.example
.exam
C>set lib=&pathnam&libdir\dos
C>&wclcmd &pathnam\src\fortran\gksdemos\gksdemo wgks.lib
.eexam
.np
Before running the application, we must first start WATCOM GKS.
The executable code of WATCOM GKS has been placed into an
executable program (WGKS.EXE) which must be run before GKS can be
used.
To start GKS, we can enter the following command.
:I1.GKS:I2.starting
.millust
C>wgks
.emillust
.pc
The above command causes WATCOM GKS to load and remain resident in
memory.
.np
If you have a Hercules Graphics Adapter, you should also run the
"HERCBIOS.COM" program as follows:
.millust
C>hercbios
.emillust
.pc
This program supports the output of non-graphical text to the screen
when in a graphics mode using the Hercules Graphics Adapter.
.np
To run the application, we can enter the program's name.
.exam
C>gksdemo
.eexam
.np
When no more GKS applications will be run, the "HERCBIOS" program can
be removed from memory (if previously installed) by entering the
following command.
.millust
C>hercbios quit
.emillust
.pc
The "quit" option directs "HERCBIOS" to remove itself from memory.
.np
The WATCOM GKS memory-resident task may be removed from memory by
entering the following command.
:I1.GKS:I2.stopping
.millust
C>wgks quit
.emillust
.pc
The "quit" option directs WATCOM GKS to remove itself from memory.
.remark
If you load WGKS first and HERCBIOS second, you must unload them in the
opposite order (i.e., HERCBIOS then WGKS).
.eremark
.*
:H2.WATCOM GKS Graphics Cover Subprograms
.*
:I1.graphics GKS
:I1.GKS graphics
:I1.GKS cover subprograms
The library file "WGKSCVR.LIB" provides a collection of routines to
support drawing of graphic images with colour.
The subprograms in these libraries provide a simple, easy-to-use
interface to GKS.
The "LINE" subroutine, for example, takes 5 arguments- the
starting X and Y coordinates, the ending X and Y coordinates, and
the colour in which the line is to be drawn.
Among other things, the "LINE" subroutine calls the GKS "GSPLCI" and
"GPL" subroutines to draw the line in the requested colour.
The "LINE" subroutine is a somewhat more "friendly" interface to the
GKS routines.
.np
The following sections describe the cover subprograms and their use.
A number of example programs are also described.
They illustrate how the cover routines are used.
.*
:H2.Graphics Modes and Initialization
.*
:I1.GKS modes
:I1.GKS initialization
On the IBM PC, graphics can be drawn in a variety of modes,
depending on the hardware available.
Each of these devices can operate in one or more modes.
Each mode has a "resolution" (i.e., the number of dots it can display
both horizontally and vertically) and a number of colours which can be
displayed simultaneously on the screen (or page).
.np
:I1.INFO program
If you are not sure what kind of graphics adapter is present in your
computer system then you should run the "INFO" program that is
supplied with &product..
It will inform you of the type of graphics adapter present in your
system.
.np
To initialize the graphics system, a program must first call the
.id INIT
subroutine.
This routine takes an argument which describes the type of graphics
device and the desired mode.
The following table describes the available graphics modes.
The first column is the argument to the
.id INIT
subroutine and the remaining columns describe the hardware mode, the
resolution in terms of the number of horizontal and vertical dots, the
range of colour indices which can be specified in this mode, and the
corresponding actual colours.
The colour numbers are defined in a subsequent table
(see :FIGREF refid='gref5' page=yes.).
In the table below, "mono" means that the graphics adapter is
connected to a monochrome display.
In the "actual colours" column, "BG" means the current background
colour and "definable" means that the mapping of actual colours onto
indices is programmable.
:cbox ref='gref1'.
 Choice      Graphics         Resolution  Colour   Actual colours
      Hardware / Mode         indices   (see below)
 ====== ====================  ==========  =======  ==============
   1    CGA/PCjr/EGA mode 4    320x200     0..3    BG, 7, 6, 8
   2    CGA/PCjr/EGA mode 6    640x200     0..1    BG, 8
   3    IBM PCjr mode 8        160x200     0..15   definable
   4    IBM PCjr mode 9        320x200     0..15   definable
   5    IBM PCjr mode 10       640x200     0..3    definable
   6    EGA mode 13        320x200     0..15   definable
   7    EGA mode 14        640x200     0..15   definable
   8    EGA mode 15 (mono)     640x350     0..3    1, normal,
                           blink, bright
   9    EGA mode 16        640x350     0..3    definable
     (with extra memory)           0..15   definable
  10    Hercules (mono)        720x350     0..1    BG, 8
  11    IBM Graphics Printer   480x720     0..1    BG, 1
  12    VGA, MCGA mode 17      640x480     0..1    definable
  13    VGA mode 18        640x480     0..15   definable
  14    VGA, MCGA mode 19      320x200     0..255  definable
  15    GKS pixel array        720x720     0..1
  16    GKS metafile
:ecbox text='Graphics Selections'.
.begnote
.note Colours
BG - background,
1 - black,
6 - magenta,
7 - cyan,
8 - white.
.note EGA
All CGA modes are supported by the EGA.
.note VGA
Up to 256 colour indices are available.
The colour of each of the 256 colour registers of the VGA may be
defined from a selection of 262,144 different colours (64 shades
each of red, green, and blue).
The GKS routine
.id GSCR
.us (Set Colour Representation)
may be used to define the precise amount of red, green and blue
that is to be assigned to a particular colour index.
.np
All CGA, EGA and VGA modes are available on the PS/2 models 50,
60, 70 and 80.
.note MCGA
All CGA modes and only VGA modes 17 and 19 are available on the
PS/2 models 25 and 30 (i.e., the hardware does not support EGA
modes and VGA mode 18).
.note Pixel Array
The GKS pixel array (or virtual display) resolution of 720 by 720 dots
was arbitrarily chosen and may be altered by making the appropriate
modifications to the
.id INIT
subroutine.
The dimensions of a pixel array are bounded by the amount of available
memory on your PC.
When the pixel array device is closed, the resulting image is written
to a disk file called "GKS720.PXA" (this is the name chosen by the
.id INIT
subroutine.
.note Metafile
The name of the GKS metafile that is created is "GKSTEXT.MET" (this is
the name chosen by the
.id INIT
subroutine).
.endnote
.*
:H2.Graphics Modes and Colour
.*
:I1.GKS modes
:I1.GKS colour
Most of the routines which are described in this chapter permit

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -