| 32260 |
ripley |
1 |
/*
|
|
|
2 |
* R : A Computer Langage for Statistical Data Analysis
|
|
|
3 |
* Copyright (C) 1998--2003 Guido Masarotto and Brian Ripley
|
|
|
4 |
* Copyright (C) 2004 The R Foundation
|
|
|
5 |
*
|
|
|
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
|
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
|
9 |
* (at your option) any later version.
|
|
|
10 |
*
|
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
14 |
* GNU General Public License for more details.
|
|
|
15 |
*
|
|
|
16 |
* You should have received a copy of the GNU General Public License
|
| 42300 |
ripley |
17 |
* along with this program; if not, a copy is available at
|
|
|
18 |
* http://www.r-project.org/Licenses/
|
| 32260 |
ripley |
19 |
*/
|
|
|
20 |
|
|
|
21 |
#include <Graphics.h>
|
|
|
22 |
#include <R_ext/Boolean.h>
|
|
|
23 |
|
|
|
24 |
enum DeviceKinds {SCREEN=0, PRINTER, METAFILE, PNG, JPEG, BMP};
|
|
|
25 |
|
|
|
26 |
typedef struct {
|
|
|
27 |
/* R Graphics Parameters */
|
|
|
28 |
/* local device copy so that we can detect */
|
|
|
29 |
/* when parameter changes */
|
|
|
30 |
int col; /* Color */
|
|
|
31 |
int bg; /* Background */
|
|
|
32 |
int fontface; /* Typeface */
|
| 34351 |
murdoch |
33 |
int fontsize, basefontsize; /* Size in points. fontsize has been adjusted
|
|
|
34 |
for dpi diffs, basefontsize has not */
|
| 32260 |
ripley |
35 |
double fontangle;
|
|
|
36 |
|
|
|
37 |
/* devga Driver Specific */
|
|
|
38 |
/* parameters with copy per devga device */
|
|
|
39 |
|
|
|
40 |
enum DeviceKinds kind;
|
|
|
41 |
int windowWidth; /* Window width (pixels) */
|
|
|
42 |
int windowHeight; /* Window height (pixels) */
|
|
|
43 |
int showWidth; /* device width (pixels) */
|
|
|
44 |
int showHeight; /* device height (pixels) */
|
|
|
45 |
int origWidth, origHeight, xshift, yshift;
|
|
|
46 |
Rboolean resize; /* Window resized */
|
|
|
47 |
window gawin; /* Graphics window */
|
|
|
48 |
/*FIXME: we should have union for this stuff and
|
|
|
49 |
maybe change gawin to canvas*/
|
|
|
50 |
/* SCREEN section*/
|
|
|
51 |
popup locpopup, grpopup;
|
|
|
52 |
button stoploc;
|
|
|
53 |
menubar mbar, mbarloc, mbarconfirm;
|
|
|
54 |
menu msubsave;
|
|
|
55 |
menuitem mpng, mbmp, mjpeg50, mjpeg75, mjpeg100;
|
|
|
56 |
menuitem mps, mpdf, mwm, mclpbm, mclpwm, mprint, mclose;
|
|
|
57 |
menuitem mrec, madd, mreplace, mprev, mnext, mclear, msvar, mgvar;
|
|
|
58 |
menuitem mR, mfit, mfix, grmenustayontop, mnextplot;
|
|
|
59 |
Rboolean recording, replaying, needsave;
|
| 42122 |
ripley |
60 |
bitmap bm, bm2;
|
| 32260 |
ripley |
61 |
/* PNG and JPEG section */
|
|
|
62 |
FILE *fp;
|
|
|
63 |
char filename[512];
|
|
|
64 |
int quality;
|
|
|
65 |
int npage;
|
|
|
66 |
double w, h;
|
|
|
67 |
/* Used to rescale font size so that bitmap devices have 72dpi */
|
|
|
68 |
int truedpi, wanteddpi;
|
|
|
69 |
rgb fgcolor; /* Foreground color */
|
|
|
70 |
rgb bgcolor; /* Background color */
|
|
|
71 |
rgb canvascolor; /* Canvas color */
|
|
|
72 |
rgb outcolor; /* Outside canvas color */
|
|
|
73 |
rect clip; /* The clipping rectangle */
|
|
|
74 |
Rboolean usefixed;
|
|
|
75 |
font fixedfont;
|
|
|
76 |
font font;
|
|
|
77 |
char fontfamily[50];
|
|
|
78 |
|
|
|
79 |
Rboolean locator;
|
|
|
80 |
Rboolean confirmation;
|
|
|
81 |
|
|
|
82 |
int clicked; /* {0,1,2} */
|
|
|
83 |
int px, py, lty, lwd;
|
|
|
84 |
int resizing; /* {1,2,3} */
|
|
|
85 |
double rescale_factor;
|
|
|
86 |
int fast; /* Use fast fixed-width lines? */
|
|
|
87 |
unsigned int pngtrans; /* what PNG_TRANS get mapped to */
|
|
|
88 |
Rboolean buffered;
|
|
|
89 |
int timeafter, timesince;
|
|
|
90 |
SEXP psenv;
|
|
|
91 |
double res_dpi;
|
|
|
92 |
R_GE_lineend lend;
|
|
|
93 |
R_GE_linejoin ljoin;
|
|
|
94 |
float lmitre;
|
|
|
95 |
Rboolean enterkey; /* Set true when enter key is hit */
|
|
|
96 |
SEXP eventRho; /* Environment during event handling */
|
|
|
97 |
SEXP eventResult; /* Result of event handler */
|
| 32261 |
ripley |
98 |
Rboolean (*newFrameConfirm)();
|
| 33769 |
ripley |
99 |
double lwdscale; /* scale factor for lwd */
|
| 34487 |
murdoch |
100 |
RCNTXT *cntxt; /* context for unwinding on error */
|
| 42124 |
ripley |
101 |
Rboolean have_alpha; /* support for AlphaBlend */
|
|
|
102 |
Rboolean warn_trans; /* Warn on use of translucency if not supported */
|
| 32260 |
ripley |
103 |
} gadesc;
|