home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / COMM / MISC / SRC26_2.ZIP / SRC / GRAPH98.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-23  |  2.0 KB  |  125 lines

  1. /*
  2.     UNIX graphics package
  3.         "graph98.c"
  4.         Ver 1.0   ('89 8/2)
  5.         (C) Mik
  6.  * 89/09/25
  7.  * 89/10/14 Halca.Hirano fix PC98XA label bug (by black-ROSe)
  8.  *      ---- V2.4.0 distribution ----
  9. */
  10.  
  11. #include "option.h"
  12. #ifdef UOP_GRAPHICS
  13. #include <stdio.h>
  14. #include <math.h>
  15. #include "graph.h"
  16. #include "glio98.h"
  17.  
  18. /* Current line mode */
  19. static    int    Current_mode;
  20.  
  21. /* Current color */
  22. static    int    Current_color;
  23.  
  24. /* graphics initialize */
  25. void    graph_init()
  26. {
  27.     Current_mode = 0;
  28.     Current_color = WHITE;
  29.     ginit();
  30.     gscreen(
  31. /* disp_mode */
  32.         3,    /* 640 * 400 full color mode */
  33. /* disp_switch */
  34.         0,    /* on grapics + normal draw mode */
  35. /* active_pl */
  36.         0,    /* page 0 */
  37. /* disp_pl */
  38.         1    /* page 0 */
  39.         );
  40.     gcolor1( /* back_color,border_color,fore_color mode */
  41.         BLACK, BLACK, WHITE, BLACK);
  42.     gcls();
  43.     Current_mode = 0;
  44. }
  45.  
  46. /* change line mode */
  47. void    linemod(mod)
  48. int    mod;
  49. {
  50.     Current_mode = mod;
  51. }
  52.  
  53. /* change color mode */
  54. void    colormod(mod)
  55. int    mod;
  56. {
  57.     if(mod < 0 || mod > 7)
  58.         Current_color = WHITE;
  59.     else
  60.         Current_color = mod;
  61. }
  62.  
  63. /* draw point */
  64. void    point(x,y)
  65. int    x,y;
  66. {
  67.     gpset(x,y,Current_color,1);
  68. }
  69.  
  70. /* draw line */
  71. void    line(x1,y1,x2,y2)
  72. int    x1,y1,x2,y2;
  73. {
  74.     gline(x1,y1,x2,y2,Current_color,0,0,0,0,0,0);
  75. }
  76.  
  77. /* draw box */
  78. void    box(x1,y1,x2,y2)
  79. int    x1,y1,x2,y2;
  80. {
  81.     gline(x1,y1,x2,y2,Current_color,1,0,0,0,0,0);
  82. }
  83.  
  84. /* fill box */
  85. void    boxfill(x1,y1,x2,y2)
  86. int     x1,y1,x2,y2;
  87. {
  88.     gline(x1,y1,x2,y2,Current_color,2,0,0,0,0,0);
  89. }
  90.  
  91. /* draw string */
  92. int    label(x,y,str)
  93. int    x,y;
  94. char    *str;
  95. {
  96.     y -= 8;
  97.     while(*str != '\0') {
  98.         gput2(x,y,(unsigned)(*str),2,0,7,0);
  99. #ifdef PC98XA
  100.         x += 12;
  101. #else
  102.         x += 7;
  103. #endif /* PC98XA */
  104.         str++;
  105.  
  106.     }
  107.     return(x);
  108. }
  109.  
  110. /* draw arc */
  111. void    arc(xc,yc,rx,ry,xs,ys,xe,ye)
  112. int    xc,yc,rx,ry,xs,ys,xe,ye;
  113. {
  114.     gcircle(xc,yc,rx,ry,Current_color,0x05,xs,ys,xe,ye,0,0);
  115. }
  116.  
  117. /* draw circle */
  118. void    circle(x,y,rx,ry)
  119. int    x,y,rx,ry;
  120. {
  121.     gcircle(x,y,rx,ry,Current_color,0,0,0,0,0,0,0);
  122. }
  123.  
  124. #endif /* UOP_GRAPHICS */
  125.