The R Project SVN R

Rev

Rev 10960 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10960 Rev 11067
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1998--2000  R Development Core Team
4
 *  Copyright (C) 1998--2000  R Development Core Team
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
10
 *
10
 *
11
 *  This program is distributed in the hope that it will be useful,
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
14
 *  GNU General Public License for more details.
15
 *
15
 *
16
 *  You should have received a copy of the GNU General Public License
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
19
 */
20
 
20
 
21
#ifndef GRAPHICS_H_
21
#ifndef GRAPHICS_H_
22
#define GRAPHICS_H_
22
#define GRAPHICS_H_
23
 
23
 
24
#define R_GRAPHICS_INTERNAL 1
24
#define R_GRAPHICS_INTERNAL 1
25
 
25
 
26
#include "R_ext/Boolean.h"
26
#include "R_ext/Boolean.h"
27
 
27
 
28
#define R_MaxDevices 64
28
#define R_MaxDevices 64
29
 
29
 
30
#define	DEG2RAD 0.01745329251994329576
30
#define	DEG2RAD 0.01745329251994329576
31
 
31
 
32
#define COLOR_TABLE_SIZE 1024
32
#define COLOR_TABLE_SIZE 1024
33
 
33
 
34
#define MAX_LAYOUT_ROWS 15
34
#define MAX_LAYOUT_ROWS 15
35
#define MAX_LAYOUT_COLS 15
35
#define MAX_LAYOUT_COLS 15
36
 
36
 
-
 
37
/* NOTE: during replays, call == R_NilValue;
-
 
38
   ----  the following adds readability: */
-
 
39
#define GRecording(call)  (call != R_NilValue)
-
 
40
 
37
typedef unsigned int rcolor;
41
typedef unsigned int rcolor;
38
 
42
 
39
typedef struct {
43
typedef struct {
40
	double ax;
44
	double ax;
41
	double bx;
45
	double bx;
42
	double ay;
46
	double ay;
43
	double by;
47
	double by;
44
} GTrans;
48
} GTrans;
45
 
49
 
46
	/* possible coordinate systems (for specifying locations) */
50
	/* possible coordinate systems (for specifying locations) */
47
typedef enum {
51
typedef enum {
48
 DEVICE	= 0,	/* native device coordinates (rasters) */
52
 DEVICE	= 0,	/* native device coordinates (rasters) */
49
 NDC	= 1,	/* normalised device coordinates x=(0,1), y=(0,1) */
53
 NDC	= 1,	/* normalised device coordinates x=(0,1), y=(0,1) */
50
 INCHES = 13,	/* inches x=(0,width), y=(0,height) */
54
 INCHES = 13,	/* inches x=(0,width), y=(0,height) */
51
 NIC	= 6,	/* normalised inner region coordinates (0,1) */
55
 NIC	= 6,	/* normalised inner region coordinates (0,1) */
52
 OMA1	= 2,	/* outer margin 1 (bottom) x=NIC, y=LINES */
56
 OMA1	= 2,	/* outer margin 1 (bottom) x=NIC, y=LINES */
53
 OMA2	= 3,	/* outer margin 2 (left) */
57
 OMA2	= 3,	/* outer margin 2 (left) */
54
 OMA3	= 4,	/* outer margin 3 (top) */
58
 OMA3	= 4,	/* outer margin 3 (top) */
55
 OMA4	= 5,	/* outer margin 4 (right) */
59
 OMA4	= 5,	/* outer margin 4 (right) */
56
 NFC	= 7,	/* normalised figure region coordinates (0,1) */
60
 NFC	= 7,	/* normalised figure region coordinates (0,1) */
57
 NPC	= 16,	/* normalised plot region coordinates (0,1) */
61
 NPC	= 16,	/* normalised plot region coordinates (0,1) */
58
 USER	= 12,	/* user/data/world corrdinates;
62
 USER	= 12,	/* user/data/world corrdinates;
59
		 * x,=(xmin,xmax), y=(ymin,ymax) */
63
		 * x,=(xmin,xmax), y=(ymin,ymax) */
60
 MAR1	= 8,	/* figure margin 1 (bottom) x=USER(x), y=LINES */
64
 MAR1	= 8,	/* figure margin 1 (bottom) x=USER(x), y=LINES */
61
 MAR2	= 9,	/* figure margin 2 (left)   x=USER(y), y=LINES */
65
 MAR2	= 9,	/* figure margin 2 (left)   x=USER(y), y=LINES */
62
 MAR3	= 10,	/* figure margin 3 (top)    x=USER(x), y=LINES */
66
 MAR3	= 10,	/* figure margin 3 (top)    x=USER(x), y=LINES */
63
 MAR4	= 11,	/* figure margin 4 (right)  x=USER(y), y=LINES */
67
 MAR4	= 11,	/* figure margin 4 (right)  x=USER(y), y=LINES */
64
 
68
 
65
	/* possible, units (for specifying dimensions) */
69
	/* possible, units (for specifying dimensions) */
66
	/* all of the above, plus ... */
70
	/* all of the above, plus ... */
67
 
71
 
68
 LINES = 14,	/* multiples of a line in the margin (mex) */
72
 LINES = 14,	/* multiples of a line in the margin (mex) */
69
 CHARS = 15	/* multiples of text height (cex) */
73
 CHARS = 15	/* multiples of text height (cex) */
70
} GUnit;
74
} GUnit;
71
 
