The R Project SVN R

Rev

Rev 5508 | Rev 6177 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5508 Rev 6098
Line 56... Line 56...
56
 *
56
 *
57
 *		red   = ((color	     ) & 255)
57
 *		red   = ((color	     ) & 255)
58
 *		green = ((color >>  8) & 255)
58
 *		green = ((color >>  8) & 255)
59
 *		blue  = ((color >> 16) & 255)
59
 *		blue  = ((color >> 16) & 255)
60
 */
60
 */
61
 
-
 
62
#define R_RGB(r,g,b)	((r)|((g)<<8)|((b)<<16))
61
#define R_RGB(r,g,b)	((r)|((g)<<8)|((b)<<16))
63
#define R_RED(col)	(((col)	   )&255)
62
#define R_RED(col)	(((col)	   )&255)
64
#define R_GREEN(col)	(((col)>> 8)&255)
63
#define R_GREEN(col)	(((col)>> 8)&255)
65
#define R_BLUE(col)	(((col)>>16)&255)
64
#define R_BLUE(col)	(((col)>>16)&255)
66
#define COLOR_TABLE_SIZE 256
65
#define COLOR_TABLE_SIZE 256
Line 71... Line 70...
71
#define LTY_DASHED	4 + (4<<4)
70
#define LTY_DASHED	4 + (4<<4)
72
#define LTY_DOTTED	1 + (3<<4)
71
#define LTY_DOTTED	1 + (3<<4)
73
#define LTY_DOTDASH	1 + (3<<4) + (4<<8) + (3<<12)
72
#define LTY_DOTDASH	1 + (3<<4) + (4<<8) + (3<<12)
74
#endif
73
#endif
75
 
74
 
-
 
75
/*
-
 
76
 *	Some Notes on Line Textures
-
 
77
 *
-
 
78
 *	Line textures are stored as an array of 4-bit integers within
-
 
79
 *	a single 32-bit word.  These integers contain the lengths of
-
 
80
 *	lines to be drawn with the pen alternately down and then up.
-
 
81
 *	The device should try to arrange that these values are measured
-
 
82
 *	in points if possible, although pixels is ok on most displays.
-
 
83
 *
-
 
84
 *	If newlty contains a line texture description it is decoded
76
#ifdef Win32
85
 *	as follows:
-
 
86
 *
77
#define LTY_SOLID	0
87
 *		ndash = 0;
78
#define LTY_DASHED	4 + (4<<4)
88
 *		for(i=0 ; i<8 && newlty & 15 ; i++) {
-
 
89
 *			dashlist[ndash++] = newlty & 15;
79
#define LTY_DOTTED	1 + (2<<4)
90
 *			newlty = newlty>>4;
-
 
91
 *		}
-
 
92
 *		dashlist[0] = length of pen-down segment
80
#define LTY_DOTDASH	1 + (3<<4) + (4<<8) + (3<<12)
93
 *		dashlist[1] = length of pen-up segment
81
#endif
94
 *		etc
-
 
95
 *
-
 
96
 *	An integer containing a zero terminates the pattern.  Hence
-
 
97
 *	ndash in this code fragment gives the length of the texture
-
 
98
 *	description.  If a description contains an odd number of
-
 
99
 *	elements it is replicated to create a pattern with an
-
 
100
 *	even number of elements.  (If this is a pain, do something
-
 
101
 *	different its not crucial).
-
 
102
 *
-
 
103
 */
82
 
104
 
-
 
105
/*--- The basic numbered & names line types; Here device-independent:
83
#ifdef Macintosh
106
  e.g. "dashed" == "44",  "dotdash" == "1343"
-
 
107
*/
84
#define LTY_SOLID	0
108
#define LTY_SOLID	0
85
#define LTY_DASHED	4 + (4<<4)
109
#define LTY_DASHED	4 + (4<<4)
86
#define LTY_DOTTED	1 + (3<<4)
110
#define LTY_DOTTED	1 + (3<<4)
87
#define LTY_DOTDASH	1 + (3<<4) + (4<<8) + (3<<12)
111
#define LTY_DOTDASH	1 + (3<<4) + (4<<8) + (3<<12)
88
#endif
-
 
89
 
-
 
