1 /* 2 * R : A Computer Language 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 17 * along with this program; if not, a copy is available at 18 * https://www.R-project.org/Licenses/ 19 */ 20 21 #include <R_ext/GraphicsEngine.h> 22 #include <R_ext/Boolean.h> 23 24 enum DeviceKinds {SCREEN=0, PRINTER, METAFILE, PNG, JPEG, BMP, TIFF}; 25 26 typedef struct { 27 /* R Graphics Parameters */ 28 /* local device copy so that we can detect when parameter changes */ 29 int col; /* Color */ 30 int bg; /* Background */ 31 int fontface; /* Typeface */ 32 int fontsize, basefontsize; /* Size in points. 33 fontsize has been adjusted 34 for dpi diffs, basefontsize has not */ 35 double fontangle; 36 char basefontfamily[500]; /* Initial font family */ 37 38 /* devga Driver Specific */ 39 /* parameters with copy per devga device */ 40 41 enum DeviceKinds kind; 42 int windowWidth; /* Window width (pixels) */ 43 int windowHeight; /* Window height (pixels) */ 44 int showWidth; /* device width (pixels) */ 45 int showHeight; /* device height (pixels) */ 46 int origWidth, origHeight, xshift, yshift; 47 Rboolean resize; /* Window resized */ 48 window gawin; /* Graphics window */ 49 /*FIXME: we should have union for this stuff and 50 maybe change gawin to canvas*/ 51 /* SCREEN section*/ 52 popup locpopup, grpopup; 53 button stoploc; 54 menubar mbar, mbarloc, mbarconfirm; 55 menu msubsave; 56 menuitem mpng, mbmp, mjpeg50, mjpeg75, mjpeg100, mtiff; 57 menuitem mps, mpdf, mwm, mclpbm, mclpwm, mprint, mclose; 58 menuitem mrec, madd, mreplace, mprev, mnext, mclear, msvar, mgvar; 59 menuitem mR, mfit, mfix, grmenustayontop, mnextplot; 60 Rboolean recording, replaying, needsave; 61 bitmap bm, bm2; 62 63 /* PNG, JPEG, BMP, TIFF section */ 64 FILE *fp; 65 char filename[512]; 66 int quality; 67 int npage; 68 int res_dpi; /* Values >0 recorded in the file */ 69 70 double w, h; 71 rgb fgcolor; /* Foreground color */ 72 rgb bgcolor; /* Background color */ 73 rgb canvascolor; /* Canvas color */ 74 rgb outcolor; /* Outside canvas color */ 75 rect clip; /* The clipping rectangle */ 76 font font; 77 char fontfamily[100]; 78 int fontquality; 79 80 Rboolean locator; 81 Rboolean confirmation; 82 83 int clicked; /* {0,1,2} */ 84 int px, py, lty, lwd; 85 int resizing; /* {1,2,3} */ 86 double rescale_factor; 87 int fast; /* Use fast fixed-width lines? */ 88 unsigned int pngtrans; /* what PNG_TRANS get mapped to */ 89 Rboolean buffered; 90 int timeafter, timesince; 91 SEXP psenv; 92 R_GE_lineend lend; 93 R_GE_linejoin ljoin; 94 float lmitre; 95 Rboolean enterkey; /* Set true when enter key is hit */ 96 double lwdscale; /* scale factor for lwd */ 97 void *cntxt; /* context for unwinding on error */ 98 Rboolean have_alpha; /* support for AlphaBlend */ 99 Rboolean warn_trans; /* Warn on use of translucency if not supported */ 100 char title[101]; 101 Rboolean clickToConfirm; /* for NewFrameConfirm */ 102 Rboolean doSetPolyFill, fillOddEven; /* polygon fill mode */ 103 int holdlevel; 104 } gadesc; 105