/*
 * Picture Header file.
 *
 * Author: Gregg A. Tavares
 *       : Echidna
 *   Date: January 11, 1989
 */

#ifndef PICTURE_H
#define PICTURE_H

#include <exec/types.h>
#include <graphics/rastport.h>
#include "rectcopy.h"

/*
** TYPE: CycleRange
**
** type to keep track of color cycling ranges like those used in DPaintII
*/
typedef struct {
   APTR		NextRange;
/* CycleRange	*NextRange; */
   WORD		pad1;   /* future exp - store 0 here */
   WORD		rate;   /* 60/sec=16384, 30/sec=8192, 1/sec=16384/60=273 */
   WORD		active; /* lo bit 0=no cycle, 1=yes; next bit 1=rvs */
   UBYTE	low;    /* range lower */
   UBYTE	high;   /* range upper */
   } CycleRange;

/*
** TYPE: Picture
**
** used to keep track of a picture or "image" with no transparency
*/

#define maxColorReg 32

typedef struct {
	struct	RastPort	RastPort;	/* Rastport for Picture	*/
	struct	BitMap		BitMap;		/* BitMap for Picture	*/
	WORD			Left;		/* Hot Spot		*/
	WORD			Top;		/* Hot Spot		*/
	WORD			Width;		/* Width in pixels	*/
	WORD			Height;		/* Height in pixels	*/
	UBYTE			Depth;		/* Depth in BitPlanes	*/
	UBYTE			TransparentColor; /* ---		*/
	WORD			NumberOfColors;	/* Num of colors loaded */
	UWORD			Colors[maxColorReg]; /* Colors		*/
	BOOL			CAMGFlag;	/* TRUE if CAMG found	*/
	ULONG			ViewModes;	/* ViewModes from CAMG	*/
	UBYTE			xAspect, yAspect; /* display aspect	*/
	WORD			pageWidth, pageHeight; /* page size	*/
	CycleRange		*CycleRanges;	/* Linked list of cycles*/
} Picture;

#define	PicWidth(pic)		((pic)->Width)
#define	PicHeight(pic)		((pic)->Height)
#define	PicDepth(pic)		((pic)->Depth)
#define	PicColorMap(pic)	((pic)->Colors)
#define	PicColors(pic)		((pic)->NumberOfColors)
#define	PicHotX(pic)		((pic)->Left)
#define PicHotY(pic)		((pic)->Top)
#define PicValidModes(pic)	((pic)->CAMGFlag)
#define	PicViewModes(pic)	((pic)->ViewModes)
#define	PicCycleRanges(pic)	((pic)->CycleRanges)
#define PicTColor(pic)		((pic)->TransparentColor)

/*
** TYPE: Shape
**
** keeps track of a Shape, an image with transparency
*/

typedef struct {
	struct RastPort	MaskRp;
	struct BitMap	MaskBm;
	Picture		*Pic;
} Shape;

#define ShapePic(shape)			((shape)->Pic)
#define	ShapeWidth(shape)		(PicWidth((shape)->Pic))
#define	ShapeHeight(shape)		(PicHeight((shape)->Pic))
#define	ShapeDepth(shape)		(PicDepth((shape)->Pic)
#define	ShapeColorMap(shape)		(PicColorMap((shape)->Pic))
#define ShapeColors(shape)		(PicColors((shape)->Pic))
#define	ShapeHotX(shape)		(PicHotX((shape)->Pic))
#define ShapeHotY(shape)		(PicHotY((shape)->Pic))
#define ShapeValidModes(shape)		(PicValidModes((shape)->Pic))
#define ShapeViewModes(shape)		(PicViewModes((shape)->Pic))
#define ShapeCycleRanges(shape)		(PicCycleRanges((shape)->Pic))

/*
** TYPE: NewImage
**
** Passed to image loading function when loading a picture
*/

#define	NI_GETCYCLES	(1L << 0)
#define NI_GETVIEWMODES	(1L << 1)
#define NI_GETCOLORS	(1L << 2)
#define NI_CREATEPIC	(1L << 3)
#define NI_USEBITMAP	(1L << 4)
#define NI_CLIPIMAGE	(1L << 5)
#define NI_CREATESHAPE	(1L << 6)

typedef struct {
	char	*Name;		/* filename of image			*/
	ULONG	Flags;		/* loading flags			*/
	APTR	ImagePtr;	/* Pointer to BitMap or RastPort	*/
	WORD	FLeft, FTop;	/* Position to load from		*/
	WORD	Left, Top;	/* Position to load at			*/
	WORD	Width, Height;	/* Amount to load			*/
} NewImage;

/*
** TYPE ImageRequest;
**
** Used to request a list of images.
*/
typedef struct {
} ImageRequest;

extern	UWORD		*LoadPic ();
extern	Picture		*CreatePic ();
extern	Shape		*CreateShape ();

#endif