90
#ifdef Windows
-
 
91
#define LTY_SOLID	PS_SOLID
-
 
92
#define LTY_DASHED	PS_DASH
112
#define LTY_LONGDASH	7 + (3<<4)
93
#define LTY_DOTTED	PS_DOT
-
 
94
#define LTY_DOTDASH	PS_DASHDOT
113
#define LTY_TWODASH	2 + (2<<4) + (6<<8) + (2<<12)
95
#endif
-
 
96
 
114
 
97
#define MAX_LAYOUT_ROWS 15
115
#define MAX_LAYOUT_ROWS 15
98
#define MAX_LAYOUT_COLS 15
116
#define MAX_LAYOUT_COLS 15
99
 
117
 
100
	/* possible coordinate systems (for specifying locations) */
118
	/* possible coordinate systems (for specifying locations) */
Line 122... Line 140...
122
#define LINES 14	/* multiples of a line in the margin (mex) */
140
#define LINES 14	/* multiples of a line in the margin (mex) */
123
#define CHARS 15	/* multiples of text height (cex) */
141
#define CHARS 15	/* multiples of text height (cex) */
124
 
142
 
125
#define R_MaxDevices 64
143
#define R_MaxDevices 64
126
 
144
 
-
 
145
#define	DEG2RAD 0.01745329251994329576
-
 
146
 
127
typedef unsigned int rcolor;
147
typedef unsigned int rcolor;
128
 
148
 
129
typedef struct {
149
typedef struct {
130
	double ax;
150
	double ax;
131
	double bx;
151
	double bx;
Line 404... Line 424...
404
	void *deviceSpecific;	/* pointer to device specific parameters */
424
	void *deviceSpecific;	/* pointer to device specific parameters */
405
	int displayListOn;	/* toggle for display list status */
425
	int displayListOn;	/* toggle for display list status */
406
	SEXP displayList;	/* display list */
426
	SEXP displayList;	/* display list */
407
} DevDesc;
427
} DevDesc;
408
 
428
 
409
		/* Drivers from ../main/devices.c , description there: */
429
		/* Drivers from ../main/dev....c , description there: */
410
 
430
 
411
int PSDeviceDriver(DevDesc*, char*, char*, char*,
431
int PSDeviceDriver(DevDesc*, char*, char*, char*,
412
		   char*, char*, double, double, double, double);
432
		   char*, char*, double, double, double, double, int, int);
413
 
433
 
414
int PicTeXDeviceDriver(DevDesc*, char*, char*, char*, double, double, int);
434
int PicTeXDeviceDriver(DevDesc*, char*, char*, char*, double, double, int);
415
 
435
 
416
 
-
 
417
/*ifdef Unix : ../unix/devX11.h	 only in few places*/
436
/*ifdef Unix : ../unix/devX11.h	 only in few places*/
418
 
437
 
419
#ifdef Win32
438
#ifdef Win32
420
int WinDeviceDriver(char**, int, double*, int);
439
int WinDeviceDriver(char**, int, double*, int);
421
#endif
440
#endif
Line 548... Line 567...
548
void GCircle(double, double, int, double, int, int, DevDesc*);
567
void GCircle(double, double, int, double, int, int, DevDesc*);
549
/* Set clipping region (based on current setting of dd->gp.xpd).
568
/* Set clipping region (based on current setting of dd->gp.xpd).
550
 * Only clip if new clipping region is different from the current one */
569
 * Only clip if new clipping region is different from the current one */
551
void GClip(DevDesc*);
570
void GClip(DevDesc*);
552
/* Polygon clipping: */
571
/* Polygon clipping: */
553
int GClipPolygon(double *, double *, int, int, int, 
572
int GClipPolygon(double *, double *, int, int, int,
554
		 double *, double *, DevDesc *);
573
		 double *, double *, DevDesc *);
555
/* Always clips */
574
/* Always clips */
556
void GForceClip(DevDesc*);
575
void GForceClip(DevDesc*);
557
/* Draw a line from (x1,y1) to (x2,y2): */
576
/* Draw a line from (x1,y1) to (x2,y2): */
558
void GLine(double, double, double, double, int, DevDesc*);
577
void GLine(double, double, double, double, int, DevDesc*);