 ifnd LIBRARIES_PERSONAL_IO_I
LIBRARIES_PERSONAL_IO_i set 1
*
**  $VER: personal_io.h 5.0 (22.5.96)
**  Includes Release 5.0
**
**  Interface definitions for PersonalIO applications.
**
**  Copyright © 1995, 1996 Cloanto Italia srl
**	    All Rights Reserved
*
 ifnd EXEC_TYPES_I
 include "exec/types.i"
 endc

 ifnd GRAPHICS_GFX_I
 include "graphics/gfx.i"
 endc

IOLIB_VERSION equ 5	  ; current interface version


*
*  Picture type description structure
*
 STRUCTURE DataInfo,0

	WORD  di_Version	    ;* client program interface version
	ULONG di_Code		   ;* picture type code
	ULONG di_Flags		   ;* attributes
	ULONG di_ProcessData	   ;* data items processable
	LONG  di_Priority	   ;* sort priority
	STRUCT di_Name,40	   ;* full name
	STRUCT di_ShortName,16	   ;* short name
	STRUCT di_FileSuffix,3*16  ;* file name suffixes ('.' included)
	APTR   di_HandshakeText    ;* handshaking string
	STRUCT di_pad,28
 LABEL DataInfo_SIZEOF

;* DataInfo Code
DIC_ANYDATA equ  $FFFFFFFF     ;* Load operations (PictureInfo.Data.Code):
				;* the client program is asking
				;* for any picture type to be loaded.

;* DataInfo Flags
DIF_LOAD      equ  $00000001  ;* planar images can be loaded
DIF_LOAD_24   equ  $00000002  ;* 24bit chunky images can be loaded
DIF_SAVE      equ  $00000004  ;* planar images can be saved
DIF_SAVE_24   equ  $00000008  ;* 24bit chunky images can be saved
DIF_LOADFILE  equ  $00000010  ;* the data are read from file
DIF_SAVEFILE  equ  $00000020  ;* the data are written to file
DIF_RECOGNIZE equ  $00000040  ;* image files can be recognized
DIF_ENCRYPTED equ  $00000080  ;* the data are encrypted
DIF_CUSTOMIO  equ  $00000100  ;* custom file I/O
DIF_LOADOPTS  equ  $00000200  ;* options for ReadPicture()
DIF_SAVEOPTS  equ  $00000400  ;* options for WritePicture()
DIF_SELFLOPT  equ  $00000800  ;* custom load-options handling
DIF_SELFSOPT  equ  $00001000  ;* custom save-options handling
DIF_CONVERTED equ  $00002000  ;* the data come from a foreign library

;* DataInfo ProcessData
PCDT_FORMAT  equ   $00000001  ;* Width, Height, Depth
PCDT_IMAGE   equ   $00000002  ;* BitMap
PCDT_MASK    equ   $00000004  ;* MaskPlane
PCDT_PALETTE equ   $00000008  ;* Palette
PCDT_PRJINFO equ   $00000010  ;* ProjInfo
PCDT_DPI     equ   $00000020  ;* HorizDPI, VertDPI
PCDT_DISPID  equ   $00000040  ;* DisplayID
PCDT_HANDLE  equ   $00000080  ;* HandleX, HandleY
PCDT_EDGES   equ   $00000100  ;* LeftEdge, TopEdge
PCDT_SRCDIM  equ   $00000200  ;* SourceWidth, SourceHeight
PCDT_TRANSPT equ   $00000400  ;* TranspType
PCDT_TRANSPC equ   $00000800  ;* TransparentColor


*
*   Picture data/resource structure
*
 STRUCTURE PictureInfo,0

;	 /*
;	  *  Section 1: I/O information
;	  */
	WORD  pti_Version		    ;* client program interface version
	APTR  pti_FileName		  ;* file being read/written
	STRUCT pti_FileHead,128 	   ;* first bytes from file
	STRUCT pti_Data,DataInfo_SIZEOF 	 ;* picture type selected
	ULONG pti_ProcessData		   ;* data to read/write
	ULONG pti_ProcessedData 	   ;* data read/written
	ULONG pti_Flags 		   ;* unused
	APTR  pti_Parameters		   ;* unused
	APTR  pti_User1
	APTR  pti_User2
	APTR  pti_User3      ;* user extensions

