home *** CD-ROM | disk | FTP | other *** search
- /*
- UNIX graphics package
- "graph98.c"
- Ver 1.0 ('89 8/2)
- (C) Mik
- * 89/09/25
- * 89/10/14 Halca.Hirano fix PC98XA label bug (by black-ROSe)
- * ---- V2.4.0 distribution ----
- */
-
- #include "option.h"
- #ifdef UOP_GRAPHICS
- #include <stdio.h>
- #include <math.h>
- #include "graph.h"
- #include "glio98.h"
-
- /* Current line mode */
- static int Current_mode;
-
- /* Current color */
- static int Current_color;
-
- /* graphics initialize */
- void graph_init()
- {
- Current_mode = 0;
- Current_color = WHITE;
- ginit();
- gscreen(
- /* disp_mode */
- 3, /* 640 * 400 full color mode */
- /* disp_switch */
- 0, /* on grapics + normal draw mode */
- /* active_pl */
- 0, /* page 0 */
- /* disp_pl */
- 1 /* page 0 */
- );
- gcolor1( /* back_color,border_color,fore_color mode */
- BLACK, BLACK, WHITE, BLACK);
- gcls();
- Current_mode = 0;
- }
-
- /* change line mode */
- void linemod(mod)
- int mod;
- {
- Current_mode = mod;
- }
-
- /* change color mode */
- void colormod(mod)
- int mod;
- {
- if(mod < 0 || mod > 7)
- Current_color = WHITE;
- else
- Current_color = mod;
- }
-
- /* draw point */
- void point(x,y)
- int x,y;
- {
- gpset(x,y,Current_color,1);
- }
-
- /* draw line */
- void line(x1,y1,x2,y2)
- int x1,y1,x2,y2;
- {
- gline(x1,y1,x2,y2,Current_color,0,0,0,0,0,0);
- }
-
- /* draw box */
- void box(x1,y1,x2,y2)
- int x1,y1,x2,y2;
- {
- gline(x1,y1,x2,y2,Current_color,1,0,0,0,0,0);
- }
-
- /* fill box */
- void boxfill(x1,y1,x2,y2)
- int x1,y1,x2,y2;
- {
- gline(x1,y1,x2,y2,Current_color,2,0,0,0,0,0);
- }
-
- /* draw string */
- int label(x,y,str)
- int x,y;
- char *str;
- {
- y -= 8;
- while(*str != '\0') {
- gput2(x,y,(unsigned)(*str),2,0,7,0);
- #ifdef PC98XA
- x += 12;
- #else
- x += 7;
- #endif /* PC98XA */
- str++;
-
- }
- return(x);
- }
-
- /* draw arc */
- void arc(xc,yc,rx,ry,xs,ys,xe,ye)
- int xc,yc,rx,ry,xs,ys,xe,ye;
- {
- gcircle(xc,yc,rx,ry,Current_color,0x05,xs,ys,xe,ye,0,0);
- }
-
- /* draw circle */
- void circle(x,y,rx,ry)
- int x,y,rx,ry;
- {
- gcircle(x,y,rx,ry,Current_color,0,0,0,0,0,0,0);
- }
-
- #endif /* UOP_GRAPHICS */
-