How to make bitmap images for PutImage routine.
-----------------------------------------------
    (by Jan Sedlak  23:10pm 11-15-1995)


A. What you need:
-----------------

1. PC Painting software
2. PC Bitmap viewer (full screen)
3. A86 assembler (shareware - available on request from the author)


B. Step by step
---------------

1. Let us say you want to make an image 80 pixel wide (horizontal)
and 30 pixel long (vertical).

------
2. First edit the image in your painting software. I recommend
to draw a frame 81x31 to get the right size of the image.

------
3. If you are ready, remove the frame (#2 above), if any.
Then move the image to the top left corner and save the picture.

Example file:  TEST1.PCX

------
4. Start the SNATCH.EXE - a PGF screen "thief".
View the picture (TEST1.PCX in demo) in a full screen bitmap viewer.
(I use Norton Commander F3 key)

------
5. If the picture is on the screen, press ALT-S to start the SNATCH.EXE
resident function. The result should be "snatch00.pgf". Remember: the PGF
file is always 1920 bytes long.

There is a TEST1.PGF file (demo file) included. It is a PGF saving from
the TEST1.PCX file.

------ 
6. As a next step, you have to adapt the PGF2DB.8 file
to fit your needs.

PGF2DB.8 is a source file (assembler) of a tool that converts
the upper left corner of PGF file to bitmap image written in DB format
for later re-assembling.

If you look at the PGF2DB.8 (PGF-to-DB) you can see a similar header
at the beginning of the file:

	source  	db 'snatch00.pgf',00
	target  	db 'exit.dat',00
	bajt_hor 	db 3	;  total of bytes for horizontal pixels
	bajt_ver 	db 10	;  lines

source - name of the source PGF file
target - where the DB data will be saved
bajt_hor  - number of horizontal bytes   (8 pixels in one byte)
bajt_ver  - number of vertical pixels/lines

You can adapt the 'source' and 'target' items if you need
to use other filenames.

You must adapt the 'bajt_hor' and 'bajt_ver' any time you change
the size of the image.

Bajt_hor is total of bytes needed to save one horizontal line. If we
use our example (80x30 image) the 'bajt_hor' will be 10. (10*8=80)

If the image were, let's say, 85 pixel wide, the 'bajt_hor' would be
equal to 11. (For 85 pixels we need 11 bytes: 11*8=88, the last 3 bits
are not used)

Bajt_ver is total of lines. It is the same as the vertical size of the
image: in our example (80x30) the bajt_ver is 30.
 
EXAMPLE:

Let us take our image from file TEST1.PGF (80*30 pixels). Then the heading
in PGF2DB.8 must be adapted:

	source  	db 'test1.pgf',00
	target  	db 'exit.dat',00
	bajt_hor 	db 10	;  total of bytes for horizontal_pixels 	
	bajt_ver 	db 30	;  lines

If you are ready, the next step is compiling the PGF2DB.8 into a .com file

------
7. Compiling into .com file 
It is simple. Just type at the DOS prompt:

a86 pgf2db.8  [enter]

The result is a .com and .sys file. The .sys file has now meaning for your
further work.

-------
8. Now run the PFG2DB.COM file by typing it at the prompt:

pgf2db [enter]

The result should be an 'exit.dat' (or whatever you called it) on your disk.
The 'exit.dat' consists of 'DB' at each line, followed by clusters of 3 hexa
digits separated by commas.

------
9. Adding a image header

The image header consists of 4 digits and e.g. looks this way:

DB  64,0,13,0 

 - This header above is for image 65x14 pixel large.

The header is the very first info, before the image data itself.
If we take our example of TEST1.PGF (80*30 pixels) than the
header will be:

DB 79,0,29,0

As you certainly noticed, the numbers start from 0 and are thus decreased
by 1. (80-->79, 30-->29). And the 2nd and 4th number are set to 0.

-------
10. Last step

Merge the image with the header into your program source code
and do not forget to give the PutImage routine the segment-offset pointer 
showing to the data of your image.

Good luck.

------------------------------------
C. The files included in this package

INIT     8             250 	Init rutine
PUTIM    8          12,279      PutImage rouine
REFRESH  8           2,112      Refresh routine
CLRAM    8             397      Clear_Ram routine
SNATCH   EXE         9,958 	PGF screen saver
PGF2DB   8           2,014 	PGF-to-DB convertor
BITMAP   TXT         		this text
TEST1    PCX        20,534 	PCX file
TEST1    PGF         1,920 	PGF file
TEST1    DAT         1,352      image data (exit.dat) + header
DEMO1    COM         1,499 	demo program
DEMO1    8          17,475 	demo source

---------------------------------------
D. How to contact the autor:

Address:	Jan Sedlak - Portfolio
		Sarajevska 29
		120 00 Praha 2
Phone:		+ 42 2 691 11 63  (also modem, fax)
		+ 42 2 99 61 894  (also answ.)

e-mail:		sedlakj@dec59.ruk.cuni.cz

This package is completely free to be used for further software
development. Please let me know your results.

