| www.delorie.com/gnu/docs/hp2xx/hp2xxinf_26.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
First, study 1. Introduction for the outline of the modular structure and
general operation of hp2xx.
Let's assume you want to support TIFF format. The probably easiest way
of adding new formats is by modifying copies of existing files. Since TIFF
is a raster format, a good starting point would be `to_pcx.c'.
(Files `to_mf.c' or `to_eps.c' should be considered in case
of a vector format, and `to_vga.c' or `to_x11.c' in case of
a new previewer.) Copy it to a file `to_tiff.c' and edit the latter.
The old code is pretty much self-explanatory. Essentially, the output file
is opened, initializations are performed, and the internal bitmap is
converted into the target format (here, TIFF) scanline-by-scanline.
There is just one routine called from other modules (originally named
PicBuf_to_PCX. Rename it to e.g. PicBuf_to_TIFF ) and adapt
the conversion code.
Once you've done that, the rest (integration of the new format into the
package) is easy: First, edit `hp2xx.h' and add a prototype
line for PicBuf_to_TIFF in analogy to e.g., PicBuf_to_PCX.
Edit the `makefile's and add to_tiff.c to the list of sources
and e.g. to_tiff.o to the list of objects. Now you are ready for
compilation tests (but not for linking yet).
Then, change the main file `hp2xx.c' at various places: Near the
beginning of the file, add `XX_TIFF, ' to the hp2xx_mode typedef,
and a line like `XX_TIFF, "tiff", ' to the ModeList struct below.
Please note the alphabetical order of these lists. Never put anything behind
the termination code XX_TERM! At the end of the file,
add a case statement to the switch list in analogy to e.g.
the PCX entry.
You may also want to add a line to the on-line help to
announce the new format, and change the release number and date.
Look for functions Send_ID and usage_msg at the first quarter
of file `hp2xx.c'!
Now a make all will produce code containing the new format.
If your format turns out to work nicely and seems to be of general interest,
please consider contributing it to the hp2xx project.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |