home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
216.lha
/
IFFLib
/
iff.doc
< prev
next >
Wrap
Text File
|
1996-02-15
|
9KB
|
234 lines
Documentation for iff.library
Software written and distributed by:
Robert W. Albrecht Jr.
1457 Zion Way
Ventura, CA 93003
iff.library Version 1 (public domain)
This is crippled version of "iff.library" that can be used by your
C program to load IFF images. If you want the full featured version of
iff.library send $20 to the above address with your name and address.
This software is in the public domain and may not be sold or distributed
with commercial software. Version 2 of iff.library may be distributed with
commercial software with no royalties for the $20 license fee.
Three Example Programs Included
All three of the programs have the same command syntax and they must
be executed from the CLI:
Sho??? <IFF file name>
ShoPict displays almost any IFF image on a custom screen by loading the
IFF image directly into the BitMap of the custom screen.
ShoPict2 allows iff.library to allocate the BitMap for a custom bitmap
screen then opens the screen with the allocated bitmap.
ShoImg allocates and loads an Image structure from an IFF file and
displays it on the screen. Iff.library does the memory managment.
Setting up to use iff.library
Iff.library is accessed through a set of assembly language connection
routines. The assembly source to these routines is provided in the
file "iff.asm". You will need to assemble iff.asm unless you have
Aztec C 3.40A (or compatable) for which there is a ".o" file. Once
iff.asm is assembled you will have to link it with your program. You
will also have to copy iff.library to the libs: directory on your system
disk.
In your program you will have to:
1) Include the proper header file.
#include "ifflib.h"
2) Declare a global library base pointer;
void *IFFBase;
3) Open iff.library.
if( !(IFFBase = OpenLibrary(IFFNAME,1L)) )
/* abort */
Now you are ready to call the functions in iff.library.
Description of Functions
------------------------------------------------------------------
name: IFFalloc
synopsis: void *IFFalloc(size,type)
long size;
unsigned short type;
function: Allocates and clears a block of memory using the Amiga
AllocMem function. The size of the block is saved so your
program doesn't have to remember it.
arguments: size - The requested size of the block of memory, four
extra bytes will be added to store the size of the block.
type - The type of Amiga memory you want to allocate;
CHIP for "CHIP" memory, FAST for "FAST" memory, and
DONTCARE if you don't care what type you allocate.
Note: Graphic images need to be in CHIP memory.
return: NULL (0L) is returned if the block can't be allocated,
otherwise a pointer to the allocated block is returned.
see also: IFFfree
---------------------------------------------------------------------
name: IFFfree
synopsis: void IFFfree(ptr)
function: Frees memory allocated by IFFalloc.
argument: ptr - a pointer to a block of memory obtained from IFFalloc.
return: None
note: IFFfree is used to free the colors obtained from GetIFF_image
or GetIFF_bitmap.
see also: IFFalloc
---------------------------------------------------------------------
name: GetIFF_bitmap
synopsis: short GetIFF_bitmap(name,bmap,colors,ncolors,allocate)
char *name;
struct BitMap **bmap;
unsigned short **colors;
unsigned short *ncolors;
unsigned short allocate;
function: To load and optionally allocate a BitMap and colors from
an IFF file.
arguments: name - A null terminated string containing the name of the
iff IFF file to load.
bmap - A pointer to a pointer to a BitMap structure. If
you decide let this function allocate the structure the
pointer will be set to the newly allocated BitMap.
colors - A pointer to an array of color values, one for each
color. The colors are organized in the native Amiga
format (RGB 4 bits per gun right justified). If you
decide to let this function allocate the colors
the pointer will be set to the newly allocated block.
ncolors - A pointer to a variable that will be set to the
number of colors in the IFF file.
allocate - Set to ALLOC if you want the colors and BitMap
allocated by this function. Otherwise set to NOALLOC.
return: Zero is returned if the operation was successful, otherwise
one of the error codes in ifflib.h is returned.
see also: RlsBitMap IFFfree
note: The BitMap structure is defined in graphics/gfx.h
---------------------------------------------------------------------
name: GetIFF_image
synopsis: short GetIFF_image(name,image,colors,ncolors,allocate)
char *name;
struct Image **image;
unsigned short **colors;
unsigned short *ncolors;
unsigned short allocate;
function: To load and optionally allocate a Image and colors from
an IFF file.
arguments: name - A null terminated string containing the name of the
iff IFF file to load.
image - A pointer to a pointer to an Image structure. If
you decide let this function allocate the structure the
pointer will be set to the newly allocated Image.
colors - A pointer to an array of color values, one for each
color. The colors are organized in the native Amiga
format (RGB 4 bits per gun right justified). If you
decide to let this function allocate the colors
the pointer will be set to the newly allocated block.
ncolors - A pointer to a variable that will be set to the
number of colors in the IFF file.
allocate - Set to ALLOC if you want the colors and Image
allocated by this function. Otherwise set to NOALLOC.
return: Zero is returned if the operation was successful, otherwise
one of the error codes in ifflib.h is returned.
see also: RlsImage IFFfree
note: The Image structure is defined in intuition/intuition.h
---------------------------------------------------------------------
name: QueryIFF
synopsis: short QueryIFF(name,bmHdr)
char *name;
BitMapHeader *bmHdr;
function: To retrieve information about a image in a IFF file.
arguments: name - A null terminated string containing the name of
an IFF file.
bmHdr - A pointer to a BitMapHeader structure. When this
function returns the BitMapHeader will be filled with the
information about the image in the IFF file.
return: Zero is returned if the operation was successful, otherwise
one of the error codes in ifflib.h is returned.
note: The BitMapHeader structure is defined in ifflib.h
---------------------------------------------------------------------
name: RlsBitMap
synopsis: void RlsBitMap(bmap)
struct BitMap *bmap;
function: Frees the memory allocated for a BitMap structure by
GetIFF_bitmap. The BitMap structure is allocated in two
parts, one for the structure itself and one for the bit-
planes.
argument: bmap - A pointer to a BitMap structure obtained from
GetIFF_bitmap.
return: None
see also: GetIFF_bitmap
---------------------------------------------------------------------
name: RlsImage
synopsis: void RlsImage(image)
struct Image *image;
function: Frees the memory allocated for a Image structure by
GetIFF_image. The Image structure is allocated in two
parts, one for the structure itself and one for the bit-
planes.
argument: image - A pointer to a Image structure obtained from
GetIFF_image.
return: None
see also: GetIFF_image
----------------------------------------------------------------------