/**C*
 *
 * Vaisala software source code file
 *
 * Copyright (c) Vaisala Oyj 1991, 1995, 1996, 1997, 1998, 2000, 2002, 2003,
 * 2004, 2006, 2007, 2010, 2011, 2012.
 * All rights reserved.
 *
 **C*/

/** @file
 *
 * Header file for tvsubs_lib
 *
 * $URL: https://subversion.vaisala.com/svn/repos/sigmet/wr_iris_rda/tags/release8.13.6/base/tvsubs_lib/tvsubs_lib.h $
 *
 * $Id: tvsubs_lib.h 28788 2012-12-11 20:40:36Z jho $
 *
 */

#ifndef SIGMET_TVSUBS_LIB_H
#define SIGMET_TVSUBS_LIB_H 1



#define TVSUBS_CATCH_FAR      (TVSUBS_FACILITY + 1)
#define TVSUBS_LONG_RANGE     (TVSUBS_FACILITY + 2)
#define TVSUBS_OVER_FAR       (TVSUBS_FACILITY + 3)
#define TVSUBS_PRJ_NOOVERLAP  (TVSUBS_FACILITY + 4)
#define TVSUBS_FEW_COLORS     (TVSUBS_FACILITY + 5)
#define TVSUBS_NO_COLORS      (TVSUBS_FACILITY + 6)
#define TVSUBS_NO_CONTRAST    (TVSUBS_FACILITY + 7)


////////////////////////////////////////////////////////////////////
// This is the base class. Instances can not be created from it.
// It only should be an inherited class
////////////////////////////////////////////////////////////////////

class LabelAxis
{
 private:

 protected:
  LabelAxis(void);          /* Constructor */
  /*  LabelAxis( int iLength_a, int iMinSpacing_a);  */     /* Constructor */
  int    iPixelLength;         /* Length of the axis line */
  int    iPixelMinSpacing;     /* Minimum spacing between ticks */
  int    iTickCount;           /* Number of ticks in the display */
  FLT8   fPixelTickStart;      /* Position of the first tick */
  FLT8   fPixelTickSpacing;    /* Spacing between ticks in pixels */
  char   sFaultString[80];     /* String indicating what is wrong */

 public:
  int  getCount( void );                 /* Returns the number of labels */
  int  getOnePosition( int iIndex_a );   /* Returns position of a label */
  int  getFaultString                    /* Returns nonzero on error */
    ( char sFaultString_a[], int iStringSize_a );
};

/*
 * Time axis
 */
class LabelAxisTime : public LabelAxis
{
 private:
    struct ymds_time DataFirstTick;        /* Time of the first tick */
    int   iDataTickSpacing;                /* Tick spacing in seconds */
    int   iDataTickResolution;
#define RESOLUTION_SECONDS 0
#define RESOLUTION_MINUTES 1
#define RESOLUTION_HOURS   2

  public :
    LabelAxisTime( int iLength_a, int iMinSpacing_a,   /* Constructor */
		   const struct ymds_time *pStart_a,
		   const struct ymds_time *pStop_a );

    void getOneLabel( int iIndex_a, 
		      char sLabel_a[],
		      int iLabelSize_a);   /* Returns string to draw */
    /* Returns the label for the axis */
    void getLegendLabel
      ( char sLabel_a[],
	int iLabelSize_a);
};

/*
 * FLT8 axis
 */
class LabelAxisFlt8 : public LabelAxis
{
 private:
    FLT8  fDataFirstTick;          /* First tick */
    FLT8  fDataTickSpacing;        /* Tick spacing */
    char  sLabelFormat[40];        /* Format statement used to make labels */

  public :
    LabelAxisFlt8( int iLength_a, int iMinSpacing_a,   /* Constructor */
		   FLT8 fStart_a, FLT8 fStop_a );

    void getOneLabel( int iIndex_a, 
		      char sLabel_a[],
		      int iLabelSize_a);   /* Returns string to draw */
};

