home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
336_01
/
egapal.doc
< prev
next >
Wrap
Text File
|
1990-04-20
|
11KB
|
322 lines
EGAPAL
Version 1.0
(c) Copyright 1990
EGAPAL is a series of programs which allow the user to create
graphic images for the 640x350, 16 color mode. Once completed, these
images are saved to either an image file or encoded into a header file.
Finally, a series of subroutines contained in a library file allow these
images to be displayed in user written, Turbo C programs.
EGAPAL was written out of a need of finding an inexpensive way
to produce graphic images to be included computer games I plan to write
in the future. I also wanted a product that would allow me to load
these images in memory, to be recalled and displayed quickly with a
limited amount of coding. Since I didn't have the $99 plus dollars to
invest in a program that may not even fit my needs, I decided to write
EGAPAL. Hopefully these programs will fit the bill for other budding
programmers as well.
EGAPAL is a shareware product. That means you have the
opportunity to test the software and determine whether the product fits
your needs. If you continue to use EGAPAL after this point you are
obligated to register your copy by sending $20 to:
Scott Young
P.O. Box 1550
Section #8
Portsmouth, NH 03802
Not only does this money reward my efforts, it also gives you the
opportunity to receive a free upgrade when the next version is released.
Another advantage of registering is that I am actively soliciting
comments and suggestions from users and plan to implement many of them
in the next version. Currently I have a need to add the following two
items: 1) full graphic screen editing 2) a TIF file import facility.
The current version of EGAPAL allows you to edit images with the maximum
size being 121x76 pixels. If you wanted to make a graphic screen at
this point you would need to divide the screen into several sections,
create the images, and then put them together in "patchwork" fashion.
I would like to see a TIF import facility because I am no freehand
graphics artist (I have trouble making stick men!). This will allow me
to import a perfectly proportional black and white images to be modified
and given color. I am sure you users out there can think of other ways
to improve the product as well. Registering your copy and sharing
suggestions helps us all!
1
FILES
=====
The EGAPAL product consists of the following files:
EGAPAL.EXE - The graphic image editor program.
EGAPAL-H.EXE - A program which reads EGAPAL graphic image files (.PLI)
and creates header files to be included in Turbo C
programs.
EGAPAL.LIB - The EGAPAL library of subroutines which copy graphics
images from disk or header files to the screen.
EGAPAL.DOC - This file.
LOGO.PLI - An image file containing the EGAPAL logo.
LOGO.H - A header file containing the EGAPAL logo.
PALETTE.PLI - An image file containing the picure of a palette.
PALETTE.H - A header file containing the picure of a palette.
TEST.C - A sample program that demonstrates how graphic images
are displayed on the screen.
TEST.PRJ - Turbo C project file for TEST.C
EGAVGA.BGI - Turbo C's EGA/VGA graphics driver.
USING EGAPAL
============
To create graphic images run the program EGAPAL.EXE. After
reading the copyright box, hit any key to display the entire image
editor screen. In the upper left hand corner of the screen is the
25x40 box where your images will be created. This box is discussed
in detail in the draw command section. Below the large box are 16
small rectangles containing the 16 default colors you will use to make
your images. The colors found in the interior 14 rectangles can be
changed to any of the 64 colors available in the EGAHI and VGAMED
graphics modes. Below the colored rectangles are 4 larger rectangles
labeled F1 thru F4. Hitting the appropriate function key executes the
command contained in the corresponding rectangle. The "Actual Size"
box is found in the center of the screen to the right. As you create
you image in the large box, you actual image will appear in this box.
Above this box is the "Current Color" box. This box will contain the
color you are currently using.
2
SELECTING COLORS FOR YOUR IMAGE
===============================
Sixteen default colors are provided for you when you begin
using EGAPAL. To change these colors hit F1 from the main menu
(Selete Palette). A set of new commands will now appear. Next you
need to decide which of the default colors you want to change. Hit
F1 (Arrow Left) or F2 (Arrow Right) to move the selection arrow under
your choice (Note: Black and white cannot be changed). Then hit F3
(Change Color) repeatedly to see all 64 colors available to you. Once
you find a color you like you can continue to change other default
colors or hit F4 (Quit) to return to the main menu. When an image is
saved to disk, your color selections are saved as well (see Loading and
Saving Images).
CREATING AN IMAGE
=================
To begin creating an image hit F3 (Draw) from the main menu.
Next, select your first drawing color by hitting F1 (Select Color).
Move the selection arrow to the desired color by using the F1 (Arrow
Left) and F2 (Arrow Right) keys. Hit F3 (Select Color) to lock in your
choice. After F3 is hit, the "Current Color" box displays your selected
color. Use this routine whenever you want to change the drawing color.
Hit the F2 (Plot Colors) key to begin drawing. A square cursor
will appear in the 25x40 box. Using the four arrow keys, move the
cursor to where you want to begin drawing. Next hit F1 (Turn Plot On)
to enable the plotting facility. The arrow keys are then used to draw
your image in the current drawing color. As you plot colors in the
25x40 box, the image begins to appear in the "Actual Image" box.
There will be times when you want to suspend plotting and move
the cursor to another location within your image. Hit F1 (Turn Plot
Off) and move the cursor to the new location. Resume plotting by
hitting F1 (Turn Plot On) again. (Notice the F1 key toggles on and off)
As you create your image mistakes will invariably be made. To
erase a mistake move the cursor to the mistake and hit F1 (Turn Plot
Off). Then by hitting F2 (Erase Boxes) and moving your cursor over the
the mistake, the pixels will revert back to the background color of
black. Hit F4 (Quit Erasing) when done.
When you are done plotting the upper left-hand corner of your
image you will want to change the original 0-25 vertical and 0-40
horizontal view. Hit F4 (Quit) to end plotting followed by F3 (Move
Window). The entire 75x120 image area will be shown with a smaller
3
box in the upper left-hand corner. The smaller box represents the
area you have just been plotting. Using the arrow keys, move the
smaller box to the next plotting area. Hit enter when done.
LOADING AND SAVING IMAGES
=========================
Unless you like to live dangerously, you will want to save your
images often as you are creating them. Also there will be times when
you want to modify and/or complete images as well. Hit F2 (File) from
the main menu to enter the file loading and saving section.
EGAPAL creates two different types of files, work files and
image files. Work files are created when you hit the F2 (Save Work)
key and enter a filename. Work files have an extension of .PLW and
contain the image's 16 palette colors and plotted points. Image files
are created when you hit F3 (Save Image) and enter a filename. Image
files have an extension of .PLI and are loaded into you "C" programs
by way of a function in the library file EGAPAL.LIB. (Note: The F3
option will not appear when there is no image in the editor) The F1
(Load Work) key will allow you to load a previously saved work file.
A complete listing of all the work files will appear on the screen in
alphabetical order. Highlight your choice and enter. If you have
lots of work files you may need to toggle to a second or third page.
Once your choice is made the image is loaded into the plotting box.
From that point you are ready to continue your work.
When you are ready to exit the program hit F4 (Quit) from the
main menu. F1 (Quit Please!) takes you back to the DOS prompt. F2
(Don't Quit!) gives you the opportunity to get back to the main menu.
THE EGAPAL-H.EXE PROGRAM
========================
The EGAPAL-H.EXE program is a utility that lets you read an
image file (.PLI) and create a header file (filename.H) to be included
in your Turbo C programs. The header file consists of two arrays. The
first array contains the values representing the image's 16 palette
colors. The second array contains the image itself. Two functions in
the EGAPAL.LIB use these arrays to display images.
When you run EGAPAL-H.EXE an alphabetical list of all the image
files (.PLI) appears. Highlight the desired file and enter. If you
have lots of image files in the current directory you may need to toggle
to another page to find your choice. A header file with the image's
filename and an extension of .H is then created.
4
THE EGAPAL.LIB LIBRARY FILE
===========================
The EGAPAL.LIB library file contains three function that load
images to your screen. The first function reads an image file (.PLI),
loads the image's 16 colors, and displays the image:
file_image(x,y,"filename.ext")
example: file_image(200,100,"logo.pli");
The variables x and y are integers representing the location on the
640x350 screen you want the image to be placed. The image's filename
is entered in the funtion's third position.
When the image information is loaded from a header file, two
functions are used to display an image. The first function loads the
image's 16 colors into memory. (Note: Previous color selections will be
erased!)
coded_palette(array)
example: coded_palette(LOGO);
The second function loads the image:
coded_image(x,y,array)
example: coded_image(200,100,array);
The variables x and y are integers representing the location on the
640x350 screen you want the image to be placed. The image's array name
is entered in the function's third position.
EGAPAL TEST PROGRAM
===================
I have found that I learn new concepts in programming best
when I have a working examples to pick apart and test. Taking a look
at TEST.C and TEST.PRJ should be helpful. You can compile TEST.C with
the project file TEST.PRJ to make a working executable file.
5