75
 
72
 
76
 
73
typedef struct {
77
typedef struct {
74
    /* Basic Device Driver Properties */
78
    /* Basic Device Driver Properties */
75
    /* These MUST be set by device drivers on open */
79
    /* These MUST be set by device drivers on open */
76
 
80
 
77
    /* These parameters cannot be set by the user */
81
    /* These parameters cannot be set by the user */
78
    /* although left, right, bottom, and top can be */
82
    /* although left, right, bottom, and top can be */
79
    /* interrogated indirectly (i.e., par("din")) */
83
    /* interrogated indirectly (i.e., par("din")) */
80
    /* and cra can be interrogated directly (i.e., par("cra")) */
84
    /* and cra can be interrogated directly (i.e., par("cra")) */
81
 
85
 
82
    double left;	/* left raster coordinate */
86
    double left;	/* left raster coordinate */
83
    double right;	/* right raster coordinate */
87
    double right;	/* right raster coordinate */
84
    double bottom;	/* bottom raster coordinate */
88
    double bottom;	/* bottom raster coordinate */
85
    double top;		/* top raster coordinate */
89
    double top;		/* top raster coordinate */
86
    double xCharOffset;	/* x character addressing offset */
90
    double xCharOffset;	/* x character addressing offset */
87
    double yCharOffset;	/* y character addressing offset */
91
    double yCharOffset;	/* y character addressing offset */
88
    double yLineBias;	/* 1/2 interline space as fraction of line height */
92
    double yLineBias;	/* 1/2 interline space as fraction of line height */
89
    int canResizePlot;	/* can the graphics surface be resized */
93
    Rboolean canResizePlot;	/* can the graphics surface be resized */
90
    int canChangeFont;	/* device has multiple fonts */
94
    Rboolean canChangeFont;	/* device has multiple fonts */
91
    int canRotateText;	/* text can be rotated */
95
    Rboolean canRotateText;	/* text can be rotated */
92
    int canResizeText;	/* text can be resized */
96
    Rboolean canResizeText;	/* text can be resized */
93
    int canClip;	/* Hardware clipping */
97
    Rboolean canClip;		/* Hardware clipping */
94
    int canHAdj;	/* Can do at least some horizontal adjustment of text
98
    int canHAdj;	/* Can do at least some horizontal adjustment of text
95
			   0 = none, 1 = {0,0.5, 1}, 2 = [0,1] */
99
			   0 = none, 1 = {0,0.5, 1}, 2 = [0,1] */
96
 
100
 
97
    /* a couple of the GRZ-like parameters that have to be */
101
    /* a couple of the GRZ-like parameters that have to be */
98
    /* set by the device */
102
    /* set by the device */
99
 
103
 
100
    double ipr[2];	/* Inches per raster; [0]=x, [1]=y */
104
    double ipr[2];	/* Inches per raster; [0]=x, [1]=y */
101
    double asp;		/* Pixel aspect ratio = ipr[1]/ipr[0] */
105
    double asp;		/* Pixel aspect ratio = ipr[1]/ipr[0] */
102
    double cra[2];	/* Character size in rasters; [0]=x, [1]=y */
106
    double cra[2];	/* Character size in rasters; [0]=x, [1]=y */
103
 
107
 
104
    /* Plot State */
108
    /* Plot State */
105
    /* When the device driver is started this is 0 */
109
    /* When the device driver is started this is 0 */
106
    /* After the first call to plot.new it is 1 */
110
    /* After the first call to plot.new it is 1 */
107
    /* Every graphics operation except plot.new */
111
    /* Every graphics operation except plot.new */
108
    /* should fail if state = 0 */
112
    /* should fail if state = 0 */
109
    /* This is checked at the highest internal function */
113
    /* This is checked at the highest internal function */
110
    /* level (e.g., do_lines, do_axis, do_plot_xy, ...) */
114
    /* level (e.g., do_lines, do_axis, do_plot_xy, ...) */
111
 
115
 
112
    int	state;		/* Plot State */
116
    int	state;		/* Plot State */
113
    Rboolean valid;		/* valid layout ? */
117
    Rboolean valid;	/* valid layout ? */
114
 
118
 
115
    /* GRZ-like Graphics Parameters */
119
    /* GRZ-like Graphics Parameters */
116
    /* ``The horror, the horror ... '' */
120
    /* ``The horror, the horror ... '' */
117
    /* Marlon Brando - Appocalypse Now */
121
    /* Marlon Brando - Appocalypse Now */
118
 
122
 
119
    /* General Parameters -- set and interrogated directly */
123
    /* General Parameters -- set and interrogated directly */
120
 
124
 
121
    double adj;		/* String adjustment */
125
    double adj;		/* String adjustment */
122
    int	ann;		/* Should annotation take place */
126
    Rboolean ann;	/* Should annotation take place */
123
    int	ask;		/* User confirmation of ``page eject'' */
127
    Rboolean ask;	/* User confirmation of ``page eject'' */
124
    rcolor bg;		/* **R ONLY** Background color */
128
    rcolor bg;		/* **R ONLY** Background color */
125
    int	bty;		/* Box type */
129
    int	bty;		/* Box type */
126
    double cex;		/* Character expansion */
130
    double cex;		/* Character expansion */
127
    rcolor col;		/* Plotting Color */
131
    rcolor col;		/* Plotting Color */
128
    double crt;		/* Character/string rotation */
132
    double crt;		/* Character/string rotation */
129
    double din[2];	/* device size in inches */
133
    double din[2];	/* device size in inches */
130
    int	err;		/* Error repporting level */
134
    int	err;		/* Error repporting level */
131
    rcolor fg;		/* **R ONLY** Foreground Color */
135
    rcolor fg;		/* **R ONLY** Foreground Color */
132
    int	font;		/* Text font */
136
    int	font;		/* Text font */
133
    double gamma;	/* Device Gamma Correction */
137
    double gamma;	/* Device Gamma Correction */
134
    int	lab[3];		/* Axis labelling */
138
    int	lab[3];		/* Axis labelling */
135
			/* [0] = # ticks on x-axis */
139
			/* [0] = # ticks on x-axis */
136
			/* [1] = # ticks on y-axis */
140
			/* [1] = # ticks on y-axis */
137
			/* [2] = length of axis labels */
141
			/* [2] = length of axis labels */
138
    int	las;		/* Label style (rotation) */
142
    int	las;		/* Label style (rotation) */
139
    int	lty;		/* Line texture */
143
    int	lty;		/* Line texture */
140
    double lwd;		/* Line width */
144
    double lwd;		/* Line width */
141
    double mgp[3];	/* Annotation location */
145
    double mgp[3];	/* Annotation location */
142
			/* [0] = location of axis title */
146
			/* [0] = location of axis title */
143
			/* [1] = location of axis label */
147
			/* [1] = location of axis label */
144
			/* [2] = location of axis line */
148
			/* [2] = location of axis line */
145
    double mkh;		/* Mark size in inches */
149
    double mkh;		/* Mark size in inches */
146
    int	pch;		/* Plotting character */
150
    int	pch;		/* Plotting character */
147
    int	ps;		/* Text & symbol pointsize */
151
    int	ps;		/* Text & symbol pointsize */
148
    int	smo;		/* Curve smoothness */
152
    int	smo;		/* Curve smoothness */
149
    double srt;		/* String Rotation */
153
    double srt;		/* String Rotation */
150
    double tck;		/* Tick size as in S */
154
    double tck;		/* Tick size as in S */
151
    double tcl;		/* Tick size in "lines" */
155
    double tcl;		/* Tick size in "lines" */
152
    double tmag;	/* **R ONLY** Title Magnification */
156
    double tmag;	/* **R ONLY** Title Magnification */
153
    int	type;		/* type of plot desired */
157
    int	type;		/* type of plot desired */
154
    double xaxp[3];	/* X Axis annotation */
158
    double xaxp[3];	/* X Axis annotation */
155
			/* [0] = coordinate of lower tick */
159
			/* [0] = coordinate of lower tick */
156
			/* [1] = coordinate of upper tick */
160
			/* [1] = coordinate of upper tick */
157
			/* [2] = num tick intervals */
161
			/* [2] = num tick intervals */
158
			/* almost always used internally */
162
			/* almost always used internally */
159
    int	xaxs;		/* X Axis style */
163
    int	xaxs;		/* X Axis style */
160
    int	xaxt;		/* X Axis type */
164
    int	xaxt;		/* X Axis type */
161
    int	xpd;		/* Clip to plot region indicator */
165
    int	xpd;		/* Clip to plot region indicator */
162
    int	oldxpd;
166
    int	oldxpd;
163
    double yaxp[3];	/* Y Axis annotation */
167
    double yaxp[3];	/* Y Axis annotation */
164
    int	yaxs;		/* Y Axis style */
168
    int	yaxs;		/* Y Axis style */
165
    int	yaxt;		/* Y Axis type */
169
    int	yaxt;		/* Y Axis type */
166
    Rboolean xlog;	/* Log Axis for X */
170
    Rboolean xlog;	/* Log Axis for X */
167
    Rboolean ylog;	/* Log Axis for Y */
171
    Rboolean ylog;	/* Log Axis for Y */
168
 
172
 
169
    /* Annotation Parameters */
173
    /* Annotation Parameters */
170
 
174
 
171
    float cexbase;	/* Base character size */
175
    float cexbase;	/* Base character size */
172
    float cexmain;	/* Main title size */
176
    float cexmain;	/* Main title size */
173
    float cexlab;	/* xlab and ylab size */
177
    float cexlab;	/* xlab and ylab size */
174
    float cexsub;	/* Sub title size */
178
    float cexsub;	/* Sub title size */
175
    float cexaxis;	/* Axis label size */
179
    float cexaxis;	/* Axis label size */
176
 
180
 
177
    int	fontmain;	/* Main title font */
181
    int	fontmain;	/* Main title font */
178
    int	fontlab;	/* Xlab and ylab font */
182
    int	fontlab;	/* Xlab and ylab font */
179
    int	fontsub;	/* Subtitle font */
183
    int	fontsub;	/* Subtitle font */
180
    int	fontaxis;	/* Axis label fonts */
184
    int	fontaxis;	/* Axis label fonts */
181
 
185
 
182
    int	colmain;	/* Main title color */
186
    int	colmain;	/* Main title color */
183
    int	collab;		/* Xlab and ylab color */
187
    int	collab;		/* Xlab and ylab color */
184
    int	colsub;		/* Subtitle color */
188
    int	colsub;		/* Subtitle color */
185
    int	colaxis;	/* Axis label color */
189
    int	colaxis;	/* Axis label color */
186
 
190
 
187
    /* Layout Parameters */
191
    /* Layout Parameters */
188
 
192
 
189
    int	layout;		/* has a layout been specified */
193
    Rboolean layout;	/* has a layout been specified */
190
 
194
 
191
    int	numrows;
195
    int	numrows;
192
    int	numcols;
196
    int	numcols;
193
    int	currentFigure;
197
    int	currentFigure;
194
    int	lastFigure;
198
    int	lastFigure;
195
    double heights[MAX_LAYOUT_ROWS];
199
    double heights[MAX_LAYOUT_ROWS];
196
    double widths[MAX_LAYOUT_COLS];
200
    double widths[MAX_LAYOUT_COLS];
197
    int	cmHeights[MAX_LAYOUT_ROWS];
201
    int	cmHeights[MAX_LAYOUT_ROWS];
198
    int	cmWidths[MAX_LAYOUT_COLS];
202
    int	cmWidths[MAX_LAYOUT_COLS];
199
    int	order[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
203
    int	order[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
200
    int	rspct;		/* 0 = none, 1 = full, 2 = see respect */
204
    int	rspct;		/* 0 = none, 1 = full, 2 = see respect */
201
    int	respect[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
205
    int	respect[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
202
 
206
 
203
    int	mfind;		/* By row/col indicator */
207
    int	mfind;		/* By row/col indicator */
204
 
208
 
205
    /* Layout parameters which can be set directly by the */
209
    /* Layout parameters which can be set directly by the */
206
    /* user (e.g., par(fig=c(.5,1,0,1))) or otherwise are */
210
    /* user (e.g., par(fig=c(.5,1,0,1))) or otherwise are */
207
    /* calculated automatically */
211
    /* calculated automatically */
208
    /* NOTE that *Units parameters are for internal use only */
212
    /* NOTE that *Units parameters are for internal use only */
209
 
213
 
210
    double fig[4];	/* (current) Figure size (proportion) */
214
    double fig[4];	/* (current) Figure size (proportion) */
211
			/* [0] = left, [1] = right */
215
			/* [0] = left, [1] = right */
212
			/* [2] = bottom, [3] = top */
216
			/* [2] = bottom, [3] = top */
213
    double fin[2];	/* (current) Figure size (inches) */
217
    double fin[2];	/* (current) Figure size (inches) */
214
			/* [0] = width, [1] = height */
218
			/* [0] = width, [1] = height */
215
    GUnit fUnits;	/* (current) figure size units */
219
    GUnit fUnits;	/* (current) figure size units */
216
    int	defaultFigure;	/* calculate figure from layout ? */
-
 
217
    double plt[4];	/* (current) Plot size (proportions) */
220
    double plt[4];	/* (current) Plot size (proportions) */
218
			/* [0] = left, [1] = right */
221
			/* [0] = left, [1] = right */
219
			/* [2] = bottom, [3] = top */
222
			/* [2] = bottom, [3] = top */
220
    double pin[2];	/* (current) plot size (inches) */
223
    double pin[2];	/* (current) plot size (inches) */
221
			/* [0] = width, [1] = height */
224
			/* [0] = width, [1] = height */
222
    GUnit	pUnits;		/* (current) plot size units */
225
    GUnit pUnits;	/* (current) plot size units */
-
 
226
    Rboolean defaultFigure;	/* calculate figure from layout ? */
223
    int	defaultPlot;	/* calculate plot from figure - margins ? */
227
    Rboolean defaultPlot;	/* calculate plot from figure - margins ? */
224
 
228
 
225
    /* Layout parameters which are set directly by the user */
229
    /* Layout parameters which are set directly by the user */
226
 
230
 
227
    double mar[4];	/* Plot margins in lines */
231
    double mar[4];	/* Plot margins in lines */
228
    double mai[4];	/* Plot margins in inches */
232
    double mai[4];	/* Plot margins in inches */
229
			/* [0] = bottom, [1] = left */
233
			/* [0] = bottom, [1] = left */
230
			/* [2] = top, [3] = right */
234
			/* [2] = top, [3] = right */
231
    GUnit	mUnits;		/* plot margin units */
235
    GUnit mUnits;	/* plot margin units */
232
    double mex;		/* Margin expansion factor */
236
    double mex;		/* Margin expansion factor */
233
    double oma[4];	/* Outer margins in lines */
237
    double oma[4];	/* Outer margins in lines */
234
    double omi[4];	/* outer margins in inches */
238
    double omi[4];	/* outer margins in inches */
235
    double omd[4];	/* outer margins in NDC */
239
    double omd[4];	/* outer margins in NDC */
236
			/* [0] = bottom, [1] = left */
240
			/* [0] = bottom, [1] = left */
237
			/* [2] = top, [3] = right */
241
			/* [2] = top, [3] = right */
238
    GUnit	oUnits;		/* outer margin units */
242
    GUnit oUnits;	/* outer margin units */
239
    int	pty;		/* Plot type */
243
    int	pty;		/* Plot type */
240
 
244
 
241
    /* Layout parameters which can be set by the user, but */
245
    /* Layout parameters which can be set by the user, but */
242
    /* almost always get automatically calculated anyway */
246
    /* almost always get automatically calculated anyway */
243
 
247
 
244
    double usr[4];	/* Graphics window */
248
    double usr[4];	/* Graphics window */
245
			/* [0] = xmin, [1] = xmax */
249
			/* [0] = xmin, [1] = xmax */
246
			/* [2] = ymin, [3] = ymax */
250
			/* [2] = ymin, [3] = ymax */
247
 
251
 
248
    /* The logged usr parameter;  if xlog, use logusr[0:1] */
252
    /* The logged usr parameter;  if xlog, use logusr[0:1] */
249
    /* if ylog, use logusr[2:3] */
253
    /* if ylog, use logusr[2:3] */
250
 
254
 
251
    double logusr[4];
255
    double logusr[4];
252
 
256
 
253
    /* Layout parameter: Internal flags */
257
    /* Layout parameter: Internal flags */
254
 
258
 
255
    Rboolean new;	/* Clean plot ? */
259
    Rboolean new;	/* Clean plot ? */
256
    int	devmode;	/* creating new image or adding to existing one */
260
    int	devmode;	/* creating new image or adding to existing one */
257
 
261
 
258
    /* Coordinate System Mappings */
262
    /* Coordinate System Mappings */
259
    /* These are only used internally (i.e., cannot be */
263
    /* These are only used internally (i.e., cannot be */
260
    /* set directly by the user) */
264
    /* set directly by the user) */
261
 
265
 
262
    /* The reliability of these parameters relies on */
266
    /* The reliability of these parameters relies on */
263
    /* the fact that plot.new is the */
267
    /* the fact that plot.new is the */
264
    /* first graphics operation called in the creation */
268
    /* first graphics operation called in the creation */
265
    /* of a graph */
269
    /* of a graph */
266
 
270
 
267
    /* udpated per plot.new */
271
    /* udpated per plot.new */
268
 
272
 
269
    double xNDCPerChar;	/* Nominal character width (NDC) */
273
    double xNDCPerChar;	/* Nominal character width (NDC) */
270
    double yNDCPerChar;	/* Nominal character height (NDC) */
274
    double yNDCPerChar;	/* Nominal character height (NDC) */
271
    double xNDCPerLine;	/* Nominal line width (NDC) */
275
    double xNDCPerLine;	/* Nominal line width (NDC) */
272
    double yNDCPerLine;	/* Nominal line height (NDC) */
276
    double yNDCPerLine;	/* Nominal line height (NDC) */
273
    double xNDCPerInch;	/* xNDC -> Inches */
277
    double xNDCPerInch;	/* xNDC -> Inches */
274
    double yNDCPerInch;	/* yNDC -> Inches */
278
    double yNDCPerInch;	/* yNDC -> Inches */
275
 
279
 
276
    /* updated per plot.new and if inner2dev changes */
280
    /* updated per plot.new and if inner2dev changes */
277
 
281
 
278
    GTrans fig2dev;	/* Figure to device */
282
    GTrans fig2dev;	/* Figure to device */
279
 
283
 
280
    /* udpated per DevNewPlot and if ndc2dev changes */
284
    /* udpated per DevNewPlot and if ndc2dev changes */
281
 
285
 
282
    GTrans inner2dev;	/* Inner region to device */
286
    GTrans inner2dev;	/* Inner region to device */
283
 
287
 
284
    /* udpated per device resize */
288
    /* udpated per device resize */
285
 
289
 
286
    GTrans ndc2dev;	/* NDC to raw device */
290
    GTrans ndc2dev;	/* NDC to raw device */
287
 
291
 
288
    /* updated per plot.new and per plot.window */
292
    /* updated per plot.new and per plot.window */
289
 
293
 
290
    GTrans win2fig;	/* Window to figure mapping */
294
    GTrans win2fig;	/* Window to figure mapping */
291
 
295
 
292
    /* NOTE: if user has not set fig and/or plt then */
296
    /* NOTE: if user has not set fig and/or plt then */
293
    /* they need to be updated per plot.new too */
297
    /* they need to be updated per plot.new too */
294
 
298
 
295
    /* device operations */
299
    /* device operations */
296
    int (*open)();
300
    Rboolean (*open)();
297
    void (*close)();
301
    void (*close)();
298
    void (*activate)();
302
    void (*activate)();
299
    void (*deactivate)();
303
    void (*deactivate)();
300
    void (*resize)();
304
    void (*resize)();
301
    void (*newPage)();
305
    void (*newPage)();
302
    void (*clip)();
306
    void (*clip)();
303
    double (*strWidth)();
307
    double (*strWidth)();
304
    void (*line)();
308
    void (*line)();
305
    void (*polyline)();
309
    void (*polyline)();
306
    void (*text)();
310
    void (*text)();
307
    void (*dot)();
311
    void (*dot)();
308
    void (*rect)();
312
    void (*rect)();
309
    void (*circle)();
313
    void (*circle)();
310
    void (*polygon)();
314
    void (*polygon)();
311
    int (*locator)();
315
    Rboolean (*locator)();
312
    void (*mode)();
316
    void (*mode)();
313
    void (*hold)();
317
    void (*hold)();
314
    void (*metricInfo)();
318
    void (*metricInfo)();
315
} GPar;
319
} GPar;
316
 
320
 
317
typedef struct {
321
typedef struct {
318
	GPar dp;		/* current device default parameters */
322
	GPar dp;		/* current device default parameters */
319
	GPar gp;		/* current device current parameters */
323
	GPar gp;		/* current device current parameters */
320
	GPar dpSaved;		/* saved device default parameters */
324
	GPar dpSaved;		/* saved device default parameters */
321
	void *deviceSpecific;	/* pointer to device specific parameters */
325
	void *deviceSpecific;	/* pointer to device specific parameters */
322
	int displayListOn;	/* toggle for display list status */
326
	Rboolean displayListOn;	/* toggle for display list status */
323
	SEXP displayList;	/* display list */
327
	SEXP displayList;	/* display list */
324
} DevDesc;
328
} DevDesc;
325
 
329
 
-
 
330
/* For easy reference: Here are the source files of 
-
 
331
 * currently existing device drivers:
-
 
332
 * FILE				driver name prefix
-
 
333
 * ----------------------	------------------
-
 
334
 * ../main/devPS.c		PS  _and_  XFig
-
 
335
 * ../main/devPicTeX.c		PicTeX
-
 
336
 * ../unix/X11/devX11.c		X11
-
 
337
 * ../gnuwin32/devga.c		GA
-
 
338
 * ../unix/gnome/devGTK.c	GTK
-
 
339
 * ../unix/gnome/devGNOME.c	Gnome
-
 
340
 */
-
 
341
 
326
#include "R_ext/Graphics.h"
342
#include "R_ext/Graphics.h"
327
 
343
 
328
/* Default the settings for general graphical parameters
344
/* Default the settings for general graphical parameters
329
 * (i.e., defaults that do not depend on the device type: */
345
 * (i.e., defaults that do not depend on the device type: */
330
#define GInit			Rf_GInit
346
#define GInit			Rf_GInit
331
void GInit(GPar*);
347
void GInit(GPar*);
332
 
348
 
333
#endif /* GRAPHICS_H_ */
349
#endif /* GRAPHICS_H_ */