#ifndef PROOF_H
#define PROOF_H

/*
**	$VER: proof.h 1.0 (26.9.98)
**
**	Public structures and defintions for proof.library.
**
**	Trailing values:
**		B - Bit
**		F - Flag (bit value)
**		V - Value
*/

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

#ifndef DOS_DOS_H
#include <dos/dos.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

/*========================================================================*/
/* ProofHeader - Version */
#define PROOF_VERSION (1)

/* ProofHeader - BodyType */
#define PHBV_CUSTOM 0 /* Data in PBDY is in a user defined format */
#define PHBV_JFIF 1 /* Data in PBDY is in jfif format */

/*========================================================================*/
/* ProofDescription  - ImageType */
enum
{
	PDIV_UNKNOWN = 0, PDIV_ANIM, PDIV_BMP, PDIV_FAXX, PDIV_GIF, PDIV_ICON, PDIV_ILBM, PDIV_IFF24, PDIV_JPEG,
	PDIV_MACPAINT, PDIV_PBM, PDIV_PCD, PDIV_PCX, PDIV_PICT, PDIV_PNG, PDIV_POSTSCRIPT, PDIV_TARGA,
	PDIV_TIFF, PDIV_YCRCB, PDIV_YUVN, PDIV_SCREEN, PDIV_MPEG, PDIV_DATATYPE
};
// These MUST remain the same as image.library

/* ProofDescription - Format (bits/flags) */
#define PDFB_PLANAR 0
#define PDFB_CHUNKY 1
#define PDFB_HAM6 2
#define PDFB_HALFBRITE 3
#define PDFB_HAM8 4
#define PDFB_24BIT 5
#define PDFB_PALETTE 6
#define PDFB_GREY 7

#define PDFF_PLANAR (1L << PDFB_PLANAR) /* Image data is planar */
#define PDFF_CHUNKY (1L << PDFB_CHUNKY) /* Image data is chunky */
#define PDFF_HAM6 (1L << PDFB_HAM6) /* Image data is HAM6 */
#define PDFF_HALFBRITE (1L << PDFB_HALFBRITE) /* Image data is HALFBRITE */
#define PDFF_HAM8 (1L << PDFB_HAM8) /* Image data is HAM8 */
#define PDFF_24BIT (1L << PDFB_24BIT) /* Image data is 24bit */
#define PDFF_PALETTE (1L << PDFB_PALETTE) /* Image data is palette mapped */
#define PDFF_GREY (1L << PDFB_GREY) /* Image data is greyscale */

/* Flags/Depth example:

	NOTE: for planar images, the depth is the number of planes, not the
				number of colours.

	PDFF_PLANAR and 2 == 4 colour planar image

	PDFF_PLANAR | PDFF_HAM8 and 8 == 256 colour planar image in HAM8 mode.

	PDFF_CHUNKY and 24 == 24 Bit RGB pixels.

	PDFF_CHUNKY and 18 == 18 Bit RGB pixels.

	PDFF_PLANAR and 24 == 24 Bit planar (IFF24).

	If PDFF_PALETTE is set, then the image is palette mapped, eg gif

	If PDFF_GREY is set, the the image is greyscale and not colour.
*/

/* Image category:
	There are four groups.
	There are 22 bits reserved for categories.
	Each proof can be subscribed to ONE group and ANY number of categories.
*/

/*========================================================================*/
/* Proof structure */
struct Proof
{
	ULONG ptr; // Private!
};

/*========================================================================*/
/* ProofOwner */
struct ProofOwner
{
	ULONG ptr; // Private!
};

#define POWN_GROUP_NAME -1 /* Category number for a group name */

/*========================================================================*/
/* Proof tag values */
#define PFN_TB ( TAG_USER + 0x80000 )

