Dec 122017
 
Graphics tool for use with Borland's Turbo languages.
File DRAWFILL.ZIP from The Programmer’s Corner in
Category Miscellaneous Language Source Code
Graphics tool for use with Borland’s Turbo languages.
File Name File Size Zip Size Zip Type
ATT.BGI 6029 4173 deflated
CGA.BGI 6029 4176 deflated
DRAWFILL.DOC 12839 4299 deflated
DRAWFILL.EXE 28384 16687 deflated
EGAVGA.BGI 5139 3726 deflated
HERC.BGI 5933 4176 deflated
LITT.CHR 2126 950 deflated
PC3270.BGI 5837 4101 deflated

Download File DRAWFILL.ZIP Here

Contents of the DRAWFILL.DOC file






**************************************
* *
* D R A W F I L L *
* *
* version 1.0 *
* *
* (c) 1988 PowerTown Programmers *
* *
**************************************



DrawFill is a programming tool to help design graphics in Turbo Basic, Turbo C,
Turbo Pascal, or Turbo Prolog.



FILL PATTERNS

Borland's high-level languages all implement the Borland Graphics Interface
(BGI), which permits easy coding of professional-quality graphics to run on a
wide variety of screen types. The BGI's routines and data structures may have
slightly different names in the different Turbo languages, but the machine code
is all the same.

An important element of the BGI is the 'fill pattern.' A fill pattern is a
pattern eight pixels wide and eight pixels high, which is repeated like a
wallpaper pattern to fill part of the screen. Fill patterns make any graphical
output more lively, and they are virtually essential in monochrome graphics to
substitute for colors. If your program doesn't use fill patterns, it doesn't
fully use the BGI.

The BGI contains the following procedures that paint fill patterns on the
screen:

Bar Fills a rectangular area with the current fill
style and fill color.

Bar3D Draws a three-dimensional bar and fills its face
with the current fill style and fill color.

FillPoly Draws a polygon and fills it with the current
fill style and fill color.

FloodFill Fills any bounded region with the current fill
style and fill color.

By default, the fill style is solid and the fill color is the maximum color in
the current palette. The fill pattern can be set by calling either of the BGI's
following two procedures:

SetFillStyle Sets a pre-defined fill pattern (see manual).

SetFillPattern Sets a new user-defined fill pattern.

SetFillPattern defines a new fill pattern by passing the pattern definition and
the color. The pattern is defined in an array of 8 bytes. Each byte in the
array represents a row of pixels. The bits in a byte represents the eight
pixels in the byte's row. The most significant bit (value 128) is the left-most
pixel, and the least significant bit (value 1) is the right-most pixel. Each
byte in the FillPatternType is the sum of the bit-values of the pixels lit in
that byte's row.

For example, a fill pattern defined by (0,0,0,0,0,0,0,0) does not light any
pixels. A fill pattern of (255,255,255,255,255,255,255,255) lights all pixels.
(3,3,3,3,3,3,3,3) draws vertical lines two pixels (3=2+1) thick.
(255,0,0,0,0,0,0,0) draws horizontal lines one pixel thick.

SetFillPattern allows the creation of fill patterns that are much more
interesting than the straight lines just given as examples. Unfortunately, more
interesting patterns are more difficult to create. Sketching on graph paper and
calculating bit values is a tedious, error-prone task.



USING DRAWFILL

DrawFill allows you to concentrate on creativity instead of bit values. Just
move a cursor around an eight-by-eight grid, toggling pixels on or off as you
go. The pattern you are creating, and its changing values, are displayed
simultaneously next to the grid. You can scroll the whole pattern, invert it,
or change its colors until you see just what you want for your own program. The
values you need will all be on the screen, ready to copy into your code.

The syntax for running DrawFill is as follows:

DRAWFILL [D=] [M=] [P=]
Case is irrelevant, as is the order of any
parameters, which are optional. Parameters are
separated by a space or a tab.

By default, DrawFill automatically initializes the driver and mode that can
provide the highest-quality graphics output on the user's system. The
D= and M= parameters override the defaults. (N.b., D=8 is
necessary to initialize the AT&T 400-line driver, which cannot be detected
automatically.) For example:

drawfill d=8 m=3
Initializes ATT400 driver in 320x200 mode with
cyan, magenta, lightgray palette.

DRAWFILL M=0
Initializes default driver in mode 0, which is
usually the lowest resolution but sometimes
(e.g., on the CGA) has colors lacking in the
highest-resolution mode.

If the M= parameter specifies an invalid graphics mode, a valid mode will
automatically be initialized. However, if the D= parameter specifies an
invalid driver, the error may not be detectable and the screen may go blank. If
so, just press Esc to escape back to the DOS prompt, and try again.

DrawFill requires the appropriate .BGI file for the driver to be initialized,
and the LITT.CHR font file. By default, if the .BGI file is not found in the
default directory or on a DOS path, the program will terminate with an error
message. If the LITT.CHR file is not found, the program will run using only the
default font, which will make only a cosmetic difference.