void bothout_points    /* In file bothout.c */
  (const struct XYPoint8 *fpos1_a,  /* First input point */
   const struct XYPoint8 *fpos2_a,  /* Second input point */
   struct XYPoint8 *fnew1_a,        /* Relocated first point on the edge (exit) */
   struct XYPoint8 *fnew2_a,        /* Relocated second point on the edge (exit) */
   const double fwin_pos_a[2],      /* Position of the window of interest. */
   const double fwin_size_a[2],     /* Size of window */
   UINT2* plmissed_a     /* Nonzero if the line misses the region entirely,
			  *  in which case the two new points are undefined. */
   ); 

void bothout_reduce      /* In file bothout.c */
  (const struct XYPoint8 *fpos1_a,     /* First input point  */
   const struct XYPoint8 *fpos2_a,     /* Second input point */
   double* pfreduce1_a,       /* Proportion of line reduced from first point (exit) */
   double* pfreduce2_a,       /* Proportion of line reduced from the second point. (exit) */ 
   const double  fwin_pos_a[2],     /* Position of the window of interest.*/
   const double  fwin_size_a[2],    /* Size of window*/
   UINT2* plmissed_a        /* Nonzero if the line misses the region entirely, in which 
			     *  case the two reduceX_a parameters are undefined. (exit) */
   );

void calcstep            /* In file getstep.C */
(BIN4 iangle_a,
 const double fradpos_a[2],
 double fstart_a,
 int16_t icount_a, 
 const double fscale_a[2],
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 BIN4 *istep_a,
 uint16_t *lmissed_a );

void calcstep            /* In file getstep.C */
(BIN4 iangle_a,
 const double fradpos_a[2],
 double fstart_a,
 SINT2 icount_a, 
 const double fscale_a[2],
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 BIN4 *istep_a,
 UINT2 *lmissed_a );

uint16_t inside_test       /* In file bothout.C */
  (const struct XYPoint8 *ftest_pos_a,   /* Position to test */
   const double fwin_pos_a[2],    /* Window position  */
   const double fwin_size_a[2]    /* Size of window   */
   );

void one_out_point       /* In file bothout.c */
  (const struct XYPoint8 *fpoint1_a,  /* First point */
   const struct XYPoint8 *fpoint2_a,  /* Second point */
   struct XYPoint8       *fedge_a,    /* Point on window edge allong line */
   const double  fwin_pos_a[2],             /* Window position */
   const double  fwin_size_a[2]             /* Window size */
   );

void one_out_reduce      /* In file bothout.c */
  (const struct XYPoint8 *fpoint1_a,  /* First point */
   const struct XYPoint8 *fpoint2_a,  /* Second point */
   double* pfreduce_a,                /* Proportion of line length reduced */
   const double  fwin_pos_a[2],       /* Window position */
   const double  fwin_size_a[2]       /* Window size */
   );

/* Function prototypes for the library routines */

void beam_grid            /* In file vertical_grids.c */
(VTV  image_a,               /* VTV image */
 const double fwin_pos_a[2], /* Window position */
 const double fwin_size_a[2],/* Window size, one less than width in pixels */
 const double fstart_a[2],   /* Starting position in degrees (ll corner) */
 const double fspan_a[2],    /* Size in degrees */
 VTV_PIXEL igrid_a,          /* Color to draw grid in */
 VTV_PIXEL iaxis_a,          /* Color to draw axis in */
 UINT2 lgrid_a,              /* Non-zero means draw grid on top of picture */
 UINT4 iFontHeight_a,        /* Height of font to use */
 UINT4 iUnits_a,             /* Units to draw grid in */
 const UINT1 iGridType_a[2]);/* Type of grid for each axis */


void cross_grid          /* In file vertical_grids.c */
(VTV  image_a, 
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const double fscale_a[2],   /* Scale factors in km/pixel */
 const double fradpos_a[2],  /* Radar position in pixels */
 VTV_PIXEL igrid_a,
 VTV_PIXEL iaxis_a,
 UINT2 lgrid_a,
 UINT4 iFontHeight_a,       /* Height of font to use */
 UINT4 iunits_a );

