The R Project SVN R

Rev

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

Rev 3979 Rev 4022
Line 154... Line 154...
154
 * new graphics frame is started, the values revert to the defaults
154
 * new graphics frame is started, the values revert to the defaults
155
 *
155
 *
156
 */
156
 */
157
 
157
 
158
typedef struct {
158
typedef struct {
159
	/* Basic Device Driver Properties */
159
    /* Basic Device Driver Properties */
160
		/* These MUST be set by device drivers on open */
160
    /* These MUST be set by device drivers on open */
161
 
161
 
162
		/* These parameters cannot be set by the user */
162
    /* These parameters cannot be set by the user */
163
		/* although left, right, bottom, and top can be */
163
    /* although left, right, bottom, and top can be */
164
		/* interrogated indirectly (i.e., par("din")) */
164
    /* interrogated indirectly (i.e., par("din")) */
165
		/* and cra can be interrogated directly (i.e., par("cra")) */
165
    /* and cra can be interrogated directly (i.e., par("cra")) */
166
 
166
 
167
	double	left;		/* left raster coordinate */
167
    double left;	/* left raster coordinate */
168
	double	right;		/* right raster coordinate */
168
    double right;	/* right raster coordinate */
169
	double	bottom;		/* bottom raster coordinate */
169
    double bottom;	/* bottom raster coordinate */
170
	double	top;		/* top raster coordinate */
170
    double top;		/* top raster coordinate */
171
	double	xCharOffset;	/* x character addressing offset */
171
    double xCharOffset;	/* x character addressing offset */
172
	double	yCharOffset;	/* y character addressing offset */
172
    double yCharOffset;	/* y character addressing offset */
173
	double	yLineBias;	/* 1/2 interline space as fraction of line height */
173
    double yLineBias;	/* 1/2 interline space as fraction of line height */
174
	int	canResizePlot;	/* can the graphics surface be resized */
174
    int canResizePlot;	/* can the graphics surface be resized */
175
	int	canChangeFont;	/* device has multiple fonts */
175
    int canChangeFont;	/* device has multiple fonts */
176
	int	canRotateText;	/* text can be rotated */
176
    int canRotateText;	/* text can be rotated */
177
	int	canResizeText;	/* text can be resized */
177
    int canResizeText;	/* text can be resized */
178
	int	canClip;	/* Hardware clipping */
178
    int canClip;	/* Hardware clipping */
179
 
179
 
180
		/* a couple of the GRZ-like parameters that have to be */
180
    /* a couple of the GRZ-like parameters that have to be */
181
		/* set by the device */
181
    /* set by the device */
182
 
182
 
183
	double	ipr[2];		/* Inches per raster; [0]=x, [1]=y */
183
    double ipr[2];	/* Inches per raster; [0]=x, [1]=y */
184
	double	asp;		/* Pixel aspect ratio = ipr[1]/ipr[0] */
184
    double asp;		/* Pixel aspect ratio = ipr[1]/ipr[0] */
185
	double	cra[2];		/* Character size in rasters; [0]=x, [1]=y */
185
    double cra[2];	/* Character size in rasters; [0]=x, [1]=y */
186
 
186
 
187
	/* Plot State */
187
    /* Plot State */
188
		/* When the device driver is started this is 0 */
188
    /* When the device driver is started this is 0 */
189
		/* After the first call to plot.new it is 1 */
189
    /* After the first call to plot.new it is 1 */
190
		/* Every graphics operation except plot.new */
190
    /* Every graphics operation except plot.new */
191
		/* should fail if state = 0 */
191
    /* should fail if state = 0 */
192
		/* This is checked at the highest internal function */
192
    /* This is checked at the highest internal function */
193
		/* level (e.g., do_lines, do_axis, do_plot_xy, ...) */
193
    /* level (e.g., do_lines, do_axis, do_plot_xy, ...) */
194
 
194
 
195
	int	state;		/* Plot State */
195
    int	state;		/* Plot State */
196
	int	valid;		/* valid layout ? */
196
    int	valid;		/* valid layout ? */
197
 
197
 
198
	/* GRZ-like Graphics Parameters */
198
    /* GRZ-like Graphics Parameters */
199
		/* ``The horror, the horror ... '' */
199
    /* ``The horror, the horror ... '' */
200
		/* Marlon Brando - Appocalypse Now */
200
    /* Marlon Brando - Appocalypse Now */
201
 
201
 
202
 
202
    /* General Parameters -- set and interrogated directly */
203
		/* General Parameters -- set and interrogated directly */
203
 
204
 
204
    double adj;		/* String adjustment */
205
	double	adj;		/* String adjustment */
205
    int	ann;		/* Should annotation take place */
206
	int	ann;		/* Should annotation take place */
206
    int	ask;		/* User confirmation of ``page eject'' */
207
	int	ask;		/* User confirmation of ``page eject'' */
207
    rcolor bg;		/* **R ONLY** Background color */
208
	rcolor	bg;		/* **R ONLY** Background color */
208
    int	bty;		/* Box type */
209
	int	bty;		/* Box type */
209
    double cex;		/* Character expansion */
210
	double	cex;		/* Character expansion */
210
    rcolor col;		/* Plotting Color */
211
	rcolor	col;		/* Plotting Color */
211
    double crt;		/* Character/string rotation */
212
	double	crt;		/* Character/string rotation */
212
    double din[2];	/* device size in inches */
213
	double	din[2];		/* device size in inches */
213
    int	err;		/* Error repporting level */
214
	int	err;		/* Error repporting level */
214
    rcolor fg;		/* **R ONLY** Foreground Color */
215
	rcolor	fg;		/* **R ONLY** Foreground Color */
215
    int	font;		/* Text font */
216
	int	font;		/* Text font */
216
    double gamma;	/* Device Gamma Correction */
217
	double	gamma;		/* Device Gamma Correction */
217
    int	lab[3];		/* Axis labelling */
218
	int	lab[3];		/* Axis labelling */
218
			/* [0] = # ticks on x-axis */
219
				/* [0] = # ticks on x-axis */
219
			/* [1] = # ticks on y-axis */
220
				/* [1] = # ticks on y-axis */
220
			/* [2] = length of axis labels */
221
				/* [2] = length of axis labels */
221
    int	las;		/* Label style (rotation) */
222
	int	las;		/* Label style (rotation) */
222
    int	lty;		/* Line texture */
223
	int	lty;		/* Line texture */
223
    double lwd;		/* Line width */
224
	double	lwd;		/* Line width */
224
    double mgp[3];	/* Annotation location */
225
	double	mgp[3];		/* Annotation location */
225
			/* [0] = location of axis title */
226
				/* [0] = location of axis title */
226
			/* [1] = location of axis label */
227
				/* [1] = location of axis label */
227
			/* [2] = location of axis line */
228
				/* [2] = location of axis line */
228
    double mkh;		/* Mark size in inches */
229
	double	mkh;		/* Mark size in inches */
229
    int	pch;		/* Plotting character */
230
	int	pch;		/* Plotting character */
230
    int	ps;		/* Text & symbol pointsize */
231
	int	ps;		/* Text & symbol pointsize */
231
    int	smo;		/* Curve smoothness */
232
	int	smo;		/* Curve smoothness */
232
    double srt;		/* String Rotation */
233
	double	srt;		/* String Rotation */
233
    double tck;		/* Tick size as in S */
234
	double	tck;		/* Tick size as in S */
234
    double tcl;		/* Tick size in "lines" */
235
	double	tcl;		/* Tick size in "lines" */
235
    double tmag;	/* **R ONLY** Title Magnification */
236
	double	tmag;		/* **R ONLY** Title Magnification */
236
    int	type;		/* type of plot desired */
237
	int	type;		/* type of plot desired */
237
    double xaxp[3];	/* X Axis annotation */
238
	double	xaxp[3];	/* X Axis annotation */
238
			/* [0] = coordinate of lower tick */
239
				/* [0] = coordinate of lower tick */
239
			/* [1] = coordinate of upper tick */
240
				/* [1] = coordinate of upper tick */
240
			/* [2] = num tick intervals */
241
				/* [2] = num tick intervals */
241
			/* almost always used internally */
242
				/* almost always used internally */
242
    int	xaxs;		/* X Axis style */
243
	int	xaxs;		/* X Axis style */
243
    int	xaxt;		/* X Axis type */
244
	int	xaxt;		/* X Axis type */
244
    int	xpd;		/* Clip to plot region indicator */
245
	int	xpd;		/* Clip to plot region indicator */
245
    int	oldxpd;
246
	int	oldxpd;
246
    double yaxp[3];	/* Y Axis annotation */
247
	double	yaxp[3];	/* Y Axis annotation */
247
    int	yaxs;		/* Y Axis style */
248
	int	yaxs;		/* Y Axis style */
248
    int	yaxt;		/* Y Axis type */
249
	int	yaxt;		/* Y Axis type */
249
    int	xlog;		/* Log Axis for X */
250
	int	xlog;		/* Log Axis for X */
250
    int	ylog;		/* Log Axis for Y */
251
	int	ylog;		/* Log Axis for Y */
251
 
252
 
252
    /* Annotation Parameters */
253
		/* Annotation Parameters */
253
 
254
 
254
    float cexbase;	/* Base character size */
255
	float	cexbase;	/* Base character size */
255
    float cexmain;	/* Main title size */
256
	float	cexmain;	/* Main title size */
256
    float cexlab;	/* xlab and ylab size */
257
	float	cexlab;		/* xlab and ylab size */
257
    float cexsub;	/* Sub title size */
258
	float	cexsub;		/* Sub title size */
258
    float cexaxis;	/* Axis label size */
259
	float	cexaxis;	/* Axis label size */
259
 
260
 
260
    int	fontmain;	/* Main title font */
261
	int	fontmain;	/* Main title font */
261
    int	fontlab;	/* Xlab and ylab font */
262
	int	fontlab;	/* Xlab and ylab font */
262
    int	fontsub;	/* Subtitle font */
263
	int	fontsub;	/* Subtitle font */
263
    int	fontaxis;	/* Axis label fonts */
264
	int	fontaxis;	/* Axis label fonts */
264
 
265
 
265
    int	colmain;	/* Main title color */
266
	int	colmain;	/* Main title color */
266
    int	collab;		/* Xlab and ylab color */
267
	int	collab;		/* Xlab and ylab color */
267
    int	colsub;		/* Subtitle color */
268
	int	colsub;		/* Subtitle color */
268
    int	colaxis;	/* Axis label color */
269
	int	colaxis;	/* Axis label color */
269
 
270
 
270
    /* Layout Parameters */
271
		/* Layout Parameters */
271
 
272
 
272
    int	layout;		/* has a layout been specified */
273
	int	layout;		/* has a layout been specified */
273
 
274
 
274
    int	numrows;
275
	int	numrows;
275
    int	numcols;
276
	int	numcols;
276
    int	currentFigure;
277
	int	currentFigure;
277
    int	lastFigure;
278
	int	lastFigure;
278
    double heights[MAX_LAYOUT_ROWS];
279
	double	heights[MAX_LAYOUT_ROWS];
279
    double widths[MAX_LAYOUT_COLS];
280
	double	widths[MAX_LAYOUT_COLS];
280
    int	cmHeights[MAX_LAYOUT_ROWS];
281
	int	cmHeights[MAX_LAYOUT_ROWS];
281
    int	cmWidths[MAX_LAYOUT_COLS];
282
	int	cmWidths[MAX_LAYOUT_COLS];
282
    int	order[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
283
	int	order[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
283
    int	rspct;	        /* 0 = none, 1 = full, 2 = see respect */
284
	int	rspct;	/* 0 = none, 1 = full, 2 = see respect */
284
    int	respect[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
285
	int	respect[MAX_LAYOUT_ROWS][MAX_LAYOUT_COLS];
285
 
286
 
286
    int	mfind;		/* By row/col indicator */
287
	int	mfind;		/* By row/col indicator */
287
 
288
 
288
    /* Layout parameters which can be set directly by the */
289
		/* Layout parameters which can be set directly by the */
289
    /* user (e.g., par(fig=c(.5,1,0,1))) or otherwise are */
290
		/* user (e.g., par(fig=c(.5,1,0,1))) or otherwise are */
290
    /* calculated automatically */
291
		/* calculated automatically */
291
    /* NOTE that *Units parameters are for internal use only */
292
		/* NOTE that *Units parameters are for internal use only */
292
 
293
 
293
    double fig[4];	/* (current) Figure size (proportion) */
294
	double	fig[4];		/* (current) Figure size (proportion) */
294
			/* [0] = left, [1] = right */
295
				/* [0] = left, [1] = right */
295
			/* [2] = bottom, [3] = top */
296
				/* [2] = bottom, [3] = top */
296
    double fin[2];	/* (current) Figure size (inches) */
297
	double	fin[2];		/* (current) Figure size (inches) */
297
			/* [0] = width, [1] = height */
298
				/* [0] = width, [1] = height */
298
    int	fUnits;		/* (current) figure size units */
299
	int	fUnits;		/* (current) figure size units */
299
    int	defaultFigure;	/* calculate figure from layout ? */
300
	int	defaultFigure;	/* calculate figure from layout ? */
300
    double plt[4];	/* (current) Plot size (proportions) */
301
	double	plt[4];		/* (current) Plot size (proportions) */
301
			/* [0] = left, [1] = right */
302
				/* [0] = left, [1] = right */
302
			/* [2] = bottom, [3] = top */
303
				/* [2] = bottom, [3] = top */
303
    double pin[2];	/* (current) plot size (inches) */
304
	double	pin[2];		/* (current) plot size (inches) */
304
			/* [0] = width, [1] = height */
305
				/* [0] = width, [1] = height */
305
    int	pUnits;		/* (current) plot size units */
306
	int	pUnits;		/* (current) plot size units */
306
    int	defaultPlot;	/* calculate plot from figure - margins ? */
307
	int	defaultPlot;	/* calculate plot from figure - margins ? */
307
 
308
 
308
    /* Layout parameters which are set directly by the user */
309
		/* Layout parameters which are set directly by the user */
309
 
310
 
310
    double mar[4];	/* Plot margins in lines */
311
	double	mar[4];		/* Plot margins in lines */
311
    double mai[4];	/* Plot margins in inches */
312
	double	mai[4];		/* Plot margins in inches */
312
			/* [0] = bottom, [1] = left */
313
				/* [0] = bottom, [1] = left */
313
			/* [2] = top, [3] = right */
314
				/* [2] = top, [3] = right */
314
    int	mUnits;		/* plot margin units */
315
	int	mUnits;		/* plot margin units */
315
    double mex;		/* Margin expansion factor */
316
	double	mex;		/* Margin expansion factor */
316
    double oma[4];	/* Outer margins in lines */
317
	double	oma[4];		/* Outer margins in lines */
317
    double omi[4];	/* outer margins in inches */
318
	double	omi[4];		/* outer margins in inches */
318
    double omd[4];	/* outer margins in NDC */
319
	double	omd[4];		/* outer margins in NDC */
319
			/* [0] = bottom, [1] = left */
320
				/* [0] = bottom, [1] = left */
320
			/* [2] = top, [3] = right */
321
				/* [2] = top, [3] = right */
321
    int	oUnits;		/* outer margin units */
322
	int	oUnits;		/* outer margin units */
322
    int	pty;		/* Plot type */
323
	int	pty;		/* Plot type */
323
 
324
 
324
    /* Layout parameters which can be set by the user, but */
325
		/* Layout parameters which can be set by the user, but */
325
    /* almost always get automatically calculated anyway */
326
		/* almost always get automatically calculated anyway */
326
 
327
 
327
    double usr[4];	/* Graphics window */
328
	double	usr[4];		/* Graphics window */
328
			/* [0] = xmin, [1] = xmax */
329
				/* [0] = xmin, [1] = xmax */
329
			/* [2] = ymin, [3] = ymax */
330
				/* [2] = ymin, [3] = ymax */
330
 
331
 
331
    /* The logged usr parameter;  if xlog, use logusr[0:1] */
332
		/* The logged usr parameter;  if xlog, use logusr[0:1] */
332
    /* if ylog, use logusr[2:3] */
333
		/*			      if ylog, use logusr[2:3] */
333
 
334
 
334
    double logusr[4];
335
	double logusr[4];
335
 
336
 
336
    /* Layout parameter: Internal flags */
337
		/* Layout parameter: Internal flags */
337
 
338
 
338
    int	new;		/* Clean plot ? */
339
	int	new;		/* Clean plot ? */
339
    int	devmode;	/* creating new image or adding to existing one */
340
	int	devmode;	/* creating new image or adding to existing one */
340
 
341
 
341
    /* Coordinate System Mappings */
342
		/* Coordinate System Mappings */
342
    /* These are only used internally (i.e., cannot be */
343
		/* These are only used internally (i.e., cannot be */
343
    /* set directly by the user) */
344
		/* set directly by the user) */
344
 
345
 
345
    /* The reliability of these parameters relies on */
346
		/* The reliability of these parameters relies on */
346
    /* the fact that plot.new is the */
347
		/* the fact that plot.new is the */
347
    /* first graphics operation called in the creation */
348
		/* first graphics operation called in the creation */
348
    /* of a graph */
349
		/* of a graph */
349
 
350
 
350
    /* udpated per plot.new */
351
		/* udpated per plot.new */
351
 
352
 
352
    double xNDCPerChar;	/* Nominal character width (NDC) */
353
	double	xNDCPerChar;	/* Nominal character width (NDC) */
353
    double yNDCPerChar;	/* Nominal character height (NDC) */
354
	double	yNDCPerChar;	/* Nominal character height (NDC) */
354
    double xNDCPerLine;	/* Nominal line width (NDC) */
355
	double	xNDCPerLine;	/* Nominal line width (NDC) */
355
    double yNDCPerLine;	/* Nominal line height (NDC) */
356
	double	yNDCPerLine;	/* Nominal line height (NDC) */
356
    double xNDCPerInch;	/* xNDC -> Inches */
357
	double	xNDCPerInch;	/* xNDC -> Inches */
357
    double yNDCPerInch;	/* yNDC -> Inches */
358
	double	yNDCPerInch;	/* yNDC -> Inches */
358
 
359
 
359
    /* updated per plot.new and if inner2dev changes */
360
		/* updated per plot.new and if inner2dev changes */
360
 
361
 
361
    GTrans fig2dev;	/* Figure to device */
362
	GTrans	fig2dev;	/* Figure to device */
362
 
363
 
363
    /* udpated per DevNewPlot and if ndc2dev changes */
364
		/* udpated per DevNewPlot and if ndc2dev changes */
364
 
365
 
365
    GTrans inner2dev;	/* Inner region to device */
366
	GTrans	inner2dev;	/* Inner region to device */
366
 
367
 
367
    /* udpated per device resize */
368
		/* udpated per device resize */
368
 
369
 
369
    GTrans ndc2dev;	/* NDC to raw device */
370
	GTrans	ndc2dev;	/* NDC to raw device */
370
 
371
 
371
    /* updated per plot.new and per plot.window */
372
		/* updated per plot.new and per plot.window */
372
 
373
 
373
    GTrans win2fig;	/* Window to figure mapping */
374
	GTrans	win2fig;	/* Window to figure mapping */
374
 
375
 
375
    /* NOTE: if user has not set fig and/or plt then */
376
		/* NOTE: if user has not set fig and/or plt then */
376
    /* they need to be updated per plot.new too */
377
		/* they need to be updated per plot.new too */
377
 
378
 
378
    /* device operations */
379
		/* device operations */
379
    int (*open)();
380
	int (*open)();
380
    void (*close)();
381
	void (*close)();
381
    void (*activate)();
382
	void (*activate)();
382
    void (*deactivate)();
383
	void (*deactivate)();
383
    void (*resize)();
384
	void (*resize)();
384
    void (*newPage)();
385
	void (*newPage)();
385
    void (*clip)();
386
	void (*clip)();
386
    double (*strWidth)();
387
	double (*strWidth)();
387
    void (*line)();
388
	void (*line)();
388
    void (*polyline)();
389
	void (*polyline)();
389
    void (*text)();
390
	void (*text)();
390
    void (*dot)();
391
	void (*dot)();
391
    void (*rect)();
392
	void (*rect)();
392
    void (*circle)();
393
	void (*circle)();
393
    void (*polygon)();
394
	void (*polygon)();
394
    int (*locator)();
395
	int (*locator)();
395
    void (*mode)();
396
	void (*mode)();
396
    void (*hold)();
397
	void (*hold)();
397
    void (*metricInfo)();
398
	void (*metricInfo)();
-
 
399
} GPar;
398
} GPar;
400
 
399
 
401
typedef struct {
400
typedef struct {
402
	GPar dp;		/* current device default parameters */
401
	GPar dp;		/* current device default parameters */
403
	GPar gp;		/* current device current parameters */
402
	GPar gp;		/* current device current parameters */