home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
QGRAFX.ZIP
/
QGRAFX.DOC
< prev
next >
Wrap
Text File
|
1990-06-07
|
26KB
|
567 lines
QGRAFX DEMO - Version 2.0
Copyright 1990, Nybble Software
Joseph E. Cates & E. Gordon King, Jr.
──────────────────────────────────────────────────────────────────────────────
WHAT IS QGRAFX?
QGRAFX is a library of EGA/VGA graphics routines developed by Nybble
Software for use with Microsoft QuickBasic 4.0 or 4.5 to supplement
QuickBasic's limited graphics capabilities. The QGRAFX package consists
of the following:
1) Library of 35 Assembly Language Object Files Documented Below
2) Library of 10 QuickBasic Routines with Source Code
3) QGRAFX FONT EDITOR with Complete QuickBasic Source Code
4) QGRAFX DEMO With Complete QuickBasic Source Code
5) Sample QuickBasic Code For Producing Stroke Fonts
6) Image Converter to Capture Screen Images in QIMAGE Format with
Complete QuickBasic Source Code
7) Complete Data for Stroke Font Used in QGRAFX DEMO
8) Three Sample BitMap Fonts and the QGRAFX Demo Font
9) Complete Documentation
RUNNING THE QGRAFX DEMO:
A QGRAFX demo program is included to demonstrate many of the routines
described below. The entire demo program is written in standard Microsoft
QuickBasic 4.5 using the QGRAFX library, as an example of the power of the
routines. To run the QGRAFX demo, type QGRAFX on the command line. The
binary data file (BINARY.BIN) included in the package must be present in
the default directory.
The QGRAFX demo is designed to run in SCREEN 9 (640 x 350 x 16),
however to demonstrate the routines compatibility with other modes, the
demo may be ran in other QuickBasic screen modes by including the screen
command line option: QGRAFX /S=## where ## = QuickBasic mode number. The
only meaningful screen modes are 9, 10, 11, 12. Screen mode 8 can also be
used, although most of the screen will not be visible.
COMPATIBILITY:
The subroutines are compatible with the 640 x 350 EGA graphics modes
and the 640 x 480 VGA graphics modes. In general, the routines are NOT
compatible with 256 MCGA/VGA color modes or lower-resolution CGA emulation
modes. The routines have been tested on a number of brands of PC and PS/2
based EGA and VGA boards with no problems. A safe bet is that if the
demo runs without problems on a specific card/monitor combination, then all
the routines will run without trouble also.
ERROR CHECKING:
The QGRAFX routines only contain error checking for bad values that
would lead to certain errors. The error checking is limited for two
important reasons. First, error checking can be done almost as efficiently
in QuickBasic for most applications. Secondly, extensive error checking
always seems to ruin that one special feature you wanted. Therefore,
coordinates are generally left unchecked to allow writing across video
pages, writing off the bottom of the screen, wrapping images around the
screen, and other bad habits.
ORDERING INFORMATION:
A complete order form is available with the files in this package. If
that file is not available, the library can be obtained for $20 plus $2
postage and handling ($4 P&H on foreign orders please) from:
NYBBLE SOFTWARE
P.O. Box 7213
Tuscaloosa, AL 35486
Any questions or comments about the QGRAFX library and associated
programs can be directed to the above address or to jbaschab@ua1vm.bitnet.
Please include a self-addressed stamped envelope for any mailed questions.
SATISFACTION GUARANTEED:
If for ANY reason you are not completely satisfied with the QGRAFX
package, simply return a statement saying ALL your copies of the QGRAFX
package have been permanently destroyed, and your purchase price will be
gladly refunded.
ROUTINE LIST:
Information on each of the routines included in the QGRAFX library is
listed below. The first line gives the complete call format for the
routine, followed by a brief explanation of the purpose, and finally a
description of the passed arguments.
Note: This is not the documentation included with the actual library, which
is more thorough. Without delving too deeply into details, the infor-
mation below should give a feel for the QGRAFX library routines and
their potential applications.
┌───────────────────────────────────────────────────────────────────────────┐
│ TEXT AND CHARACTER ROUTINES │
└───────────────────────────────────────────────────────────────────────────┘
QCHAR(CharCode%, XStart%, YStart%, FgdClr%, BgdClr%)
Assembly Language routine optimized to display a single character
in EGA/VGA graphics modes at a pixel address in any combination of
fore- and background colors.
CharCode% = ASC code of character
XStart% = X pixel address of upper-left corner of character
YStart% = Y pixel address of upper-left corner of character
FgdClr% = Character foreground color
BgdClr% = Character background color
QCHAR2(CharCode%, XStart%, YStart%, FgdClr%, BgdClr%, Mode%, VideoSeg%)
Assembly Language routine optimized to display a single character
in EGA/VGA graphics modes at a pixel address in any combination of
fore- and background colors with optional mode and video segment.
CharCode% = ASC code of character
XStart% = X pixel address of upper-left corner of character
YStart% = Y pixel address of upper-left corner of character
FgdClr% = Character foreground color (greater 15, color not updated)
BgdClr% = Character background color (greater 15, color not updated)
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
VideoSeg% = Video buffer start, to allow use on multiple pages
QCHARPAT(DataSeg%, DataPtr%, XStart%, YStart%, FgdClr%, BgdClr%, CharHeight%)
Assembly Language routine to display a character from the bitmap pattern
stored at the passed address at a pixel address in any combination of fore-
and background colors. Handy for font editing programs.
DataSeg% = Segment for start of pattern data
DataPtr% = Offset for start of pattern data
XStart% = X pixel address of upper-left corner of start of string
YStart% = Y pixel address of upper-left corner of start of string
FgdClr% = String foreground color (greater 15, color not updated)
BgdClr% = String background color (greater 15, color not updated)
CharHeight% = Character height in pixel rows
QTEXT(Text$, XStart%, YStart%, FgdClr%, BgdClr%)
Assembly Language routine to display a string in EGA/VGA graphics
modes at a pixel address in any combination of fore- and background
colors.
Text$ = String to display
XStart% = X pixel address of upper-left corner of start of string
YStart% = Y pixel address of upper-left corner of start of string
FgdClr% = String foreground color
BgdClr% = String background color
QTEXT2(Text$, StrLen%, XStart%, YStart%, FgdClr%, BgdClr%, Mode%,
Special%, VideoSeg%)
Assembly Language routine to display a string in EGA/VGA graphics
modes at a pixel address in any combination of fore- and background
colors.
Text$ = String to display
StrLen% = Length of string to display (0 = full length)
XStart% = X pixel address of upper-left corner of start of string
YStart% = Y pixel address of upper-left corner of start of string
FgdClr% = String foreground color (greater 15, color not updated)
BgdClr% = String background color (greater 15, color not updated)
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
Special% = Bit 1 --> Display String in Lower Case (0=No 1=Yes)
Bit 2 --> Display String in Upper Case (0=No 1=Yes)
Bit 3 --> Trim trailing spaces in string (0=No 1=Yes)
Bit 4 --> Trim leading spaces in string (0=No 1=Yes)
VideoSeg% = Video buffer start, to allow use on multiple pages
QTEXTHGT(Text$, XStart%, YStart%, FgdClr%, BgdClr%, CharHeight%)
Assembly Language routine to display a string in EGA/VGA graphics
modes at a pixel address in any combination of fore- and background
colors in specified system font height (8, 14, or 16).
Text$ = String to display
XStart% = X pixel address of upper-left corner of start of string
YStart% = Y pixel address of upper-left corner of start of string
FgdClr% = String foreground color (greater 15, color not updated)
BgdClr% = String background color (greater 15, color not updated)
CharHeight% = Character system font height
QTEXTRC(Text$, Row%, Column%, FgdClr%, BgdClr%)
Assembly Language routine to display a string in EGA/VGA graphics
modes at a specified row and column in any combination of fore- and
background colors.
Text$ = String to display
Row% = Row address of start of string
Column% = Column address of start of string
FgdClr% = String foreground color (greater 15, color not updated)
BgdClr% = String background color (greater 15, color not updated)
QTEXTROT(Text$, StrLen%, XStart%, YStart%, FgdClr%, BgdClr%, NumRot%,
Mode%, VideoSeg%)
Assembly Language routine to display a string in EGA/VGA graphics
modes at a pixel address in any combination of fore- and background
colors with option to rotate to any multiple of 90 degrees.
Text$ = String to display
StrLen% = Length of string to display (0 = full length)
XStart% = X pixel address of upper-left corner of start of string
YStart% = Y pixel address of upper-left corner of start of string
FgdClr% = String foreground color (greater 15, color not updated)
BgdClr% = String background color (greater 15, color not updated)
NumRot% = Number of 90 degree rotations (0 = 0 deg, 1 = 90 deg, etc.)
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
VideoSeg% = Video buffer start, to allow use on multiple pages
SETHGT(CharHeight%)
Assembly Language routine to change default system font height. Once
the default is changes, QuickBasic PRINT commands and the QGRAFX
commands will both use the new font.
CharHeight% = Character set height (8, 14, or 16)
┌───────────────────────────────────────────────────────────────────────────┐
│ PIXEL, LINE, AND BOX ROUTINES │
└───────────────────────────────────────────────────────────────────────────┘
QBOX(x1%, y1%, x2%, y2%, FgdClr%, Fill%)
Assembly Language routine to draw a box in EGA/VGA graphics modes
in specified color.
x1% = X pixel address of upper-left corner of box
y1% = Y pixel address of upper-left corner of box
x2% = X pixel address of lower-right corner of box
y2% = Y pixel address of lower-right corner of box
FgdClr% = Box color
Fill% = Filled box flag (0 = No Fill, 1 = Fill)
QLINE(x1%, y1%, x2%, y2%, FgdClr%)
Assembly Language routine to draw a line in EGA/VGA graphics modes
in specified color.
x1% = X pixel address of start of line
y1% = Y pixel address of start of line
x2% = X pixel address of end of line
y2% = Y pixel address of end of line
FgdClr% = Line color
QLINE2(x1%, y1%, x2%, y2%, LineColor%, Mode%, VideoSeg%)
Assembly Language routine to draw a line in EGA/VGA graphics modes
in specified color in any display mode.
x1% = X pixel address of start of line
y1% = Y pixel address of start of line
x2% = X pixel address of end of line
y2% = Y pixel address of end of line
LineColor% = Line color
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
VideoSeg% = Video buffer start, to allow use on multiple pages
QLINESTP(x1%, y1%, xstep%, ystep%, LineColor%, Mode%, VideoSeg%)
Assembly Language routine to draw a line in EGA/VGA graphics modes
in specified color in any display mode.
x1% = X pixel address of start of line
y1% = Y pixel address of start of line
xstep% = X pixel step
ystep% = Y pixel step
LineColor% = Line color
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
VideoSeg% = Video buffer start, to allow use on multiple pages
QPSET(x1%, y1%, PixelColor%, Mode%)
Assembly Language routine to set a single pixel in EGA/VGA graphics
modes to specified color in any display mode.
x1% = X pixel address
y1% = Y pixel address
PixelColor% = Line color
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
┌───────────────────────────────────────────────────────────────────────────┐
│ IMAGE HANDLING ROUTINES │
└───────────────────────────────────────────────────────────────────────────┘
QGET(x1%, y1%, x2%, y2%, ArraySeg%, ArrayPtr%)
Assembly Language routine to GET an image in EGA/VGA graphics modes
and store in an array in QuickBasic image format. Exactly duplicates
QuickBasic's GET for EGA/VGA modes about 20 - 30% faster.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
x2% = X pixel address of bottom-right corner of image
y2% = Y pixel address of bottom-right corner of image
ArraySeg% = Segment for start of storage buffer
ArrayPtr% = Offset for start of storage buffer
QGET2(x1%, y1%, x2%, y2%, ArraySeg%, ArrayPtr%, BitPlaneMask%, VideoSeg%)
Assembly Language routine to GET an image in EGA/VGA graphics modes
and store in an array in QuickBasic image format with option to only
get specified bit planes.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
x2% = X pixel address of bottom-right corner of image
y2% = Y pixel address of bottom-right corner of image
ArraySeg% = Segment for start of storage buffer
ArrayPtr% = Offset for start of storage buffer
BitPlaneMask% = Mask for bit planes to retrieve, (can retrieve any
combination of bit planes)
VideoSeg% = Video buffer start, to allow use on multiple pages
QPUT(x1%, y1%, ArraySeg%, ArrayPtr%, Mode%)
Assembly Language routine to PUT an image in EGA/VGA graphics modes
on the screen. Exactly duplicates QuickBasic's PUT in EGA/VGA modes
about 20 - 30% faster.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
ArraySeg% = Segment for start of storage buffer
ArrayPtr% = Offset for start of storage buffer
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
QPUT2(x1%, y1%, ArraySeg%, ArrayPtr%, Mode%, BitPlaneMask%, VideoSeg%)
Assembly Language routine to PUT an image in EGA/VGA graphics modes
on the screen with option to put image in specified bit planes.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
ArraySeg% = Segment for start of storage buffer
ArrayPtr% = Offset for start of storage buffer
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
BitPlaneMask% = Mask for bit planes to retrieve, (can retrieve any
combination of bit planes)
VideoSeg% = Video buffer start, to allow use on multiple pages
QPUTPART(x1%, y1%, xpart%, ypart%, ArraySeg%, ArrayPtr%, Mode%)
Assembly Language routine to PUT an image in EGA/VGA graphics modes
on the screen with option to only place a portion of the image.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
xpart% = Horizontal width of image to actually place
ypart% = Height in pixel rows of image to actually place
ArraySeg% = Segment for start of storage buffer
ArrayPtr% = Offset for start of storage buffer
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
CREATEIMAGE(x1%, y1%, x2%, y2%, ReturnCode%)
QuickBasic routine to store a screen image in EGA/VGA graphics modes
in the QIMAGE format. The QIMAGE format saves each image as a series
of horizontal lines of varying length and color.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
x2% = X pixel address of bottom-right corner of image
y2% = Y pixel address of bottom-right corner of image
ReturnCode% = Return code for any errors converting image
QIMAGE(ArraySeg%, ArrayPtr%, Mode%, VideoSeg%)
Assembly Language routine to display an image stored in horizontal line
format at the x, y pixel address stored in the image array in EGA/VGA
graphics modes.
ArraySeg% = Segment for start of storage buffer
ArrayPtr% = Offset for start of storage buffer
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
VideoSeg% = Video buffer start, to allow use on multiple pages
QIMAGE2(x1%, y1%, Height%, ArraySeg%, ArrayPtr%, Mode%, VideoSeg%)
Assembly Language routine to display an image stored in horizontal line
format at specified x, y pixel address in EGA/VGA graphics modes.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
ArraySeg% = Segment for start of storage buffer
ArrayPtr% = Offset for start of storage buffer
Mode% = Display mode (0 = SET, 1 = AND, 2 = OR, 3 = XOR)
VideoSeg% = Video buffer start, to allow use on multiple pages
┌───────────────────────────────────────────────────────────────────────────┐
│ COLOR CHANGING ROUTINES │
└───────────────────────────────────────────────────────────────────────────┘
QCHANGE1(x1%, y1%, x2%, y2%, NewColor%, BitPlane%)
Assembly Language routine to change all colors in a specified rectangular
region which are ON in a specified bit plane to a new color in EGA/VGA
graphics modes.
x1% = X pixel address of upper-left corner of region
y1% = Y pixel address of upper-left corner of region
x2% = X pixel address of bottom-right corner of region
y2% = Y pixel address of bottom-right corner of region
NewColor% = New color
BitPlane% = Bit plane containing pixels to change
QCHANGE2(x1%, y1%, x2%, y2%, NewColor%, OldColor%)
Assembly Language routine to change all old color pixels in a specified
rectangular region which are ON in a specified bit plane to a new color
in EGA/VGA graphics modes.
x1% = X pixel address of upper-left corner of region
y1% = Y pixel address of upper-left corner of region
x2% = X pixel address of bottom-right corner of region
y2% = Y pixel address of bottom-right corner of region
NewColor% = New color
OldColor% = Old color
┌───────────────────────────────────────────────────────────────────────────┐
│ FONT ROUTINES │
└───────────────────────────────────────────────────────────────────────────┘
DISPCHAR(Char%, Row%, Column%, FgdClr%, BgdClr%, Array%())
QuickBasic routine to display a single character from the bitmap font
stored in the given array at row and column in the given colors without
installing the font.
Char% = ASC code of character to display
Row% = Screen row to display string
Column% = Screen column to display string
FgdClr% = Foreground color of character
BgdClr% = Background color of character
Array%() = Array containing bitmap font data
INSTALLFONT(Array%())
QuickBasic routine to install the bitmap font stored in the given
array as the current graphics font in EGA/VGA graphics modes.
Array%() = Array containing font
LOADFONT(Array%(), filename$)
QuickBasic routine to load the bitmap font from disk and place in the
given array.
Array%() = Array to contain font data
filename$ = Name of file from which to load font data
SAVEFONT(Array%(), filename$)
QuickBasic routine to save the bitmap font stored in the given array
to a disk file.
Array%() = Array containing font
filename$ = Name of file to save font data
┌───────────────────────────────────────────────────────────────────────────┐
│ MISCELLANEOUS ROUTINES │
└───────────────────────────────────────────────────────────────────────────┘
BLINK(BlinkFlag%)
Assembly Language routine to set the intensity bit plane as either
intensity or blink. Enables blinking of all intensity colors.
BlinkFlag% = Blank Flag (0 = Intensity, 1 = Blink)
GETSIZE%(x1%, y1%, x2%, y2%, ScreenMode%, NumPlanes%)
QuickBasic function to return the size in bytes of the array required
to hold GET/PUT image data in EGA/VGA modes for specified number of
bit planes.
x1% = X pixel address of upper-left corner of image
y1% = Y pixel address of upper-left corner of image
x2% = X pixel address of bottom-right corner of image
y2% = Y pixel address of bottom-right corner of image
ScreenMode% = QuickBasic screen mode
NumPlanes% = Number of bit planes to store (0 for all)
QPALETTE(Attribute%, Register%)
Assembly Language routine to assign a specified attribute (color) to
specified color register. (Use to bypass PALETTE bug in some QuickBasic
screen modes.)
Attribute% = Attribute (color) to point to register
Register% = Register number to assign to color
QRDPAL%(Attribute%)
Assembly Language function to return current register associated with the
specified color attribute.
Attribute% = Attribute (color) value
QRDPIXEL%(x%, y%)
Assembly Language function to return color of specified pixel.
x% = X pixel address
y% = Y pixel address
QRDCHAR%(row%, col%)
Assembly Language function to return the ASC code of the character at the
specified screen row and column in graphics modes. The character is found
by matching the pixel values with stored graphics character definitions.
row% = Screen row from which to return character
col% = Screen column from which to return character
QSCROLL(row1%, col1%, row2%, col2%, NumLines%, Attribute%)
Assembly Language routine to scroll a specified region of the screen
in either text or graphics modes.
row1% = Row of upper-left corner of window
col1% = Column of upper-left corner of window
row2% = Row of lower-right corner of window
col2% = Column of lower-right corner of window
NumLines% = Number lines to scroll (+ scroll up - scroll down)
Attribute% = Color attribute of added blank lines
QSEARCH%(x1%, y1%, x2%, y2%, Color%)
Assembly Language function to return a flag for whether the color appears
in a specified rectangular region of the screen.
x1% = X pixel address of upper-left corner of region
y1% = Y pixel address of upper-left corner of region
x2% = X pixel address of bottom-right corner of region
y2% = Y pixel address of bottom-right corner of region
Color% = Color for search
QSETDAC(DACReg%, Blue%, Green%, Red%)
Assembly Language routine to assign blue, green, red color value to a
VGA/MCGA DAC register. A color can then be pointed to the DAC register
using QPALETTE. (Use to bypass PALETTE bug in some QuickBasic screen
modes.)
DACReg% = Register number to assign color
Blue% = Blue component (0 - 63)
Green% = Green component (0 - 63)
Red% = Red component (0 - 63)
REFRESH(RefreshFlag%)
Assembly Language Routine to Disable/Enable refreshing of EGA/VGA
screen in graphics modes. Screen remains black while refresh is
disabled.
RefreshFlag% = Blank Flag (0 = Disable, 1 = Enable)