home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / imagefx_sdk / include / scan / buf.h next >
Encoding:
C/C++ Source or Header  |  1995-01-22  |  13.4 KB  |  401 lines

  1. /*
  2.  * ImageFX Development Header File
  3.  * Copyright © 1991-1995 Nova Design, Inc.
  4.  * Written by Thomas Krehbiel
  5.  *
  6.  * Image Buffers And Related Structures
  7.  *
  8.  */
  9.  
  10. #ifndef SCAN_BUF_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 SCAN_DRAW_H
  22. #include <scan/draw.h>     /* for enum Region_Tag */
  23. #endif
  24.  
  25. /*
  26.  * RMask (2.0):
  27.  *
  28.  * Rendered Mask - a rendered representation of a Mask struct for
  29.  * quickly stamping region masks onscreen.
  30.  *
  31.  */
  32. struct RMask
  33. {
  34.  
  35.    UWORD            *Mask;          /* 1-bitplane blit mask */
  36.    ULONG             Size;          /* size of Mask in bytes */
  37.    ULONG             Row;           /* bytes per row in Mask */
  38.    UWORD             X1, Y1;        /* onscreen location */
  39.    UWORD             X2, Y2;
  40.    UWORD             ViewX,         /* size of preview when rendered */
  41.                      ViewY;
  42.    ULONG             pad[7];
  43.  
  44. };
  45.  
  46. /*
  47.  * Mask:
  48.  *
  49.  * Mask - Defines a 1-bitplane mask plane for regional processing.
  50.  * Also used to define the bounds of a brush.
  51.  *
  52.  */
  53. struct Mask
  54. {
  55.    short             OffsetX;       /* Offset into image */
  56.    short             OffsetY;
  57.    short             Width;         /* Width of rectangle */
  58.    short             Height;        /* Height of rectangle */
  59.    long              Size;          /* Size of mask data in bytes */
  60.    short             BytesPerRow;   /* Bytes per mask row */
  61.    UBYTE            *Mask;          /* Pointer to mask data (can be CHIP mem) */
  62.    enum Area_Tag     Type;          /* Type of mask (NOT USED) */
  63.    UBYTE             Flags;         /* New flags for 2.0 */
  64.    char              pad;
  65.    struct RMask     *RMask;         /* "Rendered mask" information */
  66.    UBYTE            *Mask8;         /* 8-bit mask if MASKF_8BIT set */
  67.    short             reserved[2];
  68. };
  69.  
  70. #define MASKF_8BIT   0x01           /* This is an 8-bit Mask instead of 1-bit */
  71.  
  72. /*
  73.  * NOTE:  8-Bit Masks are not implemented yet.
  74.  */
  75.  
  76.  
  77. /*
  78.  * Blend:
  79.  *
  80.  * Defines an 8-bit blend plane; generated by the feathering routines
  81.  * in CreateBlend().  Do not allocate or free this structure yourself;
  82.  * use CreateBlend() and DeleteBlend().
  83.  *
  84.  */
  85. struct Blend
  86. {
  87.    short             Width, Height;    /* Dimensions in pixels */
  88.    ULONG             Size;             /* Size of plane in bytes */
  89.    UBYTE            *Blend;            /* Pointer to 8-bit blend data */
  90.    ULONG             Reserved[8];      /* Reserved for future expansion */
  91. };
  92.  
  93. /*
  94.  * Clip:
  95.  *
  96.  * Used internally by the preview functions for storing sections of the
  97.  * preview screen when doing onscreen brush movement.  This should be
  98.  * considered a semi-private structure.
  99.  *
  100.  */
  101. struct Clip
  102. {
  103.    short          LeftEdge,            /* Left Corner in screen pixels */
  104.                   TopEdge;             /* Top Corner in screen pixels */
  105.    short          Width,               /* Clip width in screen pixels */
  106.                   Height;              /* Clip height in screen pixels */
  107.    short          OffsetX,             /* Attributes of the view that */
  108.                   OffsetY;             /*  the clip came from for */
  109.    short          ViewX,               /*  comparison later */
  110.                   ViewY;
  111.    struct BitMap  BitMap_old;          /* (OBSOLETE) */
  112.    UBYTE         *Stencil;             /* Stencil plane */
  113.    ULONG          StencilSize;         /* Size of the stencil plane */
  114.    APTR           PreviewPtr;          /* Used only by the preview module */
  115.    struct BitMap  SwapBM_old;          /* (OBSOLETE) */
  116.    short          SwapLE, SwapTE,      /* Where swap came from. */
  117.                   SwapW, SwapH;
  118.    struct BitMap *NewBM, *NewSwapBM;
  119.    ULONG          Reserved[6];
  120. };
  121.  
  122. /*
  123.  * Buffer:
  124.  *
  125.  * Defines an 8- or 24-bit image buffer.  Used a LOT in ImageFX.  This
  126.  * structure is also used for brushes.  You should ALWAYS use AllocBuffer()
  127.  * and KillBuffer() to create and destroy this structure.
  128.  *
  129.  * Image data is organized as three separate, contiguous blocks of memory
  130.  * for each of the Red, Green, and Blue channels.
  131.  *
  132.  */
  133. struct Buffer
  134. {
  135.    struct Node       Node;             /* (OBSOLETE) */
  136.  
  137.    char              Name[130];        /* Filename of this buffer */
  138.    char              Type[16];         /* Filetype for status display */
  139.    char              Locked;           /* (OBSOLETE) */
  140.    unsigned char     Flags;            /* Various flag bits (see below) */
  141.    short             Width, Height;    /* PIXEL width and height (max=32Kx32K)*/
  142.    char              BitsPerPlane;     /* Number of bits per pixel (ALWAYS 8) */
  143.    char              Depth;            /* Number of planes (1=grey or 3=rgb) */
  144.    short             BytesPerRow;      /* Number of bytes per row (usually = width) */
  145.    long              PlaneSize;        /* Size of each plane, in bytes */
  146.    UBYTE            *Planes[4];        /* Pointers to the plane data */
  147.  
  148.    struct Mask      *UnusedMask;       /* Unused region mask (INTERNAL) */
  149.    UBYTE           **RowPtr[3];        /* 2.0: Row pointers for faster GetBufLine (INTERNAL) */
  150.  
  151.    UBYTE            *Red, *Grn, *Blu;  /* Temp line pointers (INTERNAL) */
  152.    ULONG             TempSize;         /* Size of temp line buffers (INTERNAL) */
  153.  
  154.    /*
  155.     * These are used for disk buffers, and should not be modified.
  156.     */
  157.    struct VM_Handle *DHandle;          /* VMem handle */
  158.    short             LastGet;          /* Row/column of last GetBufLine() */
  159.    /* Unfortunately, this is not long aligned anymore */
  160.  
  161.    /*
  162.     * For Brushes, this defines the area of the brush.
  163.     * For Buffers, this defines the current region.
  164.     */
  165.    struct Mask      *Mask;             /* Region mask */
  166.  
  167.    /*
  168.     * These are used for Brushes.  Contains the rendered version
  169.     * of the brush for display.  Do not touch.
  170.     */
  171.    struct Clip      *Clip;             /* Fast display clip */
  172.  
  173.    /*
  174.     * These are used for mapping the buffer onto the preview display.
  175.     * They maintain the "viewport" of the buffer.  Do not touch.
  176.     */
  177.    short             OffsetX,          /* Pan position */
  178.                      OffsetY;
  179.    short             ViewX,            /* Virtual (zoomed) screen size */
  180.                      ViewY;
  181.  
  182.    /*
  183.     * Some stuff for reading multiple lines from a buffer at
  184.     * once into contiguous lines.  Do not touch.
  185.     */
  186.    UBYTE            *DLines[3];        /* Temp line pointers */
  187.    UWORD             DLineOffset;      /* Start line */
  188.    UWORD             DLineCount;       /* Number of temp lines allocated */
  189.    ULONG             DSize;            /* Bytes in each allocated line */
  190.  
  191.    /*
  192.     * See aspect discussion below.
  193.     */
  194.    short             AspectX,          /* (OBSOLETE) */
  195.                      AspectY;          /* (OBSOLETE) */
  196.  
  197.    /*
  198.     * The "handle" for a brush.  The upper-left corner is found by
  199.     * subtracting these numbers from the mouse position.  Thus if
  200.     * the handle is in the upper-left, HandleX = HandleY = 0.
  201.     */
  202.    short             HandleX,          /* X & Y handle for brushes. */
  203.                      HandleY;
  204.  
  205.    /*
  206.     * Dots per inch in the horizontal and vertical directions.  Used
  207.     * for storing in a DPI chunk and for possible printing applications.
  208.     * These can be converted to other system (eg. metric) fairly easily.
  209.     */
  210.    short             DPIX,
  211.                      DPIY;
  212.  
  213.    /*
  214.     * The pixel aspect ratio is different from the screen aspect
  215.     * ratio!  PIXEL aspect ratio defines how square the pixels are,
  216.     * the SCREEN aspect ratio defines how square the screen is.
  217.     * On a Macintosh, the pixel aspect is always 1:1 (so I'm told),
  218.     * whereas on the Amiga the pixel aspect ratios change from
  219.     * mode to mode (lores = 10:11, hires = 5:11, lores+lace = 20:11,
  220.     * hires+lace = 10:11).
  221.     */
  222.    short             PixAspectX,       /* PIXEL aspect ratio for this */
  223.                      PixAspectY;       /*  image buffer. */
  224.  
  225.    /*
  226.     * Scale tables used for displaying on the preview screen.
  227.     * Each buffer has its own scaling table attached to it.
  228.     * Do not touch.
  229.     */
  230.    short            *Prev2BufX,        /* Preview coords to Buffer coords */
  231.                     *Prev2BufY,
  232.                     *Buf2PrevX,        /* Buffer coords to Preview coords */
  233.                     *Buf2PrevY,
  234.                     *TableX,           /* Incremental offsets to convert */
  235.                     *TableY;           /*    from preview to buffer coords */
  236.    long              PrevSizeX,        /* Size of preview->buffer tables */
  237.                      PrevSizeY,
  238.                      BufSizeX,         /* Size of buffer->preview tables */
  239.                      BufSizeY;
  240.  
  241.    /*
  242.     * Blend Alpha channel for use with brushes and feathering....
  243.     */
  244.    UBYTE            *BlendPlane;       /* 8-bit blend plane for feathering
  245.                                           Always matches the size of the buffer */
  246.    UBYTE             FeatherAmt;       /* Blend plane feather amount..
  247.                                           used to keep from re-calculating
  248.                                           the same feather amount twice. */
  249.  
  250.    UBYTE             ExtFlags;         /* More flags */
  251.    UBYTE             RegionGadget;     /* Region gadget setting for this buffer
  252.                                           (PRIVATE) */
  253.    UBYTE             pad2;
  254.  
  255.    /*
  256.     * These are used by Loaders to store what kind of file the buffer
  257.     * was before it was loaded.  It stores an Amiga ViewModes.
  258.     * These are not currently used for anything.
  259.     */
  260.    ULONG             OriginalModes;    /* ViewModes before turned into 24-bit */
  261.    ULONG             OriginalDepth;    /* Depth of image before 24-bit */
  262.  
  263.    /*
  264.     * ImageFX now uses the UserData fields internally (sorry).
  265.     *
  266.     * UserData1 is used to store MAGIC information if ExtFlags & XBUFF_EXTERNAL.
  267.     * UserData2 is used in conjunction with undo buffers.
  268.     *
  269.     */
  270.    ULONG             PrivateData1,     /* (DO NOT USE) */
  271.                      PrivateData2;     /* (DO NOT USE) */
  272.  
  273.    char              ANNO[96];         /* ANNO chunk - currently unused */
  274.  
  275.    short             ViewLeft,         /* Preview containing box */
  276.                      ViewTop,
  277.                      ViewWidth,
  278.                      ViewHeight;
  279.  
  280.    UWORD             RowsPerPage;      /* Scanlines per VMEM page */
  281.    UWORD             pad3;
  282.  
  283.    struct MinList   *AirUndo;          /* (private) */
  284.    struct BufNode   *MNode;            /* (private) */
  285.  
  286.    char              SaveFormat[32];   /* Name of save format to use when
  287.                                           the user just selects SAVE.  This
  288.                                           must be set by the loader module
  289.                                           when the buffer is created.  If
  290.                                           empty, then ILBM is assumed. */
  291.    LONG              SaveID;           /* ID that is also passed to the
  292.                                           saver module to identify the
  293.                                           format of the file */
  294.  
  295.    LONG              ZoomLevel;        /* 2.0: Zoom level - positive is
  296.                                           zoomed in, negative is zoomed
  297.                                           out.  (z >= 1 || z <= -2) */
  298.  
  299.    APTR              UserData;         /* User data, untouched by ImageFX */
  300.  
  301.    LONG              Reserved[30];     /* Buffer struct is bigger in 2.0! */
  302. };
  303.  
  304.  
  305. /*
  306.  * Flag bits:
  307.  */
  308. #define BUFF_DISK    0x01              /* Buffer maintained on disk */
  309. #define BUFF_MOD     0x02              /* Buffer is modified (UNUSED) */
  310. #define BUFF_BRUSH   0x04              /* This buffer is a brush */
  311. #define BUFF_UNDO    0x08              /* This is an undo buffer */
  312. #define BUFF_COPY    0x10              /* Private! */
  313. #define BUFF_PEN     0x20              /* This brush is really a pen */
  314.  
  315. #define BUFF_FORCEDISK 0x40            /* (internal use only) */
  316. #define BUFF_NOVMEM  0x80              /* Passed to AllocBuffer disallows virtual memory */
  317.  
  318. /*
  319.  * ExtFlag bits:
  320.  */
  321. #define XBUFF_EXTERNAL     0x01        /* This buffer has been IMPORT'ed or is MAGIC */
  322. #define XBUFF_OUTSTANDING  0x02        /* Outstanding locked vmem page */
  323. #define XBUFF_THUMBNAIL    0x04        /* 2.0:  Thumbnail buffer (private) */
  324. #define XBUFF_PRIVATE      0x80        /* DO NOT TOUCH! */
  325.  
  326. /*
  327.  * BufNode (2.0):
  328.  *
  329.  * Multiple buffers and brushes a maintained as a list of BufNode
  330.  * structures.  (For backwards compatibility reasons, we can't use
  331.  * Buffer->Node.)
  332.  *
  333.  */
  334. struct BufNode
  335. {
  336.    struct Node       Node;
  337.    struct Buffer    *Buffer;
  338. };
  339.  
  340.  
  341. /*
  342.  * SepInfo:
  343.  *
  344.  * Used internally by the color separation routines.
  345.  *
  346.  */
  347. struct SepInfo
  348. {
  349.    LONG     UCR,
  350.             GCR,
  351.             Magenta,
  352.             Yellow;
  353.    LONG     Type;
  354.    LONG     Plane;
  355.    LONG     Depth;
  356.    LONG     CMAP;
  357. };
  358.  
  359. /*
  360.  * SepBuf:
  361.  *
  362.  * Used internally by the color separation routines.
  363.  *
  364.  */
  365. struct SepBuf
  366. {
  367.    UBYTE   *Planes[32];
  368.    ULONG    PlaneSize;
  369.    UWORD    Width, Height;
  370.    UBYTE    Depth;
  371.    UBYTE    Bits;
  372.    UBYTE    Plane;
  373.    UBYTE    Flags;
  374.    UWORD    MapSize;
  375.    UBYTE   *ColorMap[4];
  376.    WORD     AspectX, AspectY;
  377.    WORD     DPIX, DPIY;
  378. };
  379.  
  380. /* Type of separation: */
  381. #define SEP_CMYK     (0)
  382. #define SEP_CMY      (1)
  383. #define SEP_RGB      (2)
  384.  
  385. /* Output colormap: */
  386. #define SEP_GREY     (0)
  387. #define SEP_COLOR    (1)
  388.  
  389. /* Depth: */
  390. #define SEP_24BIT    (0)
  391. #define SEP_12BIT    (1)
  392.  
  393. /* Flags: */
  394. #define SEP_QUIET    (0x01)         /* No edit window */
  395. #define SEP_1PLANE   (0x02)         /* Only output 1 plane */
  396. #define SEP_CHUNKY   (0x04)         /* Output chunky planes instead of bitplanes */
  397.  
  398.  
  399. #define SCAN_BUF_H
  400. #endif
  401.