xref: /plan9/sys/src/cmd/plot/libplot/mplot.h (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 #include <u.h>
2 #include <libc.h>
3 #include <stdio.h>
4 #include <libg.h>
5 #define SCX(A) ((((A) - e1->xmin)*e1->scalex  + e1->left)+.5)
6 #define SCY(A) ((((A) - e1->ymin)*e1->scaley + e1->bottom)+.5)
7 #define	SCR(A) ((A)*e1->scalex+.5)
8 #define unorm(y)	(double)(e1->sidey - y)
9 #define	BIGINT	0x3FFFFFFF	/* a large, but valid, int */
10 extern struct penvir {
11 	double left, bottom;
12 	double xmin, ymin;
13 	double scalex, scaley;
14 	double sidex, sidey;
15 	double copyx, copyy;
16 	double quantum;
17 	double grade;
18 	int pgap;
19 	double pslant;
20 	int pmode, foregr, backgr;
21 } *e0, *e1, *esave;
22 #define RADIAN 57.3	/* radians per degree */
23 struct seg {
24 	int x, y, X, Y;
25 	char stat;
26 };
27 /*
28  * Color values -- these only work with ldepth=3 & standard plan 9 color map
29  */
30 #define	RGB(r,g,b) (255&~(((r)<<5)|((g)<<2)|((b)>>1)))
31 #define ZERO	RGB(0,0,0)	/* really should be ~0, but bcolor uses neg for error */
32 #define RED	RGB(7,0,0)
33 #define GREEN	RGB(0,7,0)
34 #define YELLOW	RGB(7,7,0)
35 #define BLUE	RGB(0,0,7)
36 #define MAGENTA	RGB(7,0,7)
37 #define CYAN	RGB(0,7,7)
38 #define WHITE	RGB(7,7,7)
39 /*
40  * display parameters
41  */
42 int clipminx, clipminy, clipmaxx, clipmaxy;	/* clipping rectangle */
43 int mapminx, mapminy, mapmaxx, mapmaxy;		/* centered square */
44 /*
45  * Prototypes
46  */
47 #include "../plot.h"
48 void m_clrwin(int, int, int, int, int);
49 void m_finish(void);
50 void m_initialize(char *);
51 int m_text(int, int, char *, char *, int, int, int);
52 void m_vector(int, int, int, int, int);
53 void m_swapbuf(void);
54 void m_dblbuf(void);
55 int bcolor(char *);
56 void sscpy(struct penvir *, struct penvir *);
57