
This directory contains the GraphIO library. It contains three functions:

----------------------------------------------------------------------------
int FAR PASCAL
import_graphic(HDC hdc,HWND hwnd,LPSTR fname,LPPICTINFO pi,int dopref,
               LPSTR inisection)
----------------------------------------------------------------------------
This function reads a graphics file and produces a metafile. It can read
standard or placeable metafiles directly, or any other file provided that
you have the appropriate graphics filter. The first parameter is a handle
to the destination device context. The second parameter is a handle to the
parent window. The third parameter is a pointer to the name of the graphics
file. The fourth parameter is a pointer to a PICTINFO structure (defined in
graphio.h) that will receive the metafile handle and its dimensions. The
fifth parameter (dopref) is a flag indicating if we want to call the filter
preference function (if the graphics filter has such a function). The last
parameter (inisection) is the name of the section in the WIN.INI file that
defines the graphics filters. Even though the library is flexible, I would
suggest to stick with the name "MS Graphic Import Filters" under normal
Windows for compatibility with Microsoft programs (eg., Word for Windows),
dviwin and grview. It is better to use the name "NT Graphic Import Filters"
under Windows NT, to avoid mixups between the 16-bit and the 32-bit filters.
The contents of the WIN.INI file should look like:

   [MS Graphic Import Filters]
   PC Paintbrush(.PCX)=XXXXX\pcxin.flt,PCX
   Microsoft Paint(.MSP)=XXXXX\mspin.flt,MSP
   Bitmaps(.BMP)=XXXXX\bmpin.flt,BMP
   Bitmaps(.DIB)=XXXXX\bmpin.flt,DIB
   Bitmaps(.RLE)=XXXXX\bmpin.flt,RLE
   Compuserve GIF(.GIF)=XXXXX\gifin.flt,GIF
   X Pixmaps(.XPM)=XXXXX\xpmin.flt,XPM
   .....
   .....

where XXXXX is the directory where you keep the graphics filters.

If the specified file has an extension, the function will try to import that
file only. If the specified file has no extension, the function will try all
possible extensions from the WIN.INI file. In the above example, it will try:
WMF, PCX, MSP, BMP, DIB, RLE, GIF and XPM (it always tries the WMF extension
first). If it finds any matching file, then it tries to import it, and it
appends the appropriate extension to the filename. Therefore, MAKE SURE THAT
THE FILENAME HAS ENOUGH SPACE FOR THE EXTENSION IF YOU DON'T SUPPLY IT. If
you forget this, BAD things will happen to your program.

The function returns one of the GRIMP constants defined in graphio.h. After
you are through with the metafile, don't forget to call DeleteMetaFile()

----------------------------------------------------------------------------
int FAR PASCAL save_meta(LPPICTINFO pi,int mm,LPSTR fname,int placeable)
----------------------------------------------------------------------------
This function saves the specified metafile to disc. The first parameter
is a pointer to a PICTINFO structure (defined in graphio.h). The second
parameter is the desired mapping mode; this is not necessary (and will not
be placed in the disc file), UNLESS the "inch" field of the PICTINFO
structure is zero and you want to use the placeable format; in that case,
the function will fill the "inch" field according to the specified mapping
mode. The third parameter is the name of the disc file. The last parameter
is a flag indicating the format of the disc file: if it is zero, the disc
file will be in the standard format; otherwise, it will be in the placeable
format. The function returns one of the GREXP constants defined in graphio.h

----------------------------------------------------------------------------
int FAR PASCAL get_openmask(LPSTR buf,int bufsz,LPSTR inisection)
----------------------------------------------------------------------------
This function is useful if you use the "Open" common dialog, and you want to
fill the "List Files of Type" listbox with entries from the graphics filter
section of WIN.INI. The first parameter is the output buffer. The second
parameter is the buffer size (make sure that it is at least equal to 200
bytes: typically, you will want to use around 1000 bytes or more). The third
parameter is the name of the WIN.INI section containing the filter information
(typically "MS Graphic Import Filters"). The function returns one of the
following constants:
        GRIMP_OK                Success
        GRIMP_NOMEM             Out of memory
        GRIMP_BADPARMS          Invalid parameters
        GRIMP_NOSPACE           The output buffer is not large enough



The GrView program demonstrates the usage of all three functions. If you
want to use this DLL in your programs, put the file "graphio.h" in your
INCLUDE directory, the file "graphio.lib" ("graphio2.lib" under Windows NT)
in your LIB directory and the file "graphio.dll" ("graphio2.dll under NT)
anyplace in your path. If you also want to write your own filters, put the
file "filter.h" in the INCLUDE directory.

Hippocrates Sendoukas
isendo@leon.nrcps.ariadne-t.gr