typedef void (*DRAW_LINE_FUNC)(VTV image, SINT4 x1, SINT4 y1, SINT4 x2, SINT4 y2 );
void draw_arrow             /* In file: inside.c */
(const SINT4 itip_a[2],     /* The tip of the arrow */
 const double fwin_pos_a[2], /* Window to clip drawing within */
 const double fwin_size_a[2],
 const double flengths_a[3], /* length in pixles of the body, wings, and backoff. */
 double fangle_a,           /* Direction the arrow points in, clockwise from north, radians*/
 UINT4 image_a,             /* Image ID (Note always VTV!) */
 DRAW_LINE_FUNC line_a );  /*Routine to draw the line */

#ifdef SIGMET_PROJECTION_H
  void  draw_catch     /* In file: DrawCatch.c */
  (VTV   itv_a,                                      /* Which VTV to draw in */
   const struct catch_file_header8* pCatch_a,  /*Catch header */
   const UINT1 iheap_a[],                   /*Heap of data */
   const struct layer_dir* players_a,       /*Layer directory */
   const double fwin_pos_a[2],
   const double fwin_size_a[2],
   const struct mpj_projection8 *proj_a,
   const struct mpj_region8 *region_a,
   UINT4 iflag_a,
   VTV_PIXEL iFill_a, /* Color to fill icon with (was UNDERLAY3) */
   VTV_PIXEL iMask_a  /* Color for icon mask and text and catch border, (was OVERLAY1) AUX set */
   );
#endif  /* #ifdef SIGMET_PROJECTION_H */

UINT1 draw_clipped_line      /* In file protected.c */
(VTV image_a,
 const struct XYPoint8 *point1_a, 
 const struct XYPoint8 *point2_a,
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 DRAW_LINE_FUNC DrawLine_a,
 struct XYPoint8 *pMidPoint_a );

#ifdef SIGMET_PROJECTION_H
void draw_icon         /* File: overlay.c */
(SINT4 ix_a,
 SINT4 iy_a,
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const volatile struct icon_def *picon_a,
 const volatile UINT1 *icon_heap_a,
 UINT1 lbackground_a,       /* Need to highlight behind */
 VTV_PIXEL icolor_a,        /* Color to draw in */
 VTV_PIXEL iBackColor_a,    /* Optional highlight, (was COLOR_UNDERLAY1) */
 VTV itv_a );
#endif  /* #ifdef SIGMET_PROJECTION_H */

/* Flags used to control how the overlay is to be drawn.
 * Do not draw the underlay. N/A for catchment areas.
 */
#define OVR_NOUNDER_MASK (0x0001)

/* Draw just dots rather than filling underlay.  Do not fill catchment
 * areas with color.
 */
#define OVR_NOFILL_MASK  (0x0002)

/* Do not draw the text of the overlay.  Do not draw catchment names.
 */
#define OVR_NOTEXT_MASK  (0x0004)

/* N/A for overlay.  Draw catchment icons rather than regions.
 */
#define OVR_CAT_ICONS_MASK  (0x0008)
/* N/A for overlay.  Do not draw the border lines.
 */
#define OVR_CAT_NOLINES_MASK  (0x0010)

/* N/A for overlay.  Draw border as wide highlight lines. */
#define OVR_CAT_HIGHLIGHT_MASK  (0x0020)

#ifdef SIGMET_PROJECTION_H
#ifdef SIGMET_SETUP_H
void DrawOverlay
( VTV vtv_a,
  const volatile struct layer_dir* players_a,       /*Layer directory */
  const volatile struct overlay_file_header8* overlay_a,  /*Overlay header */
  const volatile UINT1 iheap_a[],                   /*Heap of data */
  const double fwin_pos_a[2],
  const double fwin_size_a[2],
  const struct mpj_projection8 *pProj_a,
  const struct mpj_region8 *pRegion_a,
  UINT4 ilayer_mask_a,
  UINT4 iflag_a,
  volatile const struct special_colors *pSpecial_a
 );
#endif  /* #ifdef SIGMET_SETUP_H */

void DrawOneCatch   /* In file: DrawCatch.c */
(VTV   itv_a,              /* Which VTV to draw in */
 const struct one_catch_header8 *pOneCatch_a,
 const struct icon_inventory* pIcons_a,       /*Icon inventory */
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const struct mpj_projection8 *proj_a,
 const struct mpj_region8 *region_a,
 UINT4 iflag_a,
 VTV_PIXEL iFillColor_a,      /* Color to fill icon with */
 VTV_PIXEL iMaskColor_a,      /* Color for icon mask and text and catch border */
 struct XYPoint8 *pCenter_a   /* Returns the center point */
 );

void DrawOneIcon /* In file: overlay.C */
(uint8_t iIconNumber_a,                 /* Icon index */
 const char *sText_a,                   /* Text to draw next to the icon */
 const struct latlon8 *pGagePos_a,
 const struct icon_inventory* pIcons_a,  /*Icon inventory */
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const struct mpj_projection8 *proj_a,
 const struct mpj_region8 *region_a,
 VTV_PIXEL iFillColor_a,      /* Color to fill icon with */
 VTV_PIXEL iMaskColor_a,      /* Color for icon mask and text */
 float fRotation_a,       /* Rotation of icon, radians */
 VTV   itv_a              /* Which VTV to draw in */
 );

#ifdef SIGMET_SETUP_H
void  draw_protected /* In file protected.c */
(VTV   image_a,
 const struct protect_setup* protected_a,  /*Protected area defs */
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const struct mpj_projection8 *proj_a,
 const struct mpj_region8 *region_a,
 const double frad_pos_a[2],
 VTV_PIXEL picolor_a,
 VTV_PIXEL iHitColor_a,                 /*Which color to draw hits in*/
 UINT4 idraw_mask_a,
 UINT4 ihit_mask_a
 );
#endif  /* #ifdef SIGMET_SETUP_H */

#define RING_SPACING_AUTO (0)
void  draw_rangerings       /* In file rangerings.c */
(VTV image_a,
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const struct mpj_projection8 *proj_a,
 const struct mpj_region8 *region_a,
 const struct latlon8 *RingCenter_a, /*Ring Center in lat/long*/
 VTV_PIXEL icolor_a,             /*color to draw the rings in */
 VTV_PIXEL ibackcol_a,           /*background color*/
 UINT2 labels_a,             /*Flag to indicate if we are drawing labels*/
 UINT4 iRingSpacing_a,       /* Ring spacing */
 UINT4 iunits_a              /*Specify units for rings*/
 );

void draw_single_rangering  /* In file rangerings.c */
(const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const struct mpj_projection8 *proj_a,
 const struct mpj_region8 *region_a,
 volatile const struct latlon8 *RingCenter_a,
 double frange_a,
 double fstart_a,
 double fend_a,
 VTV_PIXEL icolor_a,
 VTV  image_a );
#endif  /* #ifdef SIGMET_PROJECTION_H */

#define AXIS_CENTERED     1
#define AXIS_BOTTOM       0
#define AXIS_LEFT         0
#define AXIS_TOP          2
#define AXIS_RIGHT        2
#define AXIS_ENDS_IN      8   /* Both end labels are moved inwards */

#define AXIS_LABEL_INT    0
#define AXIS_LABEL_TIME  16   /* Label with time */
#define AXIS_LABEL_AZ    32   /* Label with azimuth (wrap at 360) */
#define AXIS_LABEL_TENTHS 64   /* Label with tenths of integers */

void draw_vert_axis  /* In file plot.C */
(SINT4 ix_a,
 SINT4 iy_a,
 SINT4 ilen_a,
 double fscale_a,
 SINT4 istlabel_a, 
 SINT4 istep_a,
 SINT4 istpix_a,
 SINT4 iticks_a,
 UINT4 iflags_a,
 UINT4 ivtv_a );

void draw_horz_axis  /* In file plot.C */
(SINT4 ix_a,
 SINT4 iy_a,
 SINT4 ilen_a,
 double fscale_a,
 SINT4 istlabel_a, 
 SINT4 istep_a,
 SINT4 istpix_a,
 SINT4 iticks_a,
 UINT4 iflags_a,
 UINT4 ivtv_a );

#define GRID_IN_RANGE   (0)
#define GRID_IN_MINUTES (1)
#define GRID_IN_DEGREES (2)

  SINT4 GetGridStep       /* In file getstep.C */
  ( double fScale_a,      /* Scale in data/pixel */
    double fMinSpacing_a, /* Minimum spacing in pixels between grid lines */
    UINT1 iDataType_a );  /* Type of data, (determines how to quantize) */
  
  SINT4 GetSecondStep     /* In file: getstep.C */
  (FLT8 fDesiredStep_a );

  FLT8 GetLogStep        /* In file: getstep.C */
  (FLT8 fDesiredStep_a,  /* Desired tick spacing */
   SINT4 *pLogTick_a );  /* Log of tick spacing, or negative of number of digits to display*/
       
/* Get index number of icon name supplied */
#define ICON_NOT_FOUND ((uint8_t)-1)
#ifdef SIGMET_PROJECTION_H
uint8_t GetNamedIconIndex    /* In file overlay.C */
(const struct icon_inventory *pIcons_a,
 const char *sName_a);

const struct icon_def *GetNamedIconPtr  /* In file overlay.C */
(const struct icon_inventory *pIcons_a,
 const char *sName_a);
#endif  /* #ifdef SIGMET_PROJECTION_H */

#ifdef SIGMET_SIG_RTDISP_H
void insert_rtray         /* File: rtdisp_ray.c */
(Display* display_a,
 Window window_a,
 const UINT1 ray1_a[],
 const struct rtd_v1_ray_header *pray );
#endif  /* #ifdef SIGMET_SIG_RTDISP_H */

#ifdef INCLUDE_X11_PROTOTYPES
void insert_rtray_blank   /* File: rtdisp_ray.c */
( Display *display_a,
 Window window_a );
#endif  /* #ifdef INCLUDE_X11_PROTOTYPES */

struct rtray_config
{
  double fWinPos[2];      /* Position and size of the display window */
  double fWinSize[2];
  double fRadarPos[2];    /* Location of radar in the display window */
  double fmax_range;      /* Maximum range of the display in km */
  double fmin_height;     /* Minimum height of the display in km. RHI only */
  double fmax_height;     /* Maximum height of the display in km. RHI only */
  BIN4  imax_widen;      /* Maximum beam widening between rays */
  UINT4 isweep_color;    /* Color to draw sweep line in */
  UINT4 iImageDepth;     /* Depth of image in bits/pixel */
  UINT2 lsweep_line;     /* Draw a sweep line on screen */
  UINT1 lrhi_scan;       /* Draw data as RHI scan */
  UINT1 lrhi_lower_left; /* Draw RHI scan in lower left corner */
};

#ifdef SIGMET_SIG_RTDISP_H
void insert_rtray_init    /* File: rtdisp_ray.c */
  (uint8_t *pImageData_a,
   VTV background_image_a,
   volatile const struct rtd_v1_vol_header *phead_a,
   volatile const struct rtray_config *pconfig_a,
   volatile const VTV_PIXEL data_to_vtv_map_a[256] );
#endif  /* #ifdef SIGMET_SIG_RTDISP_H */

#ifdef INCLUDE_X11_PROTOTYPES
void insert_rtray_end    /* File: rtdisp_ray.c */
(Display* display_a,
 Window window_a );
#endif  /* #ifdef INCLUDE_X11_PROTOTYPES */

void  label_bottom      /* In file plot.c */
  (UINT4 image_a,
   const char* stext_a,
   const SINT4 iplot_pos_a[2],
   const SINT4 iplot_size_a[2]
   );

void  label_left        /* In file plot.c */
  (UINT4 image_a,
   const char* stext_a,
   const SINT4 iplot_pos_a[2],
   const SINT4 iplot_size_a[2]
   );

#ifdef SIGMET_PROJECTION_H
void lat_long_grid       /* In file lat_long_grid.c */
(VTV image_a,            /*which vtv display unit to use */
 const double fwin_pos_a[2],      /*The window position in pixels for the display */
 const double fwin_size_a[2],     /*The window size */
 const struct mpj_projection8 *proj_a,  /* Projection */
 const struct mpj_region8 *region_a,    /* Region */
 VTV_PIXEL icolor_a          /*Which color to draw in */
 );
#endif  /* #ifdef SIGMET_PROJECTION_H */

void max_side_grid
(VTV image_a,
 const double ftop_win_pos_a[2],
 const double ftop_win_size_a[2],
 const double fright_win_pos_a[2],
 const double fright_win_size_a[2],
 const int32_t ibottom_a,
 const int32_t itop_a,
 VTV_PIXEL icolor_a,
 uint32_t iunits_a );

UINT2 linside_move       /* In file: inside.c */
(SINT4 ipos_a[2],
 const double fwin_pos_a[2],
 const double fwin_size_a[2]);

UINT2 lInsideMove        /* In file: inside.c */
(double       fPos_a[2],     /* Position in pixels */
 const double fwin_pos_a[2],
 const double fwin_size_a[2]);

typedef void (*MOVETO_VTV_FUNC)(const struct XYPoint8 *fPos, VTV_PIXEL iColor, VTV image );
#define COLOR_DONT_DRAW (0xff000000)
void moveto_vtv          /* In file overlay.C */
(const struct XYPoint8 *fpos_pix_a,   /* Pixel position to move to */
 VTV_PIXEL icolor_a,                  /* Color to draw it in */
 VTV  ivtv_a                     /* VTV unit number to use */
 );

/* Wide line version of function above */
void moveto_vtv_wide    /* In file overlay.C */
(const struct XYPoint8 *fpos_a,
 VTV_PIXEL icolor_a,
 VTV   itv_a );

void overlaydot            /* In file overlay.c */
  (SINT4 ix_a,
   SINT4 iy_a,
   UINT4 ifont_a,
   VTV   iunit_a );

#ifdef SIGMET_PROJECTION_H
  MESSAGE ReprojectTable     /* In file: ReprojectTable.c */
( const struct mpj_projection8 *pInProjection_a,
  const struct mpj_region8     *pInRegion,
  const struct mpj_projection8 *pOutProjection_a,
  const struct mpj_region8     *pOutRegion_a, 
  struct rpj_table *pTable_a );

  MESSAGE ReprojectVtv         /* In file: ReprojectVtv.c */
( VTV                           Input_a,
  const struct mpj_projection8 *pInProjection_a,
  const struct mpj_region8     *pInRegion_a,
  VTV                           Output_a,     /* Output data */
  const struct mpj_projection8 *pOutProjection_a,
  const struct mpj_region8     *pOutRegion_a,
  const double fwin_pos_a[2] );               /* Offset of region in Output_a */

void ReprojectVtvCopy              /* File: ReprojectVtv.c */
( VTV Input_a,
  VTV Output_a,
  const double fwin_pos_a[2],               /* Offset to to region in output */
  const struct rpj_table *pTablef_a );
#endif  /* #ifdef SIGMET_PROJECTION_H */

void rhi_grid              /* In Vertical_grids.c */
(VTV  image_a, 
 const double fwin_pos_a[2],
 const double fwin_size_a[2],
 const double fscale_a[2],    /* Scale factors in km/pixel */
 const double fradpos_a[2],   /* Radar position in pixels */
 VTV_PIXEL igrid_a,
 VTV_PIXEL iaxis_a,
 UINT2 lgrid_a,
 UINT4 iFontHeight_a,       /* Height of font to use */
 UINT4 iunits_a );

void text_corners 
  (VTV   image_a,
   SINT4 ix_a,
   SINT4 iy_a,
   volatile const char *sText_a,
   UINT4 itype_a,
   SINT4 *ixleft_a,         /* Position to draw the box at */
   SINT4 *iylow_a,
   SINT4 *ixhigh_a,
   SINT4 *iyhigh_a,
   SINT4 *iXText_a,         /* Position to draw the text at */
   SINT4 *iYText_a
   );

void tvsubs_lib_nls_init(void);
#define TVSUBS_LIB_INIT tvsubs_lib_nls_init()

/* This routine is called by the output process to set up the color map for
 * the window.  This must be called before the windows process has been
 * started.  This routine will allocate shared color cells, and set them with
 * the correct values.
 */
#ifdef INCLUDE_X11_PROTOTYPES
  Widget XsAppInitialize                /* File: initialize.c */
(XtAppContext * app_context_return,
 const char* application_class,
 XrmOptionDescRec *options,
 Cardinal num_options,
 int *argc_in_out,
 String *argv_in_out,
 String *fallback_resources,
 ArgList args_in,
 Cardinal num_args_in,
 SINT4 iDesiredDepth_a,
 Colormap *pColormap_a,
 XVisualInfo *pVisualInfo_a );

/* Get the pixel value corresponding to black in the current
 * colormap environment.
 */
UINT4 XsBlackPixel             /* File: colors.c */
(Display *pDisplay_a,
 Colormap Colormap_a,
 const XVisualInfo *pVisualInfo_a );

#ifdef SIGMET_FILEFORMATS_LIB_H
  void XsCreateAndFillImage           /* File: xscreateimage.c */
  (Display *disp_a, 
   const PICINFO *pinfo_a, 
   XImage **bg_image_a);
#endif  /* #ifdef SIGMET_FILEFORMATS_LIB_H */

#endif  /* #ifdef INCLUDE_X11_PROTOTYPES */

/* Search for the nearest color from an array of colors.  Return the
 * index.
 */
  UINT2 XsFindNearestColor            /* File: NearestColor.c */
( volatile const struct color_def *pColor_a,
  volatile const struct color_def Map_a[],
  SINT4 iColorCount_a );         /* Number of colors to search in the map, Max 2**16 */

/* This routine is called to possibly byte swap the VTV-to-Image 
 * mapping table.  This is only required when the client and server
 * byte conventions are different, and using more than 1 byte-per-pixel.
 */

#ifdef INCLUDE_X11_PROTOTYPES
void XsFixColorArrayNew
(const UINT4 iimage_depth_a,
 const UINT4 iimage_byte_order,
 volatile UINT4 vtv_to_image_map_a[],  /* Table to convert */
 SINT4 iSize_a );                      /* Size of table */

/* Search around for the best visual on the screen to use.  Return it along
 * with descriptive information.
 */
Visual* XsGetDesiredVisual             /* File: colors.c */
(Display  *pDisplay_a,
 int      iDesiredDepth_a,     /* Attempt to force a true color visual of this depth */
 Colormap *pFinalColormap_a,         /* Always filled in */
 XVisualInfo *pFinalVisualInfo_a );   /* Always filled in */
#endif  /* #ifdef INCLUDE_X11_PROTOTYPES */

/* Get the image depth from the visual depth.
 */
UINT4 XsImageDepthFromVisualDepth             /* File: colors.c */
(UINT4 iVisualDepth_a);

/* Indicate weather the specified visual class is read-only or not.
 */
UINT2 XsReadOnlyMap            /* File: colors.c */
( int iClass_a );

/* Get the pixel value corresponding to white in the current
 * colormap environment.
 */
#ifdef INCLUDE_X11_PROTOTYPES
UINT4 XsWhitePixel             /* File: colors.c */
(Display *pDisplay_a,
 Colormap Colormap_a,
 const XVisualInfo *pVisualInfo_a );
#endif  /* #ifdef INCLUDE_X11_PROTOTYPES */


#endif /* #ifndef SIGMET_TVSUBS_LIB_H */