;	 /*
;	  *  Section 2: picture information
;	  */
	WORD pti_Width
	WORD pti_Height 	    ;* image width and height
	UBYTE pti_Depth 		   ;* image depth (bits per pixels)
	UBYTE pti_pad1
	WORD pti_HandleX
	WORD pti_HandleY	  ;* handle (hot spot)
	WORD pti_HorizDPI
	WORD pti_VertDPI	 ;* ratio (dots per inch)
	WORD pti_LeftEdge
	WORD pti_TopEdge	 ;* source coordinates
	WORD pti_SourceWidth
	WORD pti_SourceHeight ;* source format
	UBYTE pti_TranspType		   ;* transparency type
	UBYTE pti_TransparentColor	   ;* transparent color
	ULONG pti_DisplayID		   ;* screen display mode
	STRUCT pti_pad2,4*10

;	 /*
;	  *  Section 3: picture resources
;	  */
	APTR pti_BMap		 ;* image bitmap
	APTR pti_MaskPlane	       ;* stencil/alpha plane
	APTR pti_Palette	  ;* color palette
	APTR pti_ProjInfo   ;* project information
	STRUCT pti_pad3,10*4

;	 /*
;	  *  Section 4: preview information
;	  */
	UBYTE pti_PreviewDepth		   ;* preview screen depth
	UBYTE pti_pad4
	APTR  pti_PreviewPalette   ;* preview screen colors (HAM)
	ULONG pti_PreviewDisplayID	   ;* preview screen mode (HAM)
	STRUCT pti_pad5,4*10;

;	 /*
;	  *  Section 5: client program information
;	  */
	LONG  pti_UILanguage		   ;* active language
	APTR  pti_LibUIText		 ;* IO library strings
	STRUCT pti_pad6,4*10

;	 /*
;	  *  Section 6: library bases
;	  */
	APTR pti_SysBase
	APTR pti_DOSBase
	APTR pti_GfxBase
	APTR pti_IntuitionBase
	APTR pti_IconBase
	STRUCT pti_pad7,4*10

;	 /*
;	  *  Section 7: function pointers
;	  */
 ifne 0
	BOOL  (*ReadFile) (UBYTE *buffer, LONG bytes);          ; functions
	BOOL  (*WriteFile) (UBYTE *buffer, LONG bytes);
	LONG  (*SeekFile) (WORD mode, LONG bytes);
	BOOL  (*BumpProgress) (void);
	UBYTE (*FastReadPix) (struct BitMap *bmap, WORD x, WORD y);
	void  (*FastWritePix) (struct BitMap *bmap, WORD x, WORD y, UBYTE col);
	void  (*ChunkyToBMap) (UBYTE *pixbuf, struct BitMap *bmap, LONG offs);
	void  (*CommentToProjInfo) (UBYTE *buffer, struct ProjectInfo *pinfo);
	BOOL  (*ProjInfoToComment) (struct ProjectInfo *pinfo, UBYTE *buffer, WORD maxsize, BOOL do_auth, BOOL do_cpyr, BOOL do_note);
	UBYTE (*CryptKeyChar) (BOOL reset);
	WORD  (*CryptKeySign) (void);
	void  (*PreviewRow) (struct BitMap *bmap, WORD y);
	struct BitMap *(*CreateBitMap)(WORD width, WORD height, UBYTE depth, UWORD flags);
	void  (*DeleteBitMap)(struct BitMap *bmap);
	;* V4 functions
	UBYTE *(*GetProjectInfo) (struct ProjectInfo *pinfo, WORD type);
	BOOL  (*SetProjectInfo) (struct ProjectInfo *pinfo, WORD type, UBYTE *string);
	BOOL  (*ProjectInfoToComment) (struct ProjectInfo *pinfo, UBYTE *buffer, WORD maxsize, ULONG do_flags);
 endc
    APTR pti_ReadFile
    APTR pti_WriteFile
    APTR pti_SeekFile
    APTR pti_BumpProgress
    APTR pti_FastReadPix
    APTR pti_FastWritePix
    APTR pti_ChunkyToBMap
    APTR pti_CommentToProjinfo
    APTR pti_CryptKeyChar
    APTR pti_CryptKeySign
    APTR pti_PreviewRow
    APTR pti_CreateBitmap
    APTR pti_DeleteBitMap
    APTR pti_GetProjectInfo
    APTR pti_SetProjectInfo
    APTR pti_ProjectInfoToComment
 LABEL PictureInfo_SIZEOF