/* ProofHeader tags */
#define PFN_ProofWidth (PFN_TB + 1) /* Height of proof (0..255) [ISG] (UBYTE *, UBYTE) */
#define PFN_ProofHeight (PFN_TB + 2) /* Width of proof (0..255) [ISG] (UBYTE *, UBYTE) */
#define PFN_ProofAspectX (PFN_TB + 3) /* X:Y aspect ratio of proof [ISG] (WORD *, WORD) */
#define PFN_ProofAspectY (PFN_TB + 4) /* X:Y aspect ratio of proof [ISG] (WORD *, WORD) */
#define PFN_ProofQuestionable (PFN_TB + 5) /* Equivilant to PHDF_QUESTIONABLE [ISG] (BOOL *, BOOL) */
#define PFN_ProofBodyType (PFN_TB + 6) /* Format to store proof image data [I] */
#define PFN_ProofBodyFlags (PFN_TB + 7) /* Additional flags for BodyType [ISG] */

/* ProofDescription tags */
#define PFN_ImageWidth (PFN_TB + 20) /* Height of original image [ISG] (ULONG *, ULONG) */
#define PFN_ImageHeight (PFN_TB + 21) /* Width of original image [ISG] (ULONG *, ULONG) */
#define PFN_ImageFileSize (PFN_TB + 22) /* File size of original image [ISG] (ULONG *, ULONG) */
#define PFN_ImageType (PFN_TB + 23) /* Pass in an ImageType [ISG] (UBYTE *, UBYTE) */
#define PFN_ImageDepth (PFN_TB + 24) /* Depth of original image [ISG] (UBYTE *, UBYTE) */
#define PFN_ImageGroup (PFN_TB + 25) /* Pass in a group (0..3) [ISG] */
#define PFN_ImageCategory (PFN_TB + 26) /* Pass in a category (22 bits) [ISG] */
#define PFN_ImagePlanar (PFN_TB + 27) /* Equivilant to TDSL_PLANAR [ISG] */
#define PFN_ImageChunky (PFN_TB + 28) /* Equivilant to TDSL_CHUNKY [ISG] */
#define PFN_ImageHAM6 (PFN_TB + 29) /* Equivilant to TDSL_HAM6 [ISG] */
#define PFN_ImageHalfBrite (PFN_TB + 30) /* Equivilant to TDSL_HALFBRITE [ISG] */
#define PFN_ImageHAM8 (PFN_TB + 31) /* Equivilant to TDSL_HAM8 [ISG] */
#define PFN_Image24Bit (PFN_TB + 32) /* Equivilant to TDSL_24BIT [ISG] */
#define PFN_ImageFormat (PFN_TB + 33) /* Bulk definitions of ProofDescription->Format. Pass in PDFF_? values [ISG] (UBYTE *, UBYTE) */
#define PFN_CategoryOwner (PFN_TB + 34) /* Category owner ID [ISG] (UBYTE *, UBYTE) */

/* LoadThumbnail() tags */
#define PFN_AllowPhotoAlbum PFN_TB + 40 /* Allow photoalbum jpeg thumbnail compatibilty [] (BOOL) */
#define PFN_TestProofByProtection PFN_TB + 41 /* If TRUE, use the protection bits to determine a proof file (negates PFN_AllowPhotoAlbum) [] (BOOL) */

/* SaveThumbnail() tags */
#define PFN_ImageName PFN_TB + 50 /* DOS filename of original image [ISG] (char **, char *) */
#define PFN_ImagePath PFN_TB + 51 /* Path of original image [ISG] (char **, char *) */
#define PFN_ImagePathName PFN_TB + 52 /* Path and name of original image; combines ImageName and ImagePath tags [IS] (char *) */
#define PFN_ProofPath PFN_TB + 53 /* Path to store proof [] */
#define PFN_Comment PFN_TB + 54 /* Comment associated with the proof [ISG] (char **, char *) */
#define PFN_DescriptionChunk PFN_TB + 55 /* Store a description chunk [] */
#define PFN_RGBTripletBuffer PFN_TB + 56 /* Points to rgb triplet source buffer [] */
#define PFN_CustomBuffer PFN_TB + 57 /* Points to source/dest buffer, for PHBV_CUSTOM [] (UBYTE **, UBYTE *) */
#define PFN_CustomBufferSize PFN_TB + 58 /* Size in bytes of custom buffer, for PHBV_CUSTOM [] (ULONG *, ULONG) */
#define PFN_JFIFQuality PFN_TB + 59 /* Quality of JFIF storage (passed onto jpeg.library) [] */

