/* Retina Includes for VDPaint, Thomas Dorn for Macro-Systems */

#define SEGMENTSIZE           64*1024

/* ; modes for Retina_WriteRect(), ... */

#define RECTMODE_RGB          0
#define RECTMODE_RGBA         1
#define RECTMODE_BGR          2                  /* ;faster than MODE_RGB */
#define RECTMODE_GB_R         3                  /* ;for VDPaint only, do NOT use */
#define RECTMODE_256          4
#define RECTMODE_GB_R0        5                  /* ;for VDPaint only, do NOT use */

#define RDM_JAM1       0		/* Für SetDrMd(Screen, Mode) */
#define RDM_COMPLEMENT 2		/* Invertiert */

/* ;--------------------------------------------------------------------------- */
/* ; Tagitems for SetSprite() or SpriteFunction(): */

#define RSP_On                TAG_USER+1
#define RSP_Color0            TAG_USER+2
#define RSP_Color1            TAG_USER+3
#define RSP_ZoomX             TAG_USER+4
#define RSP_ZoomY             TAG_USER+5         /* ;ignored by SpriteFunction() */

/* ;--------------------------------------------------------------------------- */
/* ; flag definitions for _nrm_Flags: */

#define MDF_DBL 1	/* 1 = Double-Scan */
#define MDF_LACE 2	/* 1 = Interlace */
#define MDF_CLKDIV2 4	/* 1 = 1/2 Pixelclock benutzen */


struct NewRetinaMonitor
{
               LONG      _nrm_MonitorID;
               LONG      _nrm_PixelClock;
               BYTE      _nrm_AtntMode;
               BYTE      _nrm_Flags;

               WORD      _nrm_StdWidth;
               WORD      _nrm_StdHeight;
               WORD      _nrm_MaxWidth;
               WORD      _nrm_MaxHeight;

               WORD      _nrm_HBStart;
               WORD      _nrm_HSStart;
               WORD      _nrm_HSEnd;
               WORD      _nrm_HBEnd;
               WORD      _nrm_HTotal;

               WORD      _nrm_VBStart;
               WORD      _nrm_VSStart;
               WORD      _nrm_VSEnd;
               WORD      _nrm_VBEnd;
               WORD      _nrm_VTotal;
};

/* ;--------------------------------------------------------------------------- */
struct RetinaMonitor
{
               struct Node _rm_Node;

               LONG      _rm_MonitorID;

               LONG      _rm_HFrequency;
               LONG      _rm_VFrequency;

               WORD      _rm_BytesPerPixel;

               WORD      _rm_StdWidth;
               WORD      _rm_StdHeight;
               WORD      _rm_MaxWidth;
               WORD      _rm_MaxHeight;
};

/*
;---------------------------------------------------------------------------
*/

#define RSCR_MINWIDTH    13
#define RSCR_MAXHEIGHT   1
#define RSCR_STDWIDTH    0xffff
#define RSCR_STDHEIGHT   0xffff
#define RSCR_MAXWIDTH    0xfffe
#define RSCR_MAXHEIGHT   0xfffe

/* ; Tagitems for RetinaOpenScreen: */

#define RSA_BitMap            TAG_USER+1         /* ;use this BitMap */
#define RSA_DBufBitMap        TAG_USER+2         /* ;not supported yet */
#define RSA_ErrorCode         TAG_USER+3         /* ;return an error code */
#define RSA_IDMask            TAG_USER+4         /* ;for internal use only */

/* ; values for RSA_ErrorCode: */

#define ROSERR_NONE           0   /* ; everything ok or unknown error       */
#define ROSERR_ID             1   /* ; unknown monitor-ID                   */
#define ROSERR_DEFAULTID      2   /* ; unknown default monitor-ID           */
#define ROSERR_TOOBIG         3   /* ; screen size is too big               */
#define ROSERR_NOMEM          4   /* ; couldn't get normal memory           */
#define ROSERR_NORETINAMEM    5   /* ; couldn't get Retina graphics memory  */

/* ; Flags for _rs_Flags: */

#define RSFF_DONTCLEARONOPEN 1
#define RSFF_DONTCLEARONCLOSE 2
#define RSFF_DOUBLEBUFFER 4
#define RSFF_CUSTOMBITMAP 8
#define RSFF_CUSTOMDBUFBITMAP 16             /* ;currently not supported      */
#define RSFF_AUTOADJUST 32                   /* ;currently not fully supported */
#define RSFF_OPENBEHIND 64

struct RetinaScreen 		/* ,LN_SIZE          ;ListNode for internal use only */
{
    struct Node xy;
               WORD      _rs_Width;          /* ;number of pixels in one horizontal line */
               WORD      _rs_Height;         /* ;number of lines */
               LONG      _rs_BitMap;         /* ;the screen's address in Retina memory */
               LONG      _rs_DBufBitMap;     /* ;used for double buffered screens */

               LONG      _rs_Flags;

               /* LABEL     _rs_APen; */
               BYTE      _rs_APenA_reserved; /* ;reserved for alpha channel support */
               BYTE      _rs_APenR;          /* ;the red component (true color only) */
               BYTE      _rs_APenG;          /* ;the green component (true color only) */
               /* LABEL     _rs_APen256; */        /* ;the number of the palette register */
                                             /* ;  on a 256 color screen */
               BYTE      _rs_APenB;          /* ;  or the blue component (true color) */

               BYTE      _rs_DrawMode;       /* ;RP_JAM1, ... */
};

/*                ALIGNLONG */
/*                LABEL     _rs_PUBSIZE        ;never use this! */
/* ;--------------------------------------------------------------------------- */
/* ; These are the currently available Mode-ID's you need for OpenScreen() */

#define MID_DEFAULT_08        -1
#define MID_DEFAULT_16        -2
#define MID_DEFAULT_24        -3

#define MID_UNKNOWN           0

/* ;--------------------------------------------------------------------------- */
/* ; the public-part of vlab.library */

struct RetinaBase
{
    struct Library xy;
    APTR      _rb_FirstScreen;
    APTR      _rb_FrameCount;

    /* LABEL   _rb_PUBSIZE           ; you should never use this */
};

/* ; subsequent fields in the library base are VLAB PRIVATE */
/* ;--------------------------------------------------------------------------- */
