graphov.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 732 行 · 第 1/2 页
GML
732 行
.np
.ix 'graphics library'
The &company &lang Graphics Library consists of a large number of
&routines that provide graphical image support under DOS and QNX.
This chapter provides an overview of this support.
The following topics are discussed.
.begbull
.bull
Graphics &rroutines
:CMT. :HDREF refid='grov1'.
.bull
Graphics Adapters
:CMT. :HDREF refid='grov2'.
.bull
Classes of Graphics &rroutines
:CMT. :HDREF refid='grov3'.
.autopoint
.point
Environment &rroutines
:CMT. :HDREF refid='grov4'.
.point
Coordinate System &rroutines
:CMT. :HDREF refid='grov5'.
.point
Attribute &rroutines
:CMT. :HDREF refid='grov6'.
.point
Drawing &rroutines
:CMT. :HDREF refid='grov7'.
.point
Text &rroutines
:CMT. :HDREF refid='grov8'.
.point
Graphics Text &rroutines
:CMT. :HDREF refid='grov9'.
.point
Image Manipulation &rroutines
:CMT. :HDREF refid='grov10'.
.point
Font Manipulation &rroutines
:CMT. :HDREF refid='grov11'.
.point
Presentation Graphics &rroutines
:CMT. :HDREF refid='grov12'.
.illust begin
Display &rroutines
:CMT. :HDREF refid='grov13'.
Analyze &rroutines
:CMT. :HDREF refid='grov14'.
Utility &rroutines
:CMT. :HDREF refid='grov15'.
.illust end
.endpoint
.bull
.if '&lang' eq 'C' .do begin
Graphics Header Files
:CMT. :HDREF refid='grov16'.
.do end
.el .do begin
Include Files
:CMT. :HDREF refid='grov16'.
.do end
.endbull
.*
.section *refid=grov1 Graphics &rroutines
.***************************
.np
.ix 'graphics &routines'
Graphics &routines are used to display graphical images such as lines
and circles upon the computer screen.
&rroutines are also provided for displaying text along with the
graphics output.
.*
.section *refid=grov2 Graphics Adapters
.*************************
.np
.ix 'graphics adapters'
Support is provided for both color and monochrome screens which are
connected to the computer using any of the following graphics adapters:
.begbull
.bull
IBM Monochrome Display/Printer Adapter (MDPA)
.bull
IBM Color Graphics Adapter (CGA)
.bull
IBM Enhanced Graphics Adapter (EGA)
.bull
IBM Multi-Color Graphics Array (MCGA)
.bull
IBM Video Graphics Array (VGA)
.bull
Hercules Monochrome Adapter
.bull
SuperVGA adapters (SVGA) supplied by various manufacturers
.endbull
.*
.section *refid=grov3 Classes of Graphics &rroutines
.**************************************
.np
.ix 'classes of &routines'
The &routines in the &company &lang Graphics Library can be organized into
a number of classes:
.begnote
.note Environment &rroutines
.sk 0
These &routines deal with the hardware environment.
.note Coordinate System &rroutines
.sk 0
These &routines deal with coordinate systems and mapping coordinates
from one system to another.
.note Attribute &rroutines
.sk 0
These &routines control the display of graphical images.
.note Drawing &rroutines
.sk 0
These &routines display graphical images such as lines and ellipses.
.note Text &rroutines
.sk 0
These &routines deal with displaying text in both graphics and text modes.
.note Graphics Text &rroutines
.sk 0
These &routines deal with displaying graphics text.
.note Image Manipulation &rroutines
.sk 0
These &routines store and retrieve screen images.
.note Font Manipulation &rroutines
.sk 0
These &routines deal with displaying font based text.
.note Presentation Graphics &rroutines
.sk 0
These &routines deal with displaying presentation graphics
elements such as bar charts and pie charts.
.endnote
.np
The following subsections describe these &routine classes in more detail.
Each &routine in the class is noted with a brief description of its
purpose.
.*
.beglevel
.*
.section *refid=grov4 Environment &rroutines
.******************************
.np
These &routines deal with the hardware environment.
The
.kw _getvideoconfig
&routine returns information about the current video mode and the
hardware configuration.
The
.kw _setvideomode
&routine selects a new video mode.
.np
.ix 'graphic page'
Some video modes support multiple pages of screen memory.
The visual page (the one displayed on the screen) may be different than
the active page (the one to which objects are being written).
.keep begin
.np
.fdbeg
.fd _getactivepage
get the number of the current active graphics page
.fd _getvideoconfig
get information about the graphics configuration
.fd _getvisualpage
get the number of the current visual graphics page
.fd _grstatus
get the status of the most recently called graphics library &routine
.fd _setactivepage
set the active graphics page (the page to which graphics objects are drawn)
.fd _settextrows
set the number of rows of text displayed on the screen
.fd _setvideomode
select the video mode to be used
.fd _setvideomoderows
select the video mode and the number of text rows to be used
.fd _setvisualpage
set the visual graphics page (the page displayed on the screen)
.fdend
.keep end
.*
.section *refid=grov5 Coordinate System &rroutines
.************************************
.np
These &routines deal with coordinate systems and mapping coordinates
from one system to another.
The &company &lang Graphics Library supports three coordinate systems:
.ix 'coordinate systems'
.autonote
.note
Physical coordinates
.note
View coordinates
.note
Window coordinates
.endnote
.np
.ix 'physical coordinates'
Physical coordinates match the physical dimensions of the screen.
The physical origin, denoted (0,0), is located at the
top left corner of the screen.
A pixel to the right of the origin has a positive x-coordinate and a
pixel below the origin will have a positive y-coordinate.
The x- and y-coordinates will never be negative values.
:cmt..sk
:cmt..millust begin
:cmt. increasing
:cmt. (0,0) x-values
:cmt..bx on 13 42
:cmt.
:cmt.
:cmt.
:cmt.increasing
:cmt. y-values
:cmt.
:cmt.
:cmt.
:cmt..bx off
:cmt..millust end
.np
.ix 'view coordinates'
The view coordinate system can be defined upon the physical coordinate
system by moving the origin from the top left corner of the screen
to any physical coordinate
.gfuncref setvieworg .
In the view coordinate system, negative x- and y-coordinates are allowed.
The scale of the view and physical coordinate systems is identical (both are
in terms of pixels).
.np
.ix 'window coordinates'
The window coordinate system is defined in terms of a range of
user-specified values
.gfuncref setwindow .
These values are scaled to map onto the physical coordinates of the screen.
This allows for consistent pictures regardless of the
resolution (number of pixels) of the screen.
.keep begin
.np
.fdbeg
.fd _getcliprgn
get the boundary of the current clipping region
.fd _getphyscoord
get the physical coordinates of a point in view coordinates
.fd _getviewcoord
get the view coordinates of a point in physical coordinates
.fd _getviewcoord_w
get the view coordinates of a point in window coordinates
.fd _getviewcoord_wxy
get the view coordinates of a point in window coordinates
.fd _getwindowcoord
get the window coordinates of a point in view coordinates
.fd _setcliprgn
set the boundary of the clipping region
.fd _setvieworg
set the position to be used as the origin of the view coordinate system
.fd _setviewport
set the boundary of the clipping region
and the origin of the view coordinate system
.fd _setwindow
define the boundary of the window coordinate system
.fdend
.keep end
.*
.section *refid=grov6 Attribute &rroutines
.****************************
.np
These &routines control the display of graphical images such as
lines and circles.
Lines and figures are drawn using the current color
.gfuncref setcolor ,
the current line style
.gfuncref setlinestyle ,
the current fill mask
.gfuncref setfillmask ,
and the current plotting action
.gfuncref setplotaction .
.keep begin
.np
.fdbeg
.fd _getarcinfo
get the endpoints of the most recently drawn arc
.fd _getbkcolor
get the background color
.fd _getcolor
get the current color
.fd _getfillmask
get the current fill mask
.fd _getlinestyle
get the current line style
.fd _getplotaction
get the current plotting action
.fd _remapallpalette
assign colors for all pixel values
.fd _remappalette
assign color for one pixel value
.fd _selectpalette
select a palette
.fd _setbkcolor
set the background color
.fd _setcolor
set the current color
.fd _setfillmask
set the current fill mask
.fd _setlinestyle
set the current line style
.fd _setplotaction
set the current plotting action
.fdend
.keep end
.*
.section *refid=grov7 Drawing &rroutines
.**************************
.np
These &routines display graphical images such as lines and ellipses.
&rroutines exist to draw straight lines
.gfuncsref lineto ,
rectangles
.gfuncsref rectangle ,
polygons
.gfuncsref polygon ,
ellipses
.gfuncsref ellipse ,
elliptical arcs
.gfuncsref arc
and pie-shaped wedges from ellipses
.gfuncsref pie .
.np
These figures are drawn using the attributes described in the previous
section.
The &routines ending with
.id _w
or
.id _wxy
use the window coordinate system; the others use the view coordinate system.
.keep begin
.np
.fdbeg
.fd _arc
draw an arc
.fd _arc_w
draw an arc using window coordinates
.fd _arc_wxy
draw an arc using window coordinates
.fd _clearscreen
clear the screen and fill with the background color
.fd _ellipse
draw an ellipse
.fd _ellipse_w
draw an ellipse using window coordinates
.fd _ellipse_wxy
draw an ellipse using window coordinates
.fd _floodfill
fill an area of the screen with the current color
.fd _floodfill_w
fill an area of the screen in window coordinates with the current color
.fd _getcurrentposition
get the coordinates of the current output position
.fd _getcurrentposition_w
get the window coordinates of the current output position
.fd _getpixel
get the color of the pixel at the specified position
.fd _getpixel_w
get the color of the pixel at the specified position in window coordinates
.fd _lineto
draw a line from the current position to a specified position
.fd _lineto_w
draw a line from the current position to a specified position in window coordinates
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?