38 #ifndef R_GRAPHICSENGINE_H_
39 #define R_GRAPHICSENGINE_H_
78 #define R_GE_version 9
80 int R_GE_getVersion(
void);
82 void R_GE_checkVersionOrDie(
int version);
101 #define MAX_GRAPHICS_SYSTEMS 24
114 GE_FinaliseState = 1,
136 GE_SaveSnapshotState = 4,
139 GE_RestoreSnapshotState = 5,
204 char fontfamily[201];
207 typedef R_GE_gcontext* pGEcontext;
213 #include <R_ext/GraphicsDevice.h>
219 typedef struct _GEDevDesc GEDevDesc;
221 typedef SEXP (* GEcallback)(GEevent, GEDevDesc *,
SEXP);
229 void *systemSpecific;
262 Rboolean displayListOn;
271 Rboolean recordGraphics;
283 GESystemDesc *gesd[MAX_GRAPHICS_SYSTEMS];
293 typedef GEDevDesc* pGEDevDesc;
297 void setDisplayList(pGEDevDesc dev,
SEXP newDisplayList);
298 void saveSnapshot(pGEDevDesc dev,
SEXP newSnapshot);
302 #define desc2GEDesc Rf_desc2GEDesc
304 pGEDevDesc desc2GEDesc(pDevDesc dd);
305 int GEdeviceNumber(pGEDevDesc);
306 pGEDevDesc GEgetDevice(
int);
307 void GEaddDevice(pGEDevDesc);
308 void GEaddDevice2(pGEDevDesc,
const char *);
309 void GEkillDevice(pGEDevDesc);
310 pGEDevDesc GEcreateDevDesc(pDevDesc dev);
312 void GEdestroyDevDesc(pGEDevDesc dd);
313 void *GEsystemState(pGEDevDesc dd,
int index);
314 void GEregisterWithDevice(pGEDevDesc dd);
315 void GEregisterSystem(GEcallback callback,
int *systemRegisterIndex);
316 void GEunregisterSystem(
int registerIndex);
317 SEXP GEhandleEvent(GEevent event, pDevDesc dev,
SEXP data);
319 #define fromDeviceX GEfromDeviceX
320 #define toDeviceX GEtoDeviceX
321 #define fromDeviceY GEfromDeviceY
322 #define toDeviceY GEtoDeviceY
323 #define fromDeviceWidth GEfromDeviceWidth
324 #define toDeviceWidth GEtoDeviceWidth
325 #define fromDeviceHeight GEfromDeviceHeight
326 #define toDeviceHeight GEtoDeviceHeight
328 double fromDeviceX(
double value, GEUnit to, pGEDevDesc dd);
329 double toDeviceX(
double value, GEUnit from, pGEDevDesc dd);
330 double fromDeviceY(
double value, GEUnit to, pGEDevDesc dd);
331 double toDeviceY(
double value, GEUnit from, pGEDevDesc dd);
332 double fromDeviceWidth(
double value, GEUnit to, pGEDevDesc dd);
333 double toDeviceWidth(
double value, GEUnit from, pGEDevDesc dd);
334 double fromDeviceHeight(
double value, GEUnit to, pGEDevDesc dd);
335 double toDeviceHeight(
double value, GEUnit from, pGEDevDesc dd);
344 #define RGBpar Rf_RGBpar
345 #define RGBpar3 Rf_RGBpar3
346 #define col2name Rf_col2name
347 #define name2col Rf_name2col
351 unsigned int RGBpar(
SEXP,
int);
352 unsigned int RGBpar3(
SEXP,
int,
unsigned int);
355 const char *col2name(
unsigned int col);
356 unsigned int name2col(
const char *);
362 unsigned int R_GE_str2col(
const char *s);
403 #define LTY_DASHED 4 + (4<<4)
404 #define LTY_DOTTED 1 + (3<<4)
405 #define LTY_DOTDASH 1 + (3<<4) + (4<<8) + (3<<12)
406 #define LTY_LONGDASH 7 + (3<<4)
407 #define LTY_TWODASH 2 + (2<<4) + (6<<8) + (2<<12)
409 R_GE_lineend GE_LENDpar(
SEXP value,
int ind);
410 SEXP GE_LENDget(R_GE_lineend lend);
411 R_GE_linejoin GE_LJOINpar(
SEXP value,
int ind);
412 SEXP GE_LJOINget(R_GE_linejoin ljoin);
414 void GESetClip(
double x1,
double y1,
double x2,
double y2, pGEDevDesc dd);
415 void GENewPage(
const pGEcontext gc, pGEDevDesc dd);
416 void GELine(
double x1,
double y1,
double x2,
double y2,
417 const pGEcontext gc, pGEDevDesc dd);
418 void GEPolyline(
int n,
double *x,
double *y,
419 const pGEcontext gc, pGEDevDesc dd);
420 void GEPolygon(
int n,
double *x,
double *y,
421 const pGEcontext gc, pGEDevDesc dd);
422 SEXP GEXspline(
int n,
double *x,
double *y,
double *s, Rboolean open,
423 Rboolean repEnds, Rboolean draw,
424 const pGEcontext gc, pGEDevDesc dd);
425 void GECircle(
double x,
double y,
double radius,
426 const pGEcontext gc, pGEDevDesc dd);
427 void GERect(
double x0,
double y0,
double x1,
double y1,
428 const pGEcontext gc, pGEDevDesc dd);
429 void GEPath(
double *x,
double *y,
430 int npoly,
int *nper,
432 const pGEcontext gc, pGEDevDesc dd);
433 void GERaster(
unsigned int *raster,
int w,
int h,
434 double x,
double y,
double width,
double height,
435 double angle, Rboolean interpolate,
436 const pGEcontext gc, pGEDevDesc dd);
437 SEXP GECap(pGEDevDesc dd);
438 void GEText(
double x,
double y,
const char *
const str, cetype_t enc,
439 double xc,
double yc,
double rot,
440 const pGEcontext gc, pGEDevDesc dd);
441 void GEMode(
int mode, pGEDevDesc dd);
442 void GESymbol(
double x,
double y,
int pch,
double size,
443 const pGEcontext gc, pGEDevDesc dd);
444 void GEPretty(
double *lo,
double *up,
int *ndiv);
445 void GEMetricInfo(
int c,
const pGEcontext gc,
446 double *ascent,
double *descent,
double *width,
448 double GEStrWidth(
const char *str, cetype_t enc,
449 const pGEcontext gc, pGEDevDesc dd);
450 double GEStrHeight(
const char *str, cetype_t enc,
451 const pGEcontext gc, pGEDevDesc dd);
452 void GEStrMetric(
const char *str, cetype_t enc,
const pGEcontext gc,
453 double *ascent,
double *descent,
double *width,
455 int GEstring_to_pch(
SEXP pch);
462 unsigned int GE_LTYpar(
SEXP,
int);
463 SEXP GE_LTYget(
unsigned int);
468 void R_GE_rasterScale(
unsigned int *sraster,
int sw,
int sh,
469 unsigned int *draster,
int dw,
int dh);
470 void R_GE_rasterInterpolate(
unsigned int *sraster,
int sw,
int sh,
471 unsigned int *draster,
int dw,
int dh);
472 void R_GE_rasterRotatedSize(
int w,
int h,
double angle,
473 int *wnew,
int *hnew);
474 void R_GE_rasterRotatedOffset(
int w,
int h,
double angle,
int botleft,
475 double *xoff,
double *yoff);
476 void R_GE_rasterResizeForRotation(
unsigned int *sraster,
478 unsigned int *newRaster,
480 const pGEcontext gc);
481 void R_GE_rasterRotate(
unsigned int *sraster,
int w,
int h,
double angle,
482 unsigned int *draster,
const pGEcontext gc,
483 Rboolean perPixelAlpha);
489 double GEExpressionWidth(
SEXP expr,
490 const pGEcontext gc, pGEDevDesc dd);
491 double GEExpressionHeight(
SEXP expr,
492 const pGEcontext gc, pGEDevDesc dd);
493 void GEExpressionMetric(
SEXP expr,
const pGEcontext gc,
494 double *ascent,
double *descent,
double *width,
496 void GEMathText(
double x,
double y,
SEXP expr,
497 double xc,
double yc,
double rot,
498 const pGEcontext gc, pGEDevDesc dd);
506 SEXP GEcontourLines(
double *x,
int nx,
double *y,
int ny,
507 double *z,
double *levels,
int nl);
515 double R_GE_VStrWidth(
const char *s, cetype_t enc,
const pGEcontext gc, pGEDevDesc dd);
517 double R_GE_VStrHeight(
const char *s, cetype_t enc,
const pGEcontext gc, pGEDevDesc dd);
518 void R_GE_VText(
double x,
double y,
const char *
const s, cetype_t enc,
519 double x_justify,
double y_justify,
double rotation,
520 const pGEcontext gc, pGEDevDesc dd);
526 #define DEG2RAD 0.01745329251994329576
528 pGEDevDesc GEcurrentDevice(
void);
529 Rboolean GEdeviceDirty(pGEDevDesc dd);
530 void GEdirtyDevice(pGEDevDesc dd);
531 Rboolean GEcheckState(pGEDevDesc dd);
532 Rboolean GErecording(
SEXP call, pGEDevDesc dd);
533 void GErecordGraphicOperation(
SEXP op,
SEXP args, pGEDevDesc dd);
534 void GEinitDisplayList(pGEDevDesc dd);
535 void GEplayDisplayList(pGEDevDesc dd);
536 void GEcopyDisplayList(
int fromDevice);
537 SEXP GEcreateSnapshot(pGEDevDesc dd);
538 void GEplaySnapshot(
SEXP snapshot, pGEDevDesc dd);
540 void GEnullDevice(
void);
544 #define CreateAtVector Rf_CreateAtVector
545 SEXP CreateAtVector(
double*,
double*,
int, Rboolean);
547 #define GAxisPars Rf_GAxisPars
548 void GAxisPars(
double *min,
double *max,
int *n, Rboolean log,
int axis);