;*
;*   Option structure
;*
 STRUCTURE DataOption,0
	WORD   dto_Version	    ;* client program interface version
	WORD   dto_Type 	    ;* option type
	STRUCT dto_Name,40	    ;* option name
	LONG   dto_UITextStr	    ;* client program user interface text
	ULONG  dto_Flags	    ;* attributes
	LONG   dto_Value	    ;* current value
	LONG   dto_Min
	LONG   dto_Max
	LONG   dto_Default	    ;* minimum, maximum and default values
	STRUCT dto_String,80	    ;* current string
	STRUCT pad,32
 LABEL	       DataOption_SIZEOF

;* DataOption Type
DOT_INTSTR   equ   0  ;* integer value (string gadget)
DOT_INTSLIDE equ   1  ;* integer value (proportional gadget)
DOT_10000STR equ   2  ;* value in 1/10000s (string gadget)
DOT_BOOL     equ   3  ;* boolean value (checkbox gadget)
DOT_STRING   equ   4  ;* string (string gadget)
DOT_COLSLIDE equ   5  ;* depth value (proportional gadget)

;* DataOption UITextStr
DOUI_WIDTH   equ   0  ;* Width:
DOUI_HEIGHT  equ   1  ;* Height:
DOUI_DEPTH   equ   2  ;* Depth:
DOUI_COLUMNS equ   3  ;* Columns:
DOUI_ROWS    equ   4  ;* Rows:
DOUI_COMPR   equ   5  ;* Compression:
DOUI_MAXCOMP equ   6  ;* Max Compression:
DOUI_QUALITY equ   7  ;* Quality:
DOUI_SMOOTH  equ   8  ;* Smooth:
DOUI_SCRFMT  equ   9  ;* Screen Format:
DOUI_PROGDSP equ   10 ;* Progressive Display:
DOUI_AUTO    equ   11 ;* Automatic:
DOUI_PADBYTE equ   12 ;* Pad Byte:
DOUI_BINARY  equ   13 ;* Binary:
DOUI_FORMAT  equ   14 ;* Format:
DOUI_COLORS  equ   15 ;* Colors:
DOUI_GRAINNS equ   16 ;* Graininess:
DOUI_RSEED   equ   17 ;* Random Seed:
DOUI_GRAYS   equ   18 ;* Gray shades:
DOUI_CMPTIB  equ   19 ;* Compatibility:
DOUI_PARAM1  equ   20 ;* Parameter 1:
DOUI_PARAM2  equ   21 ;* Parameter 2:
DOUI_PARAM3  equ   22 ;* Parameter 3:
DOUI_NONE    equ   -1

;* DataOption Flags
DOF_LOADOPTION equ $00000001  ;* ReadPicture() option



*
*   Color palette structure
*
 STRUCTURE Color,0
	UBYTE col_Red
	UBYTE col_Green
	UBYTE col_Blue		   ;* color components
	UBYTE col_EFlag 	   ;* unused
 LABEL Color_SIZEOF

*
*   Project information structure
*
*   Note: This information must be accessed directly up to version 3 of
*   the client I/O interface, and must instead be accessed via the
*   GetProjectInfo() and SetProjectInfo() functions starting from clients
*   having version 4 or higher.
*
PRJINF_AUTSIZE	 equ 80
PRJINF_COPYRSIZE equ 80
PRJINF_ANNOTSIZE equ 80

 STRUCTURE ProjectInfo,0
	UWORD pri_FromFile   ;* private: do not change
	STRUCT pri_Author,PRJINF_AUTSIZE
	STRUCT pri_Copyright,PRJINF_COPYRSIZE
	STRUCT pri_Annotation,PRJINF_ANNOTSIZE
	;* V4: Data beyond this point!
 LABEL ProjectInfo_SIZEOF

;* SetProjectInfo() type
AUTHOR_INFO	equ 0
COPYRIGHT_INFO	equ 1
ANNOTATION_INFO equ 2

;* ProjectInfoToComment() do_flags
AUTHOR_INFOF	    equ    (1<<0)
COPYRIGHT_INFOF     equ    (1<<1)
ANNOTATION_INFOF    equ    (1<<2)

;* SeekFile() mode
SKF_ABSOLUTE	   equ	   0	   ; seek from position 0
SKF_FROMCURR	   equ	   1	   ; seek from current position

;* FastReadPix() FastWritePix() x
FBMP_INIT    equ   -1	   ;* initialize bitmap reading/writing
FBMP_FLUSH   equ   -2	   ;* flushes row buffer (FastWritePix())