/* GetProofAttrs tags */
#define PFN_ProofPathName PFN_TB + 70 /* Path and name of proof [G] (char **) */
#define PFN_ProofVersion PFN_TB + 71 /* Version of proof structure [G] (UBYTE *) */
#define PFN_ProofSaveable PFN_TB + 72 /* Is this proof saveable [G] (BOOL *) */
#define PFN_TextImageType PFN_TB + 73 /* Returns pointer to a text descriptor of the original image [G] (char **) */
#define PFN_TextImageDesc PFN_TB + 74 /* Copies into the supplied pointer a text descriptor of the image format [G] (char *) */

/* Memory control tags */
#define PFN_MemoryPool PFN_TB + 80 /* All de/allocs are on this memory pool [] (void *) */

/* Miscellaneous tags */
#define PFN_UserData PFN_TB + 90 /* [ISG] Set/get user data */

/* ProofOwner tags */
#define PFN_ProofOwnerID PFN_TB + 100 /* Owner ID of this ProofOwner structure [ISG] (UBYTE *, UBYTE) */
#define PFN_ProofOwnerIdent PFN_TB + 101 /* An identification string for this ProofOwner structure [ISG] (char *, char **) */
#define PFN_ProofOwnerName PFN_TB + 102 /* The filename to save into [] (char *) */

/*========================================================================*/
/* Defined error return codes */
#define PFERR_NONE 0 /* No error */
#define PFERR_NOTPROOF 1 /* File is not a proof */
#define PFERR_NOIFFPARSELIBRARY 2 /* iffparse.library isn't available */
#define PFERR_NOIFFHANDLE 3 /* Can't allocate an IFF handle */
#define PFERR_FILEEXISTS 4 /* Destination file already exists */
#define PFERR_CANTCREATEFILE 5 /* Can't open destination file */
#define PFERR_CANTCREATEIFFFILE 6 /* Can't attach IFF stream handler */
#define PFERR_NOMEMORY 7 /* Can't allocate any memory */
#define PFERR_CANTOPENFILE 8 /* Can't open the specified file */
#define PFERR_BADIFFFORM 9 /* File has bad IFF structure - corrupted */
#define PFERR_NOSOURCEBUFFER 10 /* No source buffer supplied */
#define PFERR_NODESTBUFFER 11 /* No destination buffer pointer supplied */
#define PFERR_NOTCUSTOM 16 /* Body data is not in a custom format */
#define PFERR_CUSTOMBODY 17 /* Body data is in a custom format */
#define PFERR_MISSINGTARGET 18 /* Missing or NULL target object in source taglist */
#define PFERR_NOTLINKED 19 /* Proof does not contain a path link */
#define PFERR_NOPROOFPTR 20 /* No proof pointer supplied */
#define PFERR_CANTDECOMPRESS 21 /* Cant decompress the body data */
#define PFERR_CANTCOMPRESS 22 /* Cant compress the body data */
#define PFERR_NODESCRIPTOR 23 /* The proof hasnt got an image descriptor */
#define PFERR_INCOMPATABLE 24 /* The original file is not save compatable  */
#define PFERR_NOOWNERPTR 25 /* No proof owner pointer supplied */
#define PFERR_NOTOWNER 26 /* File is not a proof owner file */
#define PFERR_NOCATEGORYNAME 27 /* No category name supplied */
#define PFERR_NOFREECATEGORY 28 /* No free category bits available in this group */

#endif /* PROOF_H */