A path to the .BGI and LITT.CHR files may be specified on the DrawFill command
line with the P= parameter. For example:

DRAWFILL P=C:\TP\TPGRAPH
Looks in the TPGRAPH subdirectory of the TP
directory on drive C.

drawfill p=.. m=2
Looks in the parent directory above the current
subdirectory, and initializes graphics mode 2.

When DrawFill starts, a command menu appear at the bottom of the screen. The
command menu lists all the available command keys, the current state of all
toggle switches, and the current graphics driver and graphics mode. The command
keys are simple and intuitive:

Move the circular cursor from pixel to pixel on
the drawing grid, when Scroll Lock is OFF. When
Scroll Lock is ON, the arrow keys scroll the
whole pattern through the drawing grid.

Home, End Move the cursor to the left-most and right-most
columns, respectively.

PgUp, PgDn Move the cursor to the top-most and bottom-most
rows, respectively.

Toggles the current pixel on or off.

Ctrl-Home Erases the current fill pattern and returns the
cursor to the top-left pixel.

Esc Terminates the program.

Scroll Lock When ON, allows the user to scroll the fill
pattern up, down, left, or right, using the
arrow keys.

H Toggles hexadecimal mode or decimal mode for
representing the numerical values of the fill
pattern. Hexadecimal values are preceded by a
dollar sign ($), as in Turbo Pascal.

W Toggles wrap mode for cursor. When ON, the
cursor will wrap around the grid. When OFF, the
cursor will stop at the grid's edge.

F Toggles the color of the fill pattern.

G Toggles the color of the drawing grid and
command menu.

B Toggles the background color of the screen.

I Inverts the fill pattern, so that pixels which
were lit are turned off and pixels which were
off are turned on.

When you've created the fill pattern you want, you can copy its values, and the
fill pattern's color, into your program's call to SetFillPattern. If necessary,
you can also set the graphics driver, graphics mode, and background color in
your program to duplicate the fill pattern you have drawn with DrawFill.



DISCLAIMER OF WARRANTY

DrawFill has been written with care, and PowerTown Programmers will make an
honest effort to exterminate any bug reported by a registered user. Beyond
that, however, PowerTown Programmers specifically disclaims all other
warranties, expressed or implied, including but not limited to implied
warranties of merchantability or fitness for any particular purpose, with
respect to the software and its documentation. In no event shall PowerTown
Programmers be liable for any loss of profit or any other commercial damage, nor
for any special, incidental, consequential or other damages. We do not know of
any risk in using DrawFill; but if there is a risk, the user bears it.



DISTRIBUTION AND REGISTRATION

DrawFill is protected by United States copyright law and international treaty
provisions. It is distributed as shareware, but it is not in the public domain.

You may distribute DrawFill and this documentation freely, provided that you
distribute together all the files you received together, and that they not be
altered in any way. No distributor may charge for this program or documentation
without the prior written consent of PowerTown Programmers, except that
distributors may charge a nominal fee (no more than $5) to cover the cost of
distribution.

You need not pay anything to try DrawFill. However, if you keep DrawFill, i.e.,
use it to help develop more than one program, you must register as a DrawFill
user with PowerTown Programmers.

You can register by sending your name and address, together with the
registration fee of $5, to PowerTown Programmers at the address below.
Registration entitles you to free support and notice of additonal PowerTown
Programmers products.



SOURCE CODE

The source code for DrawFill is available for $10. It comprises 700 lines of
documented Turbo Pascal, including two units, GShell and Strings, which are
ready to compile and use in your own Turbo Pascal programs.

GShell simplifies graphics initialization and termination. You no longer have
to declare variables and assign a device code just to initialize graphics; the
GOpen procedure initializes graphics without any parameters. The device, mode,
and error codes, along with the graphics path, can still be read or written by
your program. The graphics system automatically shuts down upon program
termination, or you can close it from the program by calling GClose. GShell
allows either your program or the user's command-line parameters to override the
graphics system's defaults for the graphics driver, graphics mode, and graphics
file path.

Strings contains some unoriginal but useful string- and character-handling
routines, of which several are written in inline machine language (fully
commented) for ultra-quick execution.

To obtain the DrawFill source code, including GShell and Strings, please add $10
to your registration fee. If you want a 3-1/2" diskette, please add $3 more.

PowerTown source code is not shareware and may not be distributed except by
PowerTown Programmers.



**********************************************************************
* *
* Registration, free support, PowerTown bulletins: $5 *
* DrawFill source code, including GShell and Strings units: $10 *
* 3-1/2" diskette: $3 *
* *
* PowerTown Programmers *
* 2922 28th Street, N.W. *
* Washington, D.C. 20008 *
* *
**********************************************************************



DrawFill is a trademark of PowerTown Programmers.
Turbo Basic, Turbo C, Turbo Pascal, and Turbo Prolog are trademarks or
registered trademarks of Borland International, Inc.


 December 12, 2017  Add comments

Leave a Reply