home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 216.lha / IFFLib / iff.doc < prev    next >
Text File  |  1996-02-15  |  9KB  |  234 lines

  1.                   Documentation for iff.library
  2.  
  3.               Software written and distributed by:
  4.  
  5.                     Robert W. Albrecht Jr.
  6.                     1457 Zion Way
  7.                     Ventura, CA 93003
  8.  
  9.              iff.library Version 1 (public domain)
  10.  
  11.       This is crippled version of "iff.library" that can be used by your
  12.    C program to load IFF images. If you want the full featured version of
  13.    iff.library send $20 to the above address with your name and address.
  14.    This software is in the public domain and may not be sold or distributed
  15.    with commercial software. Version 2 of iff.library may be distributed with
  16.    commercial software with no royalties for the $20 license fee.
  17.  
  18.  
  19.                   Three Example Programs Included
  20.  
  21.    All three of the programs have the same command syntax and they must
  22.    be executed from the CLI:
  23.  
  24.    Sho??? <IFF file name>
  25.  
  26.    ShoPict displays almost any IFF image on a custom screen by loading the
  27.    IFF image directly into the BitMap of the custom screen.
  28.  
  29.    ShoPict2 allows iff.library to allocate the BitMap for a custom bitmap
  30.    screen then opens the screen with the allocated bitmap.
  31.  
  32.    ShoImg allocates and loads an Image structure from an IFF file and
  33.    displays it on the screen. Iff.library does the memory managment.
  34.  
  35.  
  36.                   Setting up to use iff.library
  37.  
  38.       Iff.library is accessed through a set of assembly language connection
  39.    routines. The assembly source to these routines is provided in the
  40.    file "iff.asm". You will need to assemble iff.asm unless you have
  41.    Aztec C 3.40A (or compatable) for which there is a ".o" file. Once
  42.    iff.asm is assembled you will have to link it with your program. You
  43.    will also have to copy iff.library to the libs: directory on your system
  44.    disk.
  45.  
  46.    In your program you will have to:
  47.  
  48.    1) Include the proper header file.
  49.  
  50.    #include "ifflib.h"
  51.  
  52.    2) Declare a global library base pointer;
  53.  
  54.    void *IFFBase;
  55.  
  56.    3) Open iff.library.
  57.  
  58.    if( !(IFFBase = OpenLibrary(IFFNAME,1L)) )
  59.       /* abort */
  60.  
  61.    Now you are ready to call the functions in iff.library.
  62.  
  63.  
  64.                      Description of Functions
  65.  
  66.    ------------------------------------------------------------------
  67.    name:       IFFalloc
  68.  
  69.    synopsis:   void *IFFalloc(size,type)
  70.                long size;
  71.                unsigned short type;
  72.  
  73.    function:   Allocates and clears a block of memory using the Amiga
  74.                AllocMem function. The size of the block is saved so your
  75.                program doesn't have to remember it.
  76.  
  77.    arguments:  size - The requested size of the block of memory, four
  78.                extra bytes will be added to store the size of the block.
  79.                type - The type of Amiga memory you want to allocate;
  80.                       CHIP for "CHIP" memory, FAST for "FAST" memory, and
  81.                       DONTCARE if you don't care what type you allocate.
  82.                       Note: Graphic images need to be in CHIP memory.
  83.  
  84.    return:     NULL (0L) is returned if the block can't be allocated,
  85.                otherwise a pointer to the allocated block is returned.
  86.  
  87.    see also:   IFFfree
  88.  
  89.    ---------------------------------------------------------------------
  90.    name:       IFFfree
  91.  
  92.    synopsis:   void IFFfree(ptr)
  93.  
  94.    function:   Frees memory allocated by IFFalloc.
  95.  
  96.    argument:   ptr - a pointer to a block of memory obtained from IFFalloc.
  97.  
  98.    return:     None
  99.  
  100.    note:       IFFfree is used to free the colors obtained from GetIFF_image
  101.                or GetIFF_bitmap.
  102.  
  103.    see also:   IFFalloc
  104.  
  105.    ---------------------------------------------------------------------
  106.    name:       GetIFF_bitmap
  107.  
  108.  
  109.    synopsis:   short GetIFF_bitmap(name,bmap,colors,ncolors,allocate)
  110.                char *name;
  111.                struct BitMap **bmap;
  112.                unsigned short **colors;
  113.                unsigned short *ncolors;
  114.                unsigned short allocate;
  115.  
  116.    function:   To load and optionally allocate a BitMap and colors from
  117.                an IFF file.
  118.  
  119.    arguments:  name - A null terminated string containing the name of the
  120.                iff IFF file to load.
  121.                bmap - A pointer to a pointer to a BitMap structure. If
  122.                       you decide let this function allocate the structure the
  123.                       pointer will be set to the newly allocated BitMap.
  124.                colors - A pointer to an array of color values, one for each
  125.                       color. The colors are organized in the native Amiga
  126.                       format (RGB 4 bits per gun right justified). If you
  127.                       decide to let this function allocate the colors
  128.                       the pointer will be set to the newly allocated block.
  129.                ncolors - A pointer to a variable that will be set to the
  130.                       number of colors in the IFF file.
  131.                allocate - Set to ALLOC if you want the colors and BitMap
  132.                       allocated by this function. Otherwise set to NOALLOC.
  133.  
  134.    return:     Zero is returned if the operation was successful, otherwise
  135.                one of the error codes in ifflib.h is returned.
  136.  
  137.    see also:   RlsBitMap IFFfree
  138.  
  139.    note:       The BitMap structure is defined in graphics/gfx.h
  140.  
  141.    ---------------------------------------------------------------------
  142.    name:       GetIFF_image
  143.  
  144.  
  145.    synopsis:   short GetIFF_image(name,image,colors,ncolors,allocate)
  146.                char *name;
  147.                struct Image **image;
  148.                unsigned short **colors;
  149.                unsigned short *ncolors;
  150.                unsigned short allocate;
  151.  
  152.    function:   To load and optionally allocate a Image and colors from
  153.                an IFF file.
  154.  
  155.    arguments:  name - A null terminated string containing the name of the
  156.                iff IFF file to load.
  157.                image - A pointer to a pointer to an Image structure. If
  158.                       you decide let this function allocate the structure the
  159.                       pointer will be set to the newly allocated Image.
  160.                colors - A pointer to an array of color values, one for each
  161.                       color. The colors are organized in the native Amiga
  162.                       format (RGB 4 bits per gun right justified). If you
  163.                       decide to let this function allocate the colors
  164.                       the pointer will be set to the newly allocated block.
  165.                ncolors - A pointer to a variable that will be set to the
  166.                       number of colors in the IFF file.
  167.                allocate - Set to ALLOC if you want the colors and Image
  168.                       allocated by this function. Otherwise set to NOALLOC.
  169.  
  170.    return:     Zero is returned if the operation was successful, otherwise
  171.                one of the error codes in ifflib.h is returned.
  172.  
  173.    see also:   RlsImage IFFfree
  174.  
  175.    note:       The Image structure is defined in intuition/intuition.h
  176.  
  177.    ---------------------------------------------------------------------
  178.    name:       QueryIFF
  179.  
  180.    synopsis:   short QueryIFF(name,bmHdr)
  181.                char *name;
  182.                BitMapHeader *bmHdr;
  183.  
  184.    function:   To retrieve information about a image in a IFF file.
  185.  
  186.    arguments:  name - A null terminated string containing the name of
  187.                an IFF file.
  188.                bmHdr - A pointer to a BitMapHeader structure. When this
  189.                function returns the BitMapHeader will be filled with the
  190.                information about the image in the IFF file.
  191.  
  192.    return:     Zero is returned if the operation was successful, otherwise
  193.                one of the error codes in ifflib.h is returned.
  194.  
  195.    note:       The BitMapHeader structure is defined in ifflib.h
  196.  
  197.    ---------------------------------------------------------------------
  198.    name:       RlsBitMap
  199.  
  200.    synopsis:   void RlsBitMap(bmap)
  201.                struct BitMap *bmap;
  202.  
  203.    function:   Frees the memory allocated for a BitMap structure by
  204.                GetIFF_bitmap. The BitMap structure is allocated in two
  205.                parts, one for the structure itself and one for the bit-
  206.                planes.
  207.  
  208.    argument:   bmap - A pointer to a BitMap structure obtained from
  209.                GetIFF_bitmap.
  210.  
  211.    return:     None
  212.  
  213.    see also:   GetIFF_bitmap
  214.  
  215.    ---------------------------------------------------------------------
  216.    name:       RlsImage
  217.  
  218.    synopsis:   void RlsImage(image)
  219.                struct Image *image;
  220.  
  221.    function:   Frees the memory allocated for a Image structure by
  222.                GetIFF_image. The Image structure is allocated in two
  223.                parts, one for the structure itself and one for the bit-
  224.                planes.
  225.  
  226.    argument:   image - A pointer to a Image structure obtained from
  227.                GetIFF_image.
  228.  
  229.    return:     None
  230.  
  231.    see also:   GetIFF_image
  232.  
  233.    ----------------------------------------------------------------------
  234.