;* CreateBitMap() flags
CB_CLEAR   equ	   $0001  ;* clear all bitmap memory
CB_CLEAN   equ	   $0002  ;* clear unused (rightmost) bitmap memory
CB_KEEPWB  equ	   $0004  ;* do not use virtual memory
CB_ANYMEM  equ	   $0008  ;* use any memory
CB_FASTMEM equ	   $0010  ;* use fast memory only
CB_LONGW   equ	   $0020  ;* BytesPerRow forced to a multiple of 4
CB_CHIPMEM equ	   $0040  ;* use chip memory only

*
* SetOption(dinfo, SOPT_SELFLOPT) activates
* the library load-option interface (DIF_SELFLOPT picture types only)
*
SOPT_SELFLOPT equ 0

*
* SetOption(dinfo, SOPT_SELFSOPT) activates
* the library save-option interface (DIF_SELFSOPT picture types only)
*
SOPT_SELFSOPT equ  $FFFFFFFF

*
*  GetPictureInfo(), ReadPicture(), WritePicture() return codes
*
PIOERR_OK	equ 0  ;* no error / file recognized
PIOERR_CANCEL	equ 1  ;* user cancelled
PIOERR_PARTIAL	equ 2  ;* image data partially loaded
PIOERR_BADVER	equ 3  ;* a newer interface version is required
PIOERR_BADTYPE	equ 4  ;* file not recognized
PIOERR_FILE_ERR equ 5  ;* file I/O error
PIOERR_NODATA	equ 6  ;* the file does not contain the required data
PIOERR_NOMEMORY equ 7  ;* not enough memory
PIOERR_NODECRYP equ 8  ;* decryption impossible
PIOERR_UIMGTYP	equ 9  ;* unsupported image type
PIOERR_UKCMPR	equ 10 ;* uncknown compression
PIOERR_BADDATA	equ 11 ;* error in file data


*
*  Picture type and option storage structures
*
*  Note: these are not part of the library interface, but instead
*	 are just a storage system for library implementations.
*
 STRUCTURE DataInfoEntry,0
	ULONG die_Code		   ;* picture type code
	ULONG die_Flags 	   ;* attributes
	ULONG die_ProcessData	   ;* data items processable
	LONG  die_Priority	   ;* sort priority
	APTR  die_Name		   ;* full name
	APTR  die_ShortName	   ;* short name
	STRUCT die_FileSuffix,4*3  ;* file name suffixes ('.' included)
 LABEL DataInfoEntry_SIZEOF

 STRUCTURE DataOptionEntry,0
	WORD  doe_Type		   ;* option type
	APTR  doe_Name		   ;* option name
	LONG  doe_UITextStr	   ;* client program user interface text
	ULONG doe_Flags 	   ;* attributes
	LONG  doe_Value 	   ;* current value
	LONG  doe_Min
	LONG  doe_Max
	LONG  doe_Default	   ;* minimum, maximum and default values
	STRUCT doe_String,80	   ;* current string
 LABEL DataOptionEntry_SIZEOF
 ifne 0
*##base _PersonalIOBase
*##bias 30
*##public
*GetFirstDataInfo(datainfo)(A0)
*GetNextDataInfo(datainfo)(A0)
*GetPictureInfo(picinfo)(A0)
*GetProgressBumps(picinfo)(A0)
*ReadPicture(picinfo)(A0)
*WritePicture(picinfo)(A0)
*IOLibCleanup(picinfo)(A0)
*GetFirstOption(datainfo, option)(A0,A1)
*GetNextOption(datainfo, option)(A0,A1)
*SetOption(datainfo, option)(A0,A1)
*ResetOptions(datainfo)(A0)
*##private
*PersonalIOPrivate1()()
*PersonalIOPrivate2()()
*PersonalIOPrivate3()()
*##public
*##end
 endc
_LVOGetFirstDataInfo equ -30
_LVOGetNextDataInfo  equ -36
_LVOGetPictureInfo   equ -42
_LVOGetProgressBumps equ -48
_LVOReadPicture      equ -54
_LVOWritePicture     equ -60
_LVOIOLibCleanup     equ -66
_LVOGetFirstOption   equ -72
_LVOGetNextOption    equ -78
_LVOSetOption	     equ -84
_LVOResetOptions     equ -90
_LVOPersonalIOPrivate1 equ -96
_LVOPersonalIOPrivate2 equ -102
_LVOPersonalIOPrivate3 equ -108

 endc ;* LIBRARIES_PERSONAL_IO_I
