home *** CD-ROM | disk | FTP | other *** search
/ Computer Club Elmshorn Atari PD / CCE_PD.iso / pc / 0600 / CCE_0636.ZIP / CCE_0636 / GEMLIB / GMLIBS30.ZOO / vdiatrib.c < prev    next >
C/C++ Source or Header  |  1993-02-18  |  8KB  |  385 lines

  1. /*
  2.  *    Vdi attribute funcs library interface
  3.  *
  4.  *        vswr_mode    set writing mode
  5.  *        vs_color    set color index to rgb
  6.  *        vsl_type    set polyline type
  7.  *        vsl_udsty    set user defined line style
  8.  *        vsl_width    set polyline width
  9.  *        vsl_color    set polyline color index
  10.  *        vsl_ends    set polyline end styles
  11.  *        vsm_type    set polymarker type
  12.  *        vsm_height    set polymarker height (in y coord units)
  13.  *        vsm_color    set polymarker color index
  14.  *        vst_height    set text height (baseline to top of char cell)
  15.  *        vst_point    set char cell point size
  16.  *        vst_rotation    set char baseline rot
  17.  *        vst_font    set text face
  18.  *        vst_color    set text color
  19.  *        vst_effects    set text atribs
  20.  *        vst_alignment    set text alignment
  21.  *        vsf_interior    set fill interior style
  22.  *        vsf_fill    set fill style (alias vsf_style)
  23.  *        vsf_color    set fill color
  24.  *        vsf_perimeter    set fill perimeter visibility
  25.  *        vsf_udpat    set user defied fill pattern
  26.  *
  27.  *            ++jrb    bammi@cadence.com
  28.  *            modified: mj -- ntomczak@vm.ucs.ualberta.ca
  29.  *
  30.  * 92/03/10 mmn -- Markus_Nick@mz.maus.de
  31.  *        changed return type of vst_height from void to int
  32.  *        because vst_height returns the selected height
  33.  */
  34. #include "common.h"
  35.  
  36. #ifdef __DEF_ALL__
  37.  
  38. #define L_vswr_mod
  39. #define L_vs_color
  40. #define L_vsl_type
  41. #define L_vsl_udst
  42. #define L_vsl_widt
  43. #define L_vsl_colo
  44. #define L_vsl_ends
  45. #define L_vsm_type
  46. #define L_vsm_heig
  47. #define L_vsm_colo
  48. #define L_vst_heig
  49. #define L_vst_poin
  50. #define L_vst_rota
  51. #define L_vst_font
  52. #define L_vst_colo
  53. #define L_vst_effe
  54. #define L_vst_alig
  55. #define L_vsf_inte
  56. #define L_vsf_fill     /* synonymous to vsf_style */
  57. #define L_vsf_colo
  58. #define L_vsf_peri
  59. #define L_vsf_udpa
  60.  
  61. #endif /* __DEF_ALL__ */
  62.  
  63.  
  64. #ifdef L_vswr_mod
  65.  
  66. /* vswr_mode    set writing mode
  67.  * returns writing mode
  68.  */
  69. int vswr_mode(int handle, int mode)
  70. {
  71.     _intin[0] = mode;
  72.     __vdi__(VDI_CONTRL_ENCODE(32, 0, 1, 0), handle);
  73.     return (int)_intout[0];
  74. }
  75. #endif /* L_vswr_mod */
  76.  
  77. #ifdef L_vs_color
  78.  
  79. /* vs_color    set color index to rgb
  80.  * returns void
  81.  */
  82. void vs_color(int handle, int index, int rgb[])
  83. {
  84.     _intin[0] = index;
  85.     _intin[1] = rgb[0];
  86.     _intin[2] = rgb[1];
  87.     _intin[3] = rgb[2];
  88.  
  89.     __vdi__(VDI_CONTRL_ENCODE(14, 0, 4, 0), handle);
  90. }
  91. #endif /* L_vs_color */
  92.  
  93. #ifdef L_vsl_type
  94.  
  95. /* vsl_type    set polyline type
  96.  * returns type selected
  97.  */
  98. int vsl_type(int handle, int style)
  99. {
  100.     _intin[0] = style;
  101.     __vdi__(VDI_CONTRL_ENCODE(15, 0, 1, 0), handle);
  102.     return (int)_intout[0];
  103. }
  104. #endif /* L_vsl_type */
  105.  
  106. #ifdef L_vsl_udst
  107.  
  108. /* vsl_udsty    set user defined line style
  109.  * returns void
  110.  */
  111. void vsl_udsty(int handle, int pat)
  112. {
  113.     _intin[0] = pat;
  114.     __vdi__(VDI_CONTRL_ENCODE(113, 0, 1, 0), handle);
  115. }
  116. #endif /* L_vsl_udst */
  117.  
  118. #ifdef L_vsl_widt
  119.  
  120. /* vsl_width    set polyline width
  121.  * returns selected width in x-axis units
  122.  */
  123. int vsl_width(int handle, int width)
  124. {
  125.     _ptsin[0] = width;
  126.     _ptsin[1] = 0;
  127.     __vdi__(VDI_CONTRL_ENCODE(16, 1, 0, 0), handle);
  128.     return (int)_ptsout[0];
  129. }
  130. #endif /* L_vsl_widt */
  131.  
  132. #ifdef L_vsl_colo
  133.  
  134. /* vsl_color    set polyline color index
  135.  * returns setting
  136.  */
  137. int vsl_color(int handle, int index)
  138. {
  139.     _intin[0] = index;
  140.     __vdi__(VDI_CONTRL_ENCODE(17, 0, 1, 0), handle);
  141.     return (int)_intout[0];
  142. }
  143. #endif /* L_vsl_colo */
  144.  
  145. #ifdef L_vsl_ends
  146.  
  147. /* vsl_ends    set polyline end styles
  148.  * returns void
  149.  */
  150. void vsl_ends(int handle, int begstyle, int endstyle)
  151. {
  152.     _intin[0] = begstyle;
  153.     _intin[1] = endstyle;
  154.     __vdi__(VDI_CONTRL_ENCODE(108, 0, 2, 0), handle);
  155. }
  156. #endif /* L_vsl_ends */
  157.  
  158. #ifdef L_vsm_type
  159.  
  160. /* vsm_type    set polymarker type
  161.  * returns type selected
  162.  */
  163. int vsm_type(int handle, int symbol)
  164. {
  165.     _intin[0] = symbol;
  166.     __vdi__(VDI_CONTRL_ENCODE(18, 0, 1, 0), handle);
  167.     return (int)_intout[0];
  168. }
  169. #endif /* L_vsm_type */
  170.  
  171. #ifdef L_vsm_heig
  172.  
  173. /* vsm_height    set polymarker height (in y coord units)
  174.  * returns void (height in _ptsout [0][1])
  175.  */
  176. void vsm_height(int handle, int height)
  177. {
  178.     _ptsin[0] = 0;
  179.     _ptsin[1] = height;
  180.     __vdi__(VDI_CONTRL_ENCODE(19, 1, 0, 0), handle);
  181. }
  182. #endif /* L_vsm_heig */
  183.  
  184. #ifdef L_vsm_colo
  185.  
  186. /* vsm_color    set polymarker color index
  187.  * returns selected color
  188.  */
  189. int vsm_color(int handle, int index)
  190. {
  191.     _intin[0] = index;
  192.     __vdi__(VDI_CONTRL_ENCODE(20, 0, 1, 0), handle);
  193.     return (int)_intout[0];
  194. }
  195. #endif /* L_vsm_colo */
  196.  
  197. #ifdef L_vst_heig
  198.  
  199. /* vst_height    set text height (baseline to top of char cell)
  200.  * returns void (char info args)
  201.  */
  202. int vst_height(int handle, int height,
  203.         int *charw, int *charh, int *cellw, int *cellh)
  204. {
  205.     _ptsin[0] = 0;
  206.     _ptsin[1] = height;
  207.     __vdi__(VDI_CONTRL_ENCODE(12, 1, 0, 0), handle);
  208.     
  209.     *charw = _ptsout[0];
  210.     *charh = _ptsout[1];
  211.     *cellw = _ptsout[2];
  212.     *cellh = _ptsout[3];
  213.  
  214.     return (int)_intout[0];        /* mmn */
  215. }    
  216. #endif /* L_vst_heig */
  217.  
  218. #ifdef L_vst_poin
  219.  
  220. /* vst_point    set char cell point size
  221.  * returns selected cell height in points (and info in args)
  222.  */
  223. int vst_point(int handle, int point,
  224.         int *charw, int *charh, int *cellw, int *cellh)
  225. {
  226.     _intin[0] = point;
  227.     __vdi__(VDI_CONTRL_ENCODE(107, 0, 1, 0), handle);
  228.     
  229.     *charw = _ptsout[0];
  230.     *charh = _ptsout[1];
  231.     *cellw = _ptsout[2];
  232.     *cellh = _ptsout[3];
  233.  
  234.     return (int)_intout[0];
  235. }    
  236. #endif /* L_vst_poin */
  237.  
  238. #ifdef L_vst_rota
  239.  
  240. /* vst_rotation    set char baseline rot
  241.  * returns angle selected
  242.  */
  243. int vst_rotation(int handle, int ang)
  244. {
  245.     _intin[0] = ang;
  246.     __vdi__(VDI_CONTRL_ENCODE(13, 0, 1, 0), handle);
  247.     return (int)_intout[0];
  248. }
  249. #endif /* L_vst_rota */
  250.  
  251. #ifdef L_vst_font
  252.  
  253. /* vst_font    set text face
  254.  * returns face selected
  255.  */
  256. int vst_font(int handle, int font)
  257. {
  258.     _intin[0] = font;
  259.     __vdi__(VDI_CONTRL_ENCODE(21, 0, 1, 0), handle);
  260.     return (int)_intout[0];
  261. }
  262. #endif /* L_vst_font */
  263.  
  264. #ifdef L_vst_colo
  265.  
  266. /* vst_color    set text color
  267.  * returns selected color
  268.  */
  269. int vst_color(int handle, int index)
  270. {
  271.     _intin[0] = index;
  272.     __vdi__(VDI_CONTRL_ENCODE(22, 0, 1, 0), handle);
  273.     return (int)_intout[0];
  274. }
  275. #endif /* L_vst_colo */
  276.  
  277. #ifdef L_vst_effe
  278.  
  279. /* vst_effects    set text atribs
  280.  * returns style actually selected
  281.  */
  282. int vst_effects(int handle, int effects)
  283. {
  284.     _intin[0] = effects;
  285.     __vdi__(VDI_CONTRL_ENCODE(106, 0, 1, 0), handle);
  286.     return (int)_intout[0];
  287. }
  288. #endif /* L_vst_effe */
  289.  
  290.  
  291. #ifdef L_vst_alig
  292.  
  293. /* vst_alignment    set text alignment
  294.  * returns void (results in args)
  295.  */
  296. void vst_alignment(int handle, int hin, int vin,
  297.            int *hout, int *vout)
  298. {
  299.     _intin[0] = hin;
  300.     _intin[1] = vin;
  301.     __vdi__(VDI_CONTRL_ENCODE(39, 0, 2, 0), handle);
  302.     
  303.     *hout = _intout[0];
  304.     *vout = _intout[1];
  305. }
  306. #endif /* L_vst_alig */
  307.  
  308. #ifdef L_vsf_inte
  309.  
  310. /* vsf_interior    set fill interior style
  311.  * returns style selected
  312.  */
  313. int vsf_interior(int handle, int style)
  314. {
  315.     _intin[0] = style;
  316.     __vdi__(VDI_CONTRL_ENCODE(23, 0, 1, 0), handle);
  317.     return (int)_intout[0];
  318. }
  319. #endif /* L_vsf_inte */
  320.  
  321. #ifdef L_vsf_fill
  322.  
  323. /* vsf_fill    set fill style
  324.  * returns style selected
  325.  */
  326. __asm__(".stabs \"_vsf_style\",5,0,0,_vsf_fill"); /* dept of clean tricks */
  327. int vsf_fill(int handle, int style)
  328. {
  329.     _intin[0] = style;
  330.     __vdi__(VDI_CONTRL_ENCODE(24, 0, 1, 0), handle);
  331.     return (int)_intout[0];
  332. }
  333. #endif /* L_vsf_fill */
  334.  
  335. #ifdef L_vsf_colo
  336.  
  337. /* vsf_color    set fill color
  338.  * returns color index selected
  339.  */
  340. int vsf_color(int handle, int index)
  341. {
  342.     _intin[0] = index;
  343.     __vdi__(VDI_CONTRL_ENCODE(25, 0, 1, 0), handle);
  344.     return (int)_intout[0];
  345. }
  346. #endif /* L_vsf_colo */
  347.  
  348. #ifdef L_vsf_peri
  349.  
  350. /* vsf_perimeter    set fill perimeter visibility
  351.  * returns visibility
  352.  */
  353. int vsf_perimeter(int handle, int vis)
  354. {
  355.     _intin[0] = vis;
  356.     __vdi__(VDI_CONTRL_ENCODE(104, 0, 1, 0), handle);
  357.     return (int)_intout[0];
  358. }
  359. #endif /* L_vsf_peri */
  360.  
  361. #ifdef L_vsf_udpa
  362.  
  363. /* vsf_udpat    set user defined fill pattern
  364.  * returns void
  365.  */
  366. void vsf_udpat(int handle, int pat[], int planes)
  367. {
  368. #ifndef __MSHORT__
  369.  
  370.     register int i, j;
  371.     
  372.     j = planes << 4;
  373.     for(i = 0; i < j; i++)
  374.     _intin[i] = pat[i];
  375.     __vdi__(VDI_CONTRL_ENCODE(112, 0, j, 0), handle);
  376. #else
  377.     _vdiparams[1] = &pat[0];
  378.     __vdi__(VDI_CONTRL_ENCODE(112, 0, (planes << 4), 0), handle);
  379.     _vdiparams[1] = (void *)&_intin[0];
  380. #endif
  381. }
  382. #endif /* L_vsf_udpa */
  383.  
  384. /* -eof- */
  385.