#ifndef ARTISTTOOLS_H
#define ARTISTTOOLS_H

#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif

#ifndef OPALLIB_H
#include "opal/opallib.h"
#endif


#ifndef	LIBRARIES_DOS_H
#include "libraries/dos.h"
#endif


/* This is a Read Only structure containing some
 * useful functions needed by brushes.
 */

struct AToolInfo
	{ USHORT OPVersion;
	  USHORT OPRevision;
	  struct OpalScreen *DispScrn;
	  struct OpalScreen *FullImage;
	  struct SetUp *SetUp;
	  struct OpalBase *OpalBase;
	  SHORT PenRed,PenGreen,PenBlue;
	  struct DModeInfo *DModeInfo;

	  void (*Render_Circular_Brush) (SHORT x, SHORT y);
	  void (*Render_Rectangular_Brush) (SHORT x, SHORT y);
	  void (*OneColour_WritePixel) (SHORT x,SHORT y);
	  void (*OneColour_ClearPixel) (SHORT x,SHORT y);
	  void (*OneColour_XORPixel) (SHORT x,SHORT y);
	  void (*OneColour_PutCircle) (SHORT x,SHORT y);
	  void (*OneColour_ClearCircle) (SHORT x,SHORT y);
	  void (*OneColour_XORCircle) (SHORT x,SHORT y);
	  void (*OneColour_PutRectangle) (SHORT x,SHORT y);
	  void (*OneColour_ClearRectangle) (SHORT x,SHORT y);
	  void (*OneColour_XORRectangle) (SHORT x,SHORT y);
	  void (*Display_ReadPixel) (SHORT x, SHORT y, UBYTE *R, UBYTE *G, UBYTE *B);
	  void (*Undo_ReadPixel) (SHORT x, SHORT y, UBYTE *R, UBYTE *G, UBYTE *B);
	  void (*Render_Func) (SHORT x, SHORT y, UBYTE R, UBYTE G, UBYTE B, UBYTE Trans);
	  void (*Set_RenderMode) (enum DrawModes DMode);
	  void (*Set_Draw_Tool) (enum ToolTypes Tool);
	  void (*Restore_RenderMode) (void);
	  void (*Set_Brush_Trans) (UBYTE Trans);
	  UBYTE (*Paper_Depth) (SHORT x, SHORT y);
	  void (*RGB_to_HSV) (SHORT R,SHORT G,SHORT B,USHORT *H, USHORT *S,USHORT *V);
	  void (*RGB_to_V) (SHORT R,SHORT G,SHORT B,USHORT *V);
	  void (*RGB_to_SV) (SHORT R,SHORT G,SHORT B,USHORT *S,USHORT *V);
	  void (*HSV_to_RGB) (ULONG H,ULONG S,ULONG V,UBYTE *R,UBYTE *G,UBYTE *B);
	  BOOL (*Build_Request) (SHORT Width,SHORT Height,SHORT Flags,struct IntuiText *Text,
		struct Gadget *OtherGads,void (*GadgetFunc)(),
		void (*InitFunc)(),void (*MMFunc)(),SHORT HelpX,SHORT HelpY,
		STRPTR BaseName, STRPTR *Context);
	  void (*User_Message) (char *Mess);
	  BOOL (*Ask_User) (char *Mess);
	  BOOL (*File_Req) (char *Hail,char *Extension, char *Path, char *FileName);
	  void (*OPEndRequest)(void);
	  struct Screen *OpalScreen;
	  struct Window *OpalWindow;
	  void (*Refresh_Menu)(void);
	  BOOL (*Build_Req_Tags) (struct TagItem *tagList);
	};

/* When loaded, the requested shape for the brush
 * is passed in 'Type'. You may choose to ignore this
 * value, however the actual type must be placed
 * in type on setup.
 */

struct AToolConfig
	{ ULONG Flags;
	  SHORT Width,Height;		/* Brush Size		*/
	  SHORT MaxWidth,MaxHeight;
	  SHORT HandleX,HandleY;	/* Handle position	*/
	  SHORT Type;			/* Put brush shape here */
	  USHORT Weight;
	  USHORT Speed;
	  SHORT Variant;
	  SHORT Pressure;		/* not used */
	  BPTR Segment;
	  char ToolName[30];
	  ULONG DModeFlags;	/* No flags used at present */

		/* These pointers MUST be intialised */
	  SHORT NumVariants;
	  char **VariantText;
	  void (*Reset_Brush) (void);
	  void (*New_Stroke) (void);
	  void (*CleanUp) (void);
	  void (*Render_Brush) (SHORT x, SHORT y);
	  void (*OneColour_PutBrush) (SHORT x, SHORT y);
	  void (*OneColour_XORBrush) (SHORT x, SHORT y);
	  void (*Stencil_PutBrush) (SHORT x, SHORT y);
	  void (*Stencil_ClearBrush) (SHORT x, SHORT y);
	  void (*Resize_PutBrush) (SHORT x, SHORT y);
	  void (*PlaceHandle_PutBrush) (SHORT x, SHORT y);
	  void (*DMode_OverRide) (SHORT x, SHORT y, SHORT R, SHORT G, SHORT B);
	  void (*DMode_NewBrush) (SHORT x, SHORT y);
	  void (*DMode_NewStroke) (void);
	  void (*ATool_Options) (void);
	  struct AToolInfo *AToolInfo;
	  USHORT ToolVersion;	/* version of opalpaint tool was written for */
	  USHORT ToolRevision;

	  ULONG TabletFlags;
	  ULONG Pen_AngleX;	/* Pen tilt value */
	  ULONG Pen_AngleY;
	  ULONG Pen_AngleZ;
	  ULONG	Pen_Pressure;
	};


	/* Brush Types  */
#define ATT_RECTANGULAR	1
#define ATT_CIRCULAR	2
#define ATT_VERTICAL	3
#define ATT_HORIZONTAL	4

	/* Brush Flags */
#define ATF_NEEDTRANS	0x1	/* Brush uses transparency modulation */
#define ATF_NOHANDLE	0x2
#define ATF_AUTOREPEAT	0x4
#define ATF_MODWEIGHT	0x8
#define ATF_MODSIZE	0x10
#define ATF_NOSIZEMOD	0x20
#define ATF_NOWEIGHTMOD	0x40
#define ATF_ALLOWBYPASS 0x80
#define ATF_BOOTUP	0x100
#define ATF_MODDMODE	0x200
#define ATF_BUILDUP	0x400		/* Override for the Brush Build up prefs */
#define ATF_MODTRANS	0x800
#define ATF_MODALPHA	0x1000


	/* Tablet Flags */

#define TAB_PRESSVALID	0x1
#define TAB_ANGLEXVALID	0x2
#define TAB_ANGLEYVALID	0x4
#define TAB_ANGLEZVALID	0x8
#define TAB_INPROXIMITY	0x10

#endif

