home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / imagefx_sdk / include / scan / loadsave.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-18  |  7.4 KB  |  212 lines

  1. /*
  2.  * ImageFX Development Header File
  3.  * Copyright © 1991-1995 Nova Design, Inc.
  4.  * Written by Thomas Krehbiel
  5.  *
  6.  * Loader and Saver Definitions.
  7.  *
  8.  */
  9.  
  10. #ifndef SCAN_LOADSAVE_H
  11.  
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. #ifndef EXEC_NODES_H
  18. #include <exec/nodes.h>
  19. #endif
  20.  
  21. #ifndef EXEC_LISTS_H
  22. #include <exec/lists.h>
  23. #endif
  24.  
  25. /* why is this here?  becuase render modules usually include loadsave.h */
  26. #ifndef SCAN_REND_H
  27. #include <scan/rend.h>
  28. #endif
  29.  
  30.  
  31. /*
  32.  * LoadFormat:
  33.  *
  34.  * The Loader module function LM_Signatures() returns a pointer to an
  35.  * array of LoadFormat structures, which define the signature bytes
  36.  * that identify this file type.  The list ends with a NULL Identifier
  37.  * field.  Each Loader can return more than one LoadFormat structure,
  38.  * to support multiple variants of a particular file type.
  39.  *
  40.  * LoadFormat->Identifier are the signature bytes to match at the
  41.  * beginning of the file.  A "?" will match any value in the input
  42.  * file (eg. "FORM????ILBM").
  43.  *
  44.  * LoadFormat->Length is the number of bytes to scan at the beginning
  45.  * of the file.  Use as few as possible.
  46.  *
  47.  * LoadFormat->Name is what is displayed to the user as the name of
  48.  * the format.
  49.  *
  50.  */
  51.  
  52. struct LoadFormat
  53. {
  54.    char    *Identifier;             /* Variable-length identifier bytes */
  55.    int      Length;                 /* Length of identifier string */
  56.    char    *Name;                   /* Name of format (for user) */
  57.    int      ID;                     /* Loader-specific ID code */
  58.    UWORD    Flags;                  /* Various flags (see below) */
  59. };
  60.  
  61. /* flags for LoadFormat->Flags: */
  62. #define LOA_NOFILE   (0x0200)       /* Tell ImageFX not to ask for filename
  63.                                        when loading this format - this is
  64.                                        used by the clipboard loader */
  65.  
  66. #define LOA_MULTI    (0x1000)       /* This file format contains multiple
  67.                                        images (eg. animation) - used to
  68.                                        determine whether a file is an
  69.                                        animation or not. */
  70.  
  71. #define LOA_PREFS    (0x2000)       /* 2.0 - This file format has user-definable
  72.                                        preferences settings. (UNUSED) */
  73.  
  74. #define LOA_OLDNAME  (0x4000)       /* 2.0 - don't show this name in GUI lists,
  75.                                        but still recognize it via. Arexx
  76.                                        (UNUSED) */
  77.  
  78.  
  79. #ifdef SCANPRIVATE
  80.  
  81. /*
  82.  * LoadNode/LoadList:
  83.  *
  84.  * Used internally to store all loader module information.
  85.  *
  86.  */
  87. struct LoadNode
  88. {
  89.    struct Node       Node;          /* Exec-standard node */
  90.    struct LoadFormat Format;        /* Format information */
  91.    char              Loader[128];   /* Loader to open and call */
  92.    int               Bytes;         /* Length of node in bytes */
  93.    char              Name[60];      /* Name of the loader */
  94.    char              Text[1];       /* Text is allocated here */
  95. };
  96.  
  97. struct LoadList
  98. {
  99.    struct List       List;          /* List of loader nodes */
  100.    int               MaxLength;     /* Bytes to read from file */
  101.    struct List       OldList;       /* Old name loader nodes */
  102. };
  103.  
  104. #endif
  105.  
  106. /*
  107.  * SaveFormat:
  108.  *
  109.  * The Saver module function SM_Signatures() returns a pointer to an array
  110.  * of SaveFormat structures, which define the names and flags of the file
  111.  * formats supported by the module.  The list is terminated by a NULL
  112.  * Name field.  Each Saver can return more than one SaveFormat structure,
  113.  * to support multiple variants of a particular file type.
  114.  *
  115.  */
  116. struct SaveFormat {
  117.    char             *Name;
  118.    ULONG             Flags;
  119.    int               ID;
  120. };
  121.  
  122. /* flags for SaveFormat: */
  123. #define SAV_TRUE     (0x0001)       /* Can save 8- or 24-bit true color */
  124. #define SAV_MAPPED   (0x0002)       /* Can save a BitMap/ViewPort */
  125. #define SAV_PALETTE  (0x0004)       /* Can save a 24-bit palette */
  126. #define SAV_CMYK     (0x0008)       /* Can handle CMYK format images */
  127. #define SAV_NOREQ    (0x0080)       /* Don't ask to overwrite... we'll do it */
  128. #define SAV_NOMASK   (0x0100)       /* Format does not support a mask */
  129. #define SAV_NOFILE   (0x0200)       /* This format does not require a filename (eg. clipboard) */
  130. #define SAV_NOICON   (0x0400)       /* Do not save an icon with this file */
  131. #define SAV_NOPIC    (0x0800)       /* Format does not require a render picture */
  132. #define SAV_MULTI    (0x1000)       /* Format contains multiple images (ie. anim) */
  133. #define SAV_NONAIL   (0x2000)       /* 2.0 - don't save thumbnail file */
  134. #define SAV_OLDNAME  (0x4000)       /* 2.0 - don't show this name in GUI lists,
  135.                                        but still recognize it via. Arexx (UNUSED) */
  136.  
  137. #ifdef SCANPRIVATE
  138.  
  139. /*
  140.  * SaveNode:
  141.  *
  142.  * Used internally to keep track of saver modules.
  143.  *
  144.  */
  145. struct SaveNode
  146. {
  147.    struct MinNode    Node;          /* Exec standard node */
  148.    struct Node       TrueNode;      /* Node for True list */
  149.    struct Node       MappedNode;    /* Node for Mapped list */
  150.    struct Node       PalNode;       /* Node for Palette list */
  151.    struct Node       SepNode;       /* Node for Color Separation list */
  152.    struct SaveFormat Format;        /* Save format name */
  153.    char              Saver[128];    /* Name of saver module */
  154.    int               Bytes;         /* Length of node in bytes */
  155.    char              Text[1];       /* Text is allocated here */
  156. };
  157.  
  158. #endif
  159.  
  160. /*
  161.  * Palatte:
  162.  *
  163.  * Information about a colormap palette.  This structure is used by
  164.  * the scan.library function NewGetPalette() to retreive information
  165.  * about the current ImageFX palette.  It is also used by the Loader
  166.  * module function LM_LoadPalette().  It is also used in the MappedImage
  167.  * structure, which is passed to the Saver module function SM_SaveMapped().
  168.  *
  169.  */
  170. struct Palette
  171. {
  172.    short             Depth;         /* Bitplanes in palette */
  173.    short             Count;         /* Count of palette entries, will
  174.                                        usually be 2 ^ Depth */
  175.    UBYTE            *Table;         /* Array of palette entries, arranged
  176.                                        as 3 bytes each of Red, Green,
  177.                                        Blue. (Length = 3 * Count) */
  178.    /*
  179.     * This information is generally only used by the NewGetPalette()
  180.     * function to report information about ImageFX palettes:
  181.     */
  182.    short             NumRanges;     /* Number of color ranges in palette */
  183.    short             pad0;
  184.    short            *LowRange;      /* Array of lower limit of ranges */
  185.    short            *HighRange;     /* Array of upper limit of ranges */
  186.    short            *RangeLocked;   /* Array of locked indicators */
  187. };
  188.  
  189. /*
  190.  * MappedImage:
  191.  *
  192.  * Information about a colormapped image.  Passed to the Saver module
  193.  * function SM_SaveMapped() to write colormapped (eg. rendered) images.
  194.  *
  195.  */
  196. struct MappedImage
  197. {
  198.    short             Width;         /* True image pixel width */
  199.    short             Height;        /* True image pixel height */
  200.    struct BitMap    *BitMap;        /* Image bitmap, up to 8 bitplanes */
  201.    struct ViewPort  *ViewPort;      /* (OBSOLETE) */
  202.    UBYTE            *Copper;        /* (UNUSED) */
  203.    struct Palette    Palette;       /* True image palette, see above */
  204.    ULONG             Modes;         /* ViewModes - use instead of ViewPort */
  205.    UWORD             AspectX,       /* X & Y pixel aspect ratio */
  206.                      AspectY;       /* (used to fill in BMHD) */
  207.    ULONG             pad[7];        /* reserved */
  208. };
  209.  
  210. #define SCAN_LOADSAVE_H
  211. #endif
  212.