home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / d / dots151.zip / GRAPHSRC.ZIP / G.H < prev    next >
Text File  |  1990-07-04  |  5KB  |  123 lines

  1. /*
  2.     Interface definition for the machine-dependent routines called by
  3.     the portable CORE graphics routines.  These variables and functions
  4.     must be provided for each machine or graphics mode to be supported,
  5.     for example in gz.c for the Z-100 or in gpc.c for the IBM PC.
  6. */
  7.  
  8. #ifndef GH_H
  9. #define GH_H
  10.  
  11. /*        variables                                 */
  12.  
  13.         /* defined in GRAPH */
  14. extern char *program_name;
  15.  
  16.         /* remainder are defined in device driver */
  17. extern char *machine, *interface_version, *config_file;    
  18.  
  19. extern int
  20.     max_color,        /* color numbers range from 0 to max_color    */
  21.     pixels_wide,    /* x values range from 0 (left) to pixels_wide-1 (right) */
  22.     pixels_high,    /* y values range from 0 (top) to pixels_high-1    (bottom) */
  23.     erasing,        /* nonzero if (*erase_line)() is implemented */
  24.     flipping,        /* nonzero if (*flip_line)() is implemented */
  25.     plotting_device,/* nonzero if a plotter (lines and moves are at
  26.                             same speed, but pen up/pen down involves a delay) */
  27.     pen_diameter;    /* width of line in pixels */
  28.  
  29. extern double
  30.     best_width,
  31.     best_height; /*    screen height/width (proportional to actual display
  32.                     area dimensions in inches, but one of these *must*
  33.                     be 1, and the other must be in the range 0 to 1).
  34.                     For example, if the screen is twice as wide as it
  35.                     is high, best_height would be 0.5 and best_width
  36.                     would be 1.                                              */
  37.  
  38.  
  39. /*    text display parameters                */
  40.  
  41. extern int char_rows;        /*    number of text rows                            */
  42. extern int     char_columns;    /*    number of text columns                        */
  43. extern int     char_height;    /*    y displacement from one text row to next    */
  44. extern int     char_width;        /*    x displacement from one char column to next    */
  45. extern int     x_offset;        /*    fudge factors for                             */
  46. extern int     y_offset;        /*      equations below                            */
  47. extern int    char_v_adjusted;/*    nonzero if characters placed vertically
  48.                                 more accurately than char_width/2            */
  49. extern int    char_h_adjusted;/*    nonzero if characters placed horizontally
  50.                                 more accurately than char_width/2            */
  51.  
  52. /* an 'A' on row r, column c  has lower left corner on raster (y value)
  53.             y =     r*char_height + y_offset 
  54.     at pixel
  55.             x =     c*char_width + x_offset            */
  56.  
  57. extern struct PRIM_ATTR
  58.     {int    color_count;               /* # colors                          */
  59.     int     intensity_count;           /* # intensities                     */
  60.     int     intensities_in_hardware;   /* nonzero if supported in hardware  */
  61.     int     hardware_linestyles;       /* # linestyles in hardware          */
  62.     int     software_linestyles;       /* # linestyles in software          */
  63.     int     linewidth_count;           /* # linewidths                      */
  64.     int     linewidths_in_hardware;    /* nonzero if supported in hardware  */
  65.     int     linewidth_minimum;         /*                                   */
  66.     int     linewidth_maximum;         /*                                   */
  67.     int     hardware_pens;             /*                                   */
  68.     int     software_pens;             /*                                   */
  69.     int     charfont_count;            /* # fonts                           */
  70.     int     charsize_count;            /* # character sizes                 */
  71.     int     charsize_in_hardware;      /* nonzero if supported in hardware  */
  72.     int     charsize_minimum;          /*                                   */
  73.     int     charsize_maximum;          /*                                   */
  74.     int     hardware_markers;          /* # markers in hardware             */
  75.     int     software_markers;          /* # markers in software             */
  76.     int     pick_id_count;             /* # pick IDs in hardware            */
  77.     } prim_attr;
  78.  
  79.  
  80. /*    keyboard codes             */
  81.  
  82. extern int left_arrow;
  83. extern int right_arrow;
  84. extern int up_arrow;
  85. extern int down_arrow;
  86. extern int escaped_arrows;    /*    nonzero if arrow key codes are preceded
  87.                                 by an escape code (as on IBM PC)            */
  88. extern int escape_char;        /*    the character (if any) preceding key codes    */
  89.  
  90. #ifndef MODEL
  91. #ifdef __LARGE__
  92. #define MODEL far
  93. #else
  94. #define MODEL
  95. #endif
  96. #endif /* MODEL */
  97.  
  98. /*    pointers to line drawing and erasing functions    */
  99.  
  100. extern int MODEL (* MODEL draw_line)(int x1,int y1, int x2,int y2);  /* draw */
  101. extern int MODEL (* MODEL erase_line)(int x1,int y1, int x2,int y2); /* erase */
  102. extern int MODEL (* MODEL flip_line)(int x1,int y1, int x2,int y2);  /* flip */
  103.                                         /* ...line from (x1,y1) to (x2,y2) */
  104. extern int MODEL (* MODEL draw_text)(char *s); /* prints text at current location  */
  105. extern int MODEL (* MODEL draw_char)(int c); /* prints character at current location  */
  106.  
  107. /*    pointers to optional functions (NULL if not implemented)    */
  108.  
  109. extern int    (*new_linestyle)(int style);
  110. extern int    (*new_linewidth)(int width);
  111. extern int    (*new_charsize)(int w, int h);
  112. extern int    (*draw_marker)(int n);
  113.  
  114. /*    functions                    */
  115.  
  116. extern int    clear_graphics();            /* clears screen                */
  117. extern int    init_graphics();            /* initializes graphics mode    */
  118. extern int    finish_graphics();            /* terminates graphics mode        */
  119. extern int    inquire_color();            /* returns current color number    */
  120. extern double inquire_intensity();        /* returns current intensity    */
  121.  
  122. #endif /* GH_H */
  123.