| 1 |
/*
|
1 |
/*
|
| 2 |
* R : A Computer Langage for Statistical Data Analysis
|
2 |
* R : A Computer Langage for Statistical Data Analysis
|
| 3 |
* Copyright (C) 1998--2003 Guido Masarotto and Brian Ripley
|
3 |
* Copyright (C) 1998--2003 Guido Masarotto and Brian Ripley
|
| 4 |
* Copyright (C) 2004 The R Foundation
|
4 |
* Copyright (C) 2004 The R Foundation
|
| 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 |
#include <Graphics.h>
|
21 |
#include <Graphics.h>
|
| 22 |
#include <R_ext/Boolean.h>
|
22 |
#include <R_ext/Boolean.h>
|
| 23 |
|
23 |
|
| 24 |
enum DeviceKinds {SCREEN=0, PRINTER, METAFILE, PNG, JPEG, BMP};
|
24 |
enum DeviceKinds {SCREEN=0, PRINTER, METAFILE, PNG, JPEG, BMP};
|
| 25 |
|
25 |
|
| 26 |
typedef struct {
|
26 |
typedef struct {
|
| 27 |
/* R Graphics Parameters */
|
27 |
/* R Graphics Parameters */
|
| 28 |
/* local device copy so that we can detect */
|
28 |
/* local device copy so that we can detect */
|
| 29 |
/* when parameter changes */
|
29 |
/* when parameter changes */
|
| 30 |
int col; /* Color */
|
30 |
int col; /* Color */
|
| 31 |
int bg; /* Background */
|
31 |
int bg; /* Background */
|
| 32 |
int fontface; /* Typeface */
|
32 |
int fontface; /* Typeface */
|
| 33 |
int fontsize, basefontsize; /* Size in points */
|
33 |
int fontsize, basefontsize; /* Size in points. fontsize has been adjusted
|
| - |
|
34 |
for dpi diffs, basefontsize has not */
|
| 34 |
double fontangle;
|
35 |
double fontangle;
|
| 35 |
|
36 |
|
| 36 |
/* devga Driver Specific */
|
37 |
/* devga Driver Specific */
|
| 37 |
/* parameters with copy per devga device */
|
38 |
/* parameters with copy per devga device */
|
| 38 |
|
39 |
|
| 39 |
enum DeviceKinds kind;
|
40 |
enum DeviceKinds kind;
|
| 40 |
int windowWidth; /* Window width (pixels) */
|
41 |
int windowWidth; /* Window width (pixels) */
|
| 41 |
int windowHeight; /* Window height (pixels) */
|
42 |
int windowHeight; /* Window height (pixels) */
|
| 42 |
int showWidth; /* device width (pixels) */
|
43 |
int showWidth; /* device width (pixels) */
|
| 43 |
int showHeight; /* device height (pixels) */
|
44 |
int showHeight; /* device height (pixels) */
|
| 44 |
int origWidth, origHeight, xshift, yshift;
|
45 |
int origWidth, origHeight, xshift, yshift;
|
| 45 |
Rboolean resize; /* Window resized */
|
46 |
Rboolean resize; /* Window resized */
|
| 46 |
window gawin; /* Graphics window */
|
47 |
window gawin; /* Graphics window */
|
| 47 |
/*FIXME: we should have union for this stuff and
|
48 |
/*FIXME: we should have union for this stuff and
|
| 48 |
maybe change gawin to canvas*/
|
49 |
maybe change gawin to canvas*/
|
| 49 |
/* SCREEN section*/
|
50 |
/* SCREEN section*/
|
| 50 |
popup locpopup, grpopup;
|
51 |
popup locpopup, grpopup;
|
| 51 |
button stoploc;
|
52 |
button stoploc;
|
| 52 |
menubar mbar, mbarloc, mbarconfirm;
|
53 |
menubar mbar, mbarloc, mbarconfirm;
|
| 53 |
menu msubsave;
|
54 |
menu msubsave;
|
| 54 |
menuitem mpng, mbmp, mjpeg50, mjpeg75, mjpeg100;
|
55 |
menuitem mpng, mbmp, mjpeg50, mjpeg75, mjpeg100;
|
| 55 |
menuitem mps, mpdf, mwm, mclpbm, mclpwm, mprint, mclose;
|
56 |
menuitem mps, mpdf, mwm, mclpbm, mclpwm, mprint, mclose;
|
| 56 |
menuitem mrec, madd, mreplace, mprev, mnext, mclear, msvar, mgvar;
|
57 |
menuitem mrec, madd, mreplace, mprev, mnext, mclear, msvar, mgvar;
|
| 57 |
menuitem mR, mfit, mfix, grmenustayontop, mnextplot;
|
58 |
menuitem mR, mfit, mfix, grmenustayontop, mnextplot;
|
| 58 |
Rboolean recording, replaying, needsave;
|
59 |
Rboolean recording, replaying, needsave;
|
| 59 |
bitmap bm;
|
60 |
bitmap bm;
|
| 60 |
/* PNG and JPEG section */
|
61 |
/* PNG and JPEG section */
|
| 61 |
FILE *fp;
|
62 |
FILE *fp;
|
| 62 |
char filename[512];
|
63 |
char filename[512];
|
| 63 |
int quality;
|
64 |
int quality;
|
| 64 |
int npage;
|
65 |
int npage;
|
| 65 |
double w, h;
|
66 |
double w, h;
|
| 66 |
/* Used to rescale font size so that bitmap devices have 72dpi */
|
67 |
/* Used to rescale font size so that bitmap devices have 72dpi */
|
| 67 |
int truedpi, wanteddpi;
|
68 |
int truedpi, wanteddpi;
|
| 68 |
rgb fgcolor; /* Foreground color */
|
69 |
rgb fgcolor; /* Foreground color */
|
| 69 |
rgb bgcolor; /* Background color */
|
70 |
rgb bgcolor; /* Background color */
|
| 70 |
rgb canvascolor; /* Canvas color */
|
71 |
rgb canvascolor; /* Canvas color */
|
| 71 |
rgb outcolor; /* Outside canvas color */
|
72 |
rgb outcolor; /* Outside canvas color */
|
| 72 |
rect clip; /* The clipping rectangle */
|
73 |
rect clip; /* The clipping rectangle */
|
| 73 |
Rboolean usefixed;
|
74 |
Rboolean usefixed;
|
| 74 |
font fixedfont;
|
75 |
font fixedfont;
|
| 75 |
font font;
|
76 |
font font;
|
| 76 |
char fontfamily[50];
|
77 |
char fontfamily[50];
|
| 77 |
|
78 |
|
| 78 |
Rboolean locator;
|
79 |
Rboolean locator;
|
| 79 |
Rboolean confirmation;
|
80 |
Rboolean confirmation;
|
| 80 |
|
81 |
|
| 81 |
int clicked; /* {0,1,2} */
|
82 |
int clicked; /* {0,1,2} */
|
| 82 |
int px, py, lty, lwd;
|
83 |
int px, py, lty, lwd;
|
| 83 |
int resizing; /* {1,2,3} */
|
84 |
int resizing; /* {1,2,3} */
|
| 84 |
double rescale_factor;
|
85 |
double rescale_factor;
|
| 85 |
int fast; /* Use fast fixed-width lines? */
|
86 |
int fast; /* Use fast fixed-width lines? */
|
| 86 |
unsigned int pngtrans; /* what PNG_TRANS get mapped to */
|
87 |
unsigned int pngtrans; /* what PNG_TRANS get mapped to */
|
| 87 |
Rboolean buffered;
|
88 |
Rboolean buffered;
|
| 88 |
int timeafter, timesince;
|
89 |
int timeafter, timesince;
|
| 89 |
SEXP psenv;
|
90 |
SEXP psenv;
|
| 90 |
double res_dpi;
|
91 |
double res_dpi;
|
| 91 |
R_GE_lineend lend;
|
92 |
R_GE_lineend lend;
|
| 92 |
R_GE_linejoin ljoin;
|
93 |
R_GE_linejoin ljoin;
|
| 93 |
float lmitre;
|
94 |
float lmitre;
|
| 94 |
Rboolean enterkey; /* Set true when enter key is hit */
|
95 |
Rboolean enterkey; /* Set true when enter key is hit */
|
| 95 |
SEXP eventRho; /* Environment during event handling */
|
96 |
SEXP eventRho; /* Environment during event handling */
|
| 96 |
SEXP eventResult; /* Result of event handler */
|
97 |
SEXP eventResult; /* Result of event handler */
|
| 97 |
Rboolean (*newFrameConfirm)();
|
98 |
Rboolean (*newFrameConfirm)();
|
| 98 |
double lwdscale; /* scale factor for lwd */
|
99 |
double lwdscale; /* scale factor for lwd */
|
| 99 |
} gadesc;
|
100 |
} gadesc;
|