/************************************************************
**
** Application: Snapper
**
** Title:       h.str
**
*************************************************************/

/*
*
* Copyright (c) 2017, David Pilling and Chris Johnson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*   * Redistributions of source code must retain the above copyright
*     notice, this list of conditions and the following disclaimer.
*   * Redistributions in binary form must reproduce the above
*     copyright notice, this list of conditions and the following
*     disclaimer in the documentation and/or other materials provided
*     with the distribution.
*   * Neither the name of the copyright holder nor the names of their
*     contributors may be used to endorse or promote products derived
*     from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/


#pragma include_only_once

#ifndef __STR__H
#define __STR__H



#define XMEMCPYX(a,b,c) (memmove((a),(b),(c)))

typedef struct boxstr
{
 int x;
 int y;
 int w;
 int h;
} boxstr;



typedef struct aboxstr
{
 int x0;
 int y0;
 int x1;
 int y1;
} aboxstr;



typedef struct zoomstr
{
 int mul;
 int div;
} zoomstr;


typedef struct spanstr
{
 int xlo;
 int xhi;


} spanstr;



typedef struct
{
 int flags;
 int pause;
 int xmul;
 int xdiv;
 int ymul;
 int ydiv;
 int cx;
 int cy;
 int copies;

 int box0;             /* box to put image in, os units  */
 int box1;             /* 0,1 bottom left hand corner    */
 int box2;             /* 2,3 top right hand corner      */
 int box3;

 int height;           /* real height in 72000'ths */
 int width;            /* real width in 72000'ths  */
} pset;




typedef struct docdatastr
{
 int width;
 int height;
 int xres;
 int yres;




} docdatastr;



#define CL_RGB   0
#define CL_CMYK  1
#define CL_GREY  2
#define CL_ALPHA 3


typedef struct ipalstr
{
 int word[256];
 int ncolours;
 int palclass;

} ipalstr;




typedef struct imagestr
{
 int               x;
 int               y;
 int               z;

 int               bpp;
 int               xpix;
 int               ypix;
 int               xdpi;
 int               ydpi;
 ipalstr           ipal;

 int               wwidth;  /* width in words */
 int               size;
 int               data[1];

} imagestr;



#define IM 0
#define AL 1


typedef struct ximagestr
{
 struct ximagestr * xnext;
 struct ximagestr * xprev;

 struct ximagestr * redo;
 struct ximagestr * undo;

 imagestr         * sim[2];

} ximagestr;




typedef struct infostr
{
 char * text;
 int    n;
 int    handle;
} infostr;



#define FRAMENAMELEN 32


typedef struct framestr
{
 int            offset;             /* offset in file of this image */
 char           name[FRAMENAMELEN];

 ximagestr    * xim;                /* stores raster form of frame */

 infostr        info;

 int            fbpp;               /* used for original values in file */
 int            mbpp;
 int            fxpix;              /* these values are not changed     */
 int            fypix;
 int            fxdpi;
 int            fydpi;
 /* cj added below */
 int            sptype;             /* to differentiate 32k and 64k colour sprite */
 int            spcolorder;         /* to differentiate rgb and bgr */
 int            spformat;           /* old, new RO 3.5, or new RO 5 */
} framestr;





#define FILENAMELEN 256


typedef struct filestr
{
 char             sname[FILENAMELEN];
 char             oname[FILENAMELEN];

 int              modded;             /* file modified ?       */

 struct filestr * next;               /* next file in chain    */
 struct filestr * prev;               /* prev file in chain    */


 int              framen;
 framestr       * frames;             /* array of frames       */
 void           * data;               /* array of private data for file type */
 pset             ps;
 int              width;
 int              height;
 int              type;

} filestr;





#endif



/*************  End of h.str  ***********************/





