home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB140 / grlib03a.arj / GRAPH.H < prev    next >
Text File  |  1988-12-19  |  9KB  |  248 lines

  1. /************************************************************************/
  2. /*                                    */
  3. /*    GRAPH.H        Header file for use with the MSDOS GRAPHICS    */
  4. /*            LIBRARY V3.0                    */
  5. /*                                    */
  6. /************************************************************************/
  7.  
  8. #ifndef TRUE
  9. #define TRUE 1
  10. #define FALSE 0
  11. #endif
  12.  
  13. #define MAX_WS     6        /* maximum number of work stations which */
  14.                 /* can be open at one time         */
  15.  
  16. #define HIRES      (gbmod & 0x01)
  17. #define MEDRES      (! (gbmod & 0x01))
  18.  
  19. #define SMIDMON  1
  20. #define SHIGHMON 2
  21. #define SMIDCOL  3
  22. #define SHIGHCOL 4
  23. #define DMID     5
  24. #define DHIGH     6
  25.  
  26. #define SH_SW 0
  27. #define SH_DW 1
  28. #define DH_SW 2
  29. #define DH_DW 3
  30.  
  31. #define F_HOLLOW  0        /* Interior Fill Types */
  32. #define F_SOLID   1
  33. #define F_PATTERN 2
  34. #define F_HATCH   3
  35.  
  36. #define REPLACE    0        /* Write Modes */
  37. #define COMPLIMENT 1
  38. #define OVERLAY    2
  39. #define ERASE      3
  40.  
  41. #define segment segment_    /* gets around the MASM's SEGMENT directive */
  42.  
  43. /***** WORK STATION VARIABLES *****/
  44.  
  45. struct work_station {
  46.     unsigned char ws_data_[28],    /*All the bytes needed to initialise the work*/
  47.                     /*station  ****** DO NOT CHANGE ******/
  48.           p1_[16];    /*param table for PRAM & FIGS cmnds.*/
  49.              char ws_type_,    /*work station type. 1 to 6*/
  50.           ws_wmo_;    /*write mode. 0 to 3*/
  51.     unsigned char gbmod_,    /*GO's mode register.*/
  52.           fgbg_,    /*defines fore_grnd/back_grnd colour.*/
  53.           alups_,    /*defines the writing mode.*/
  54.           gbmskl_,    /*GO's write mask, split into low and*/
  55.           gbmskh_,    /*high bytes.*/
  56.           gdcml_,    /*GDC's write mask, as above.*/
  57.           gdcmh_,
  58.           curl0_,    /*three bytes which define the GDC's*/
  59.           curl1_,    /*cursor position.*/
  60.           curl2_;    /*curl2 only uses it's high nibble.*/
  61.              int  ymax_,    /*max pixels on 'y' axis. 0 to ymax*/
  62.           xmax_;    /*max pixels on 'x' axis. 0 to xmax*/
  63.              char twdir_;    /*direct'n for word & vector drawing.*/
  64.     unsigned char nmritl_,    /*# words to write. used by FIGS*/
  65.           nmrith_;
  66.              int  sh_p_lin_,    /*number of shifts to do to convert a*/
  67.                     /*line number to an absolute address.*/
  68.           bytes_p_lin_,    /*number of bytes displayed per line.*/
  69.           x_start_,    /*four gen. purpose variables_, mainly*/
  70.           y_start_,    /*used for line drawing to defined*/
  71.           x_stop_,    /*the start and stop vectors.*/
  72.           y_stop_,
  73.           g_strtx_;    /*defines current 'x' offset from the*/
  74.                     /*start of line to 1st pix. displayed*/
  75.     unsigned char scr_top_,    /*define the top & bottom lines for*/
  76.           scr_bot_,    /*vertical scrolling.*/
  77.           scrltb_[256];    /*mirror of line number sequence.*/
  78.  
  79.     struct _clmpda {        /*defines the colour intensities.*/
  80.     unsigned char red_green[16],
  81.               mono_blue[16];
  82.     } clmpda_;
  83.     
  84.     struct _pattbl {            /*defines patterns & repeat factors*/
  85.     unsigned char patern,        /* for drawing lines.*/
  86.               multiplier;
  87.     } pattbl_[16];
  88.     
  89.     /****** LINE VARIABLES ******/
  90.          char l_col_,    /*line colour.*/
  91.           l_type_,    /*line type_, indexes "pattbl".*/
  92.           l_wid_;    /*line width. (not used currently).*/
  93.  
  94.     /****** FILL VARIABLES ********/
  95.          char f_col_,    /*fill colour.*/
  96.           f_type_,    /*fill type. 0 to 3*/
  97.           f_style_;    /*fill style. 0 to 7*/
  98.  
  99.     struct _f_patrn {            /*table of patterns for filling:*/
  100.     unsigned char solid[8],        /*f_patrn[0]    solid.    f_type = 1.*/
  101.               pattern[8][8],    /*f_patrn[1-8]  patterns. f_type = 2.*/
  102.               hatch[8][8];    /*f_patrn[9-16] hatches.  f_type = 3.*/
  103.     } f_patrn_;
  104.  
  105.     /****** TEXT VARIABLES ******/
  106.          char t_col_,    /*text colour.affects "text"&"gtext."*/
  107.           t_font_;    /*text font.   affects "gtext" only.*/
  108.     unsigned char t_sca_;    /*text scale.  affects "text" only.*/
  109.          int  t_dir_;    /*direction that text is written.*/
  110.                     /*             affects "text" only.*/
  111.          int  t_x_,        /*define the bottom left of the char.*/
  112.           t_y_;        /*cell in which char. is displayed.*/
  113.     
  114.     /****** MARKER VARIABLES ******/
  115.              char m_col_,    /*marker colour.*/
  116.           m_type_;    /*marker type. 0 to 15*/
  117.     unsigned char m_sca_;    /*marker scale.*/
  118.  
  119.     struct _m_tab {            /*vector table for markers.*/
  120.     unsigned char mkr0[16],
  121.               mkr1[16],
  122.               mkr2[16],
  123.               mkr3[16],
  124.               mkr4[16],
  125.               mkr5[16],
  126.               mkr6[16],
  127.               mkr7[16],
  128.               mkr8[16],
  129.               mkr9[16],
  130.               mkr10[16],
  131.               mkr11[16],
  132.               mkr12[16],
  133.               mkr13[16],
  134.               mkr14[16],
  135.               mkr15[16];
  136.     } m_tab_;
  137. };
  138.  
  139. extern struct work_station cur_ws;
  140.  
  141. #define  ws_data    cur_ws.ws_data_
  142. #define  p1        cur_ws.p1_
  143. #define  ws_type    cur_ws.ws_type_
  144. #define  ws_wmo        cur_ws.ws_wmo_
  145. #define  gbmod        cur_ws.gbmod_
  146. #define  fgbg        cur_ws.fgbg_
  147. #define  alups        cur_ws.alups_
  148. #define  gbmskl        cur_ws.gbmskl_
  149. #define  gbmskh        cur_ws.gbmskh_
  150. #define  gdcml        cur_ws.gdcml_
  151. #define  gdcmh        cur_ws.gdcmh_
  152. #define  curl0        cur_ws.curl0_
  153. #define  curl1        cur_ws.curl1_
  154. #define  curl2        cur_ws.curl2_
  155. #define  ymax        cur_ws.ymax_
  156. #define  xmax        cur_ws.xmax_
  157. #define  twdir        cur_ws.twdir_
  158. #define  nmritl        cur_ws.nmritl_
  159. #define  nmrith        cur_ws.nmrith_
  160. #define  sh_p_lin     cur_ws.sh_p_lin_
  161. #define  bytes_p_lin     cur_ws.bytes_p_lin_
  162. #define  x_start     cur_ws.x_start_
  163. #define  y_start     cur_ws.y_start_
  164. #define  x_stop        cur_ws.x_stop_
  165. #define  y_stop        cur_ws.y_stop_
  166. #define  g_strtx     cur_ws.g_strtx_
  167. #define  scr_top     cur_ws.scr_top_
  168. #define  scr_bot    cur_ws.scr_bot_
  169. #define  scrltb        cur_ws.scrltb_
  170. #define  clmpda        cur_ws.clmpda_
  171. #define  pattbl        cur_ws.pattbl_
  172. #define  l_col        cur_ws.l_col_
  173. #define  l_type        cur_ws.l_type_
  174. #define  l_wid        cur_ws.l_wid_
  175. #define  f_col        cur_ws.f_col_
  176. #define  f_type        cur_ws.f_type_
  177. #define  f_style     cur_ws.f_style_
  178. #define  f_patrn    cur_ws.f_patrn_
  179. #define  t_col        cur_ws.t_col_
  180. #define  t_font        cur_ws.t_font_
  181. #define  t_sca        cur_ws.t_sca_
  182. #define  t_dir        cur_ws.t_dir_
  183. #define  t_x        cur_ws.t_x_
  184. #define  t_y        cur_ws.t_y_
  185. #define  m_col        cur_ws.m_col_
  186. #define  m_type        cur_ws.m_type_
  187. #define  m_sca        cur_ws.m_sca_
  188. #define  m_tab        cur_ws.m_tab_
  189.  
  190. /*************************************************************************/
  191. /*table of 4 pointers, each to a 2560 byte area set out as 256 chars with*/
  192. /*10 scan lines (bytes) per character Each pointer/area is set/allocated */
  193. /*when ld_font() is called.                         */
  194. /*************************************************************************/
  195.  
  196. extern struct _fnt_ {
  197.     char f_char[256][10];
  198. } *tfonts[4];
  199.  
  200. /***************************************************************/
  201. /*      Read/write bitmap cell structure                       */
  202. /***************************************************************/
  203.  
  204. struct g_cell {
  205.     int c_corner[4];        /*defines bottom-left & top-right*/
  206.     int c_plane;            /*plane number read*/
  207.     int c_rows;            /*#rows read*/
  208.     int c_bytes;            /*#bytelength of each row element*/
  209.     unsigned char *c_segment;    /*opt segment addr of temp area*/
  210.     unsigned char *c_offset;    /*opt offset addr of temp area*/
  211. };
  212.  
  213. #define WS_OPEN  1
  214. #define WS_SAVED 2
  215.  
  216. extern struct _gr_data {        /*This structure is used to manage   */
  217.          char ws_ty,        /*which work stations are active,    */
  218.               ws_flags;        /*where their stuctures are and where*/
  219.     struct work_station *ws;    /*the screen image has been saved.   */
  220.     struct g_cell *ws_cell;        /* (If it has.)                 */
  221. } gr_data[MAX_WS];
  222.  
  223. extern unsigned int  gp_buff[1024];    /*gen. purpose array for 'xy' points.*/
  224.                     /*Used heavily by "circle","segment",*/
  225.                     /*"arc" and "rectangle", therefore*/
  226.                     /*don't use it for these functions.*/
  227.  
  228. /***************************************************************/
  229. /*      GSX86MWC COMPATABLE FUNCTION CALLS AS MACROS           */
  230. /***************************************************************/
  231.  
  232. #define direction(_td_)    cur_ws.t_dir_=_td_
  233. #define fillcolor(_fc_)    cur_ws.f_col_=_fc_
  234. #define fillstyle(_fs_)    cur_ws.f_style_=_fs_
  235. #define filltype(_ft_)     cur_ws.f_type_=_ft_
  236. #define linecolor(_lc_)    cur_ws.l_col_=_lc_
  237. #define linetype(_lt_)     cur_ws.l_type_=_lt_
  238. #define linewidth(_lw_)    cur_ws.l_wid_=_lw_
  239. #define markercolor(_mc_)  cur_ws.m_col_=_mc_
  240. #define markerscale(_ms_)  cur_ws.m_sca_=_ms_
  241. #define markertype(_mt_)   cur_ws.m_type_=_mt_
  242. #define setwmode(_md_)     cur_ws.ws_wmo_=_md_,a_wmode()
  243. #define textcolor(_tc_)    cur_ws.t_col_=_tc_
  244. #define textfont(_tf_)     cur_ws.t_font_=_tf_
  245. #define charht(_ts_)       cur_ws.t_sca_=_ts_
  246. #define updatews()         ;
  247. 
  248.