/* **********************************************************************
 * *                                                                    *
 * *  Private header file for vtv package                               *
 * *                                                                    *
 * **********************************************************************
 * File: libs/vtv/vtv_def.h
 *
 *                COPYRIGHT (c) 1996, 1998, 2003  BY
 *          SIGMET INCORPORATED, WESTFORD MASSACHUSETTS, U.S.A.
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED.
 */

#ifdef VTV_LIB_ALLOCATE
#define EXTERN
#else
#define EXTERN extern
#endif

#define  MIN_VTV_FONTS  (1)           /* Minimum number of fonts required */
#define  MAX_VTV_IMAGES (10)          /* Max # simultaneous images */
#define  CHARACTERS_PER_FONT (256)

#define  UNDERLAY_DARKENING (180)     /* Unscanned areas darkened by this/256 */

/* Graphics context information (copying ideas from X) */
struct vtv_graphics_context
{
  UINT4 iforeground;                  /* Foreground color */
  UINT4 ifont;                        /* Font ID */
  UINT4 idotlp;                       /* 12-bit dotted line pattern */
  UINT4 iline_width;                  /* Width of line in pixels */
  UINT1 lColorsSet;                   /* Colors have been set */
  char  ipad_end[3];
};

struct vtv_one_glyph
{
  SINT4 iBBwidth;     /* Set to zero to indicate an unused slot */
  SINT4 iBBheight;
  SINT4 iBBoffsetX;
  SINT4 iBBoffsetY;
  SINT4 iDWidth;      /* Number of pixels to move to next character */
  SINT4 iWidthInBytes;
  UINT1 *pData;
};

struct vtv_font_def
{
  struct vtv_font_info Info;
  struct vtv_one_glyph Glyphs[CHARACTERS_PER_FONT];
};

/*
 * Each virtual TV screen is summarized by one of the following structures.
 */
struct  virtual_screen_info
{
  UINT4 ixsize, iysize;               /* Screen sizes */
  UINT1 *iaddr;                       /* Virtual address (0 --> Free slot) */
  UINT4 ibytes;                       /* # bytes in actual screen area */
  UINT4 ipages;                       /* Size of virtual memory area */
  struct vtv_graphics_context gc;     /* Graphics context to use */
  struct color_def Colormap[256];     /* Color map in current use */
};


EXTERN struct virtual_screen_info vsi_c[MAX_VTV_IMAGES];
EXTERN struct vtv_font_def Fonts_c[MAX_VTV_FONTS];

/* Function prototypes used internally within the driver */
void drop_shadow_kernel         /* File: csubs.c */
( UINT1 *addr_a, UINT4 ixsize_a,
 UINT4 ix1_a, UINT4 iy1_a, UINT4 ix2_a, UINT4 iy2_a,
 UINT1 ithresh_a, UINT1 iblack_a, UINT1 inoscan_a, SINT4 ilength_a );

void fill_region_kernel
  (UINT1 *image_a,		/* Virtual TV image array */
   SINT4 iXSize_a,		/* X-Size of image */
   SINT4 iYSize_a,		/* Y-Size of image */
   SINT4 *stack_a,		/* Scratch stack area for algorithm */
   SINT4 stacksz_a,		/* Size of stack_a in bytes */
   UINT1 color_a,		/* Color with which to fill */
   UINT1 match_a,		/* Color being overwritten */
   SINT4 point_a,		/* Initial point in image (offset within image_a) */
   SINT4 *panic_a,		/* Returns # of stack panics that occured */
   SINT4 style_a);		/* What type of fill to do */

void insert_one_dot
  (UINT1 *addr_a,
   UINT1 color_a );

void line_long_x           /* File: csubs.c */
  (UINT1* addr_a,    /* Address of the current position */
   SINT4 yinc_a,     /* Amount to change the address if the Y-position increases */
   SINT4 long_a,     /* Length of line in long direction (signed)*/
   SINT4 short_a,    /* Length of line in the short direction (always positive)*/
   UINT1 color_a,    /* Color number to insert */
   UINT4* dot_a      /* Dotted line pattern is shifted by the number of dots moved*/
   );

void line_long_y           /* File: csubs.c */
  (UINT1* addr_a,
   SINT4 yinc_a,
   SINT4 long_a,
   SINT4 short_a,    /* Length of line in the short (x) direction */
   UINT1 color_a,
   UINT4* dot_a
   );

UINT4 lvtv_valid_unit
(VTV vtv_a );

SINT4 VtvCompressColors2
(UINT2 *pData_a,                 /* Pointer to the data */
 SINT4 iSize_a,                  /* Size in pixels of the array */
 struct color_def Colormap_a[],  /* Colormap in use, will modify */
 UINT4 iCurrentColors_a,         /* Current number of colors in use (<= 1024) */
 UINT4 iMinColor_a,              /* Minimum color to compress */
 UINT4 iMaxColor_a );            /* Desired number of colors to use */

void vtv_expand_pixels          /* File: csubs.c */
  (UINT1 *in_a,
   SINT4 bytes_a,
   SINT4 dup_a,
   UINT1 *out_a );

UINT1* vtv_get_pointer          /* File: allocate_c.c */
( VTV image_a,
  SINT4 ixpos_a, 
  SINT4 iypos_a );

struct virtual_screen_info *vtv_valid_unit  /* File: allocate_c.c */
(VTV ivtv_a );

void vtv_copy_area_merge3
(VTV iSource_a,
 VTV iTarget_a,
 SINT4 iwidth_a,
 SINT4 iheight_a,
 SINT4 itarx_a,
 SINT4 itary_a );


