42 #ifndef R_GRAPHICSDEVICE_H_
43 #define R_GRAPHICSDEVICE_H_
54 #ifndef R_USE_PROTOTYPES
55 # define R_USE_PROTOTYPES 1
56 # ifndef R_GRAPHICSENGINE_H_
57 # error R_ext/GraphicsEngine.h must be included first, and includes this header
61 #include <R_ext/Boolean.h>
98 typedef struct _DevDesc DevDesc;
99 typedef DevDesc* pDevDesc;
133 Rboolean canChangeGamma;
151 void *deviceSpecific;
155 Rboolean displayListOn;
164 Rboolean canGenMouseDown;
165 Rboolean canGenMouseMove;
166 Rboolean canGenMouseUp;
167 Rboolean canGenKeybd;
169 Rboolean gettingEvent;
208 void (*activate)(
const pDevDesc );
234 void (*circle)(
double x,
double y,
double r,
const pGEcontext gc, pDevDesc dd);
253 void (*clip)(
double x0,
double x1,
double y0,
double y1, pDevDesc dd);
269 void (*close)(pDevDesc dd);
286 void (*deactivate)(pDevDesc );
288 void (*deactivate)();
303 Rboolean (*locator)(
double *x,
double *y, pDevDesc dd);
305 Rboolean (*locator)();
320 void (*line)(
double x1,
double y1,
double x2,
double y2,
321 const pGEcontext gc, pDevDesc dd);
347 void (*metricInfo)(
int c,
const pGEcontext gc,
348 double* ascent,
double* descent,
double* width,
351 void (*metricInfo)();
366 void (*mode)(
int mode, pDevDesc dd);
384 void (*newPage)(
const pGEcontext gc, pDevDesc dd);
405 void (*polygon)(
int n,
const double *x,
const double *y,
const pGEcontext gc, pDevDesc dd);
423 void (*polyline)(
int n,
const double *x,
const double *y,
const pGEcontext gc, pDevDesc dd);
444 void (*rect)(
double x0,
double y0,
double x1,
double y1,
445 const pGEcontext gc, pDevDesc dd);
469 void (*path)(
double *x,
double *y,
470 int npoly,
int *nper,
472 const pGEcontext gc, pDevDesc dd);
492 void (*raster)(
unsigned int *raster,
int w,
int h,
494 double width,
double height,
496 Rboolean interpolate,
497 const pGEcontext gc, pDevDesc dd);
516 SEXP (*cap)(pDevDesc dd);
541 void (*size)(
double *left,
double *right,
double *bottom,
double *top,
559 double (*strWidth)(
const char *str,
const pGEcontext gc, pDevDesc dd);
561 double (*strWidth)();
578 void (*text)(
double x,
double y,
const char *str,
double rot,
579 double hadj,
const pGEcontext gc, pDevDesc dd);
593 void (*onExit)(pDevDesc dd);
595 void (*onExit)(
struct _NewDevDesc*);
601 SEXP (*getEvent)(
SEXP,
const char *);
616 Rboolean (*newFrameConfirm)(pDevDesc dd);
618 Rboolean (*newFrameConfirm)();
631 Rboolean hasTextUTF8;
633 void (*textUTF8)(
double x,
double y,
const char *str,
double rot,
634 double hadj,
const pGEcontext gc, pDevDesc dd);
635 double (*strWidthUTF8)(
const char *str,
const pGEcontext gc, pDevDesc dd);
638 double (*strWidthUTF8)();
640 Rboolean wantSymbolUTF8;
645 Rboolean useRotatedTextInContour;
665 void (*eventHelper)(pDevDesc dd,
int code);
667 void (*eventHelper)();
678 int (*holdflush)(pDevDesc dd,
int level);
686 int haveTransparency;
687 int haveTransparentBg;
689 int haveCapture, haveLocator;
762 #define R_RGB(r,g,b) ((r)|((g)<<8)|((b)<<16)|0xFF000000)
763 #define R_RGBA(r,g,b,a) ((r)|((g)<<8)|((b)<<16)|((a)<<24))
764 #define R_RED(col) (((col) )&255)
765 #define R_GREEN(col) (((col)>> 8)&255)
766 #define R_BLUE(col) (((col)>>16)&255)
767 #define R_ALPHA(col) (((col)>>24)&255)
768 #define R_OPAQUE(col) (R_ALPHA(col) == 255)
769 #define R_TRANSPARENT(col) (R_ALPHA(col) == 0)
773 #define R_TRANWHITE (R_RGBA(255, 255, 255, 0))
778 #define curDevice Rf_curDevice
779 #define killDevice Rf_killDevice
780 #define ndevNumber Rf_ndevNumber
781 #define NewFrameConfirm Rf_NewFrameConfirm
782 #define nextDevice Rf_nextDevice
783 #define NoDevices Rf_NoDevices
784 #define NumDevices Rf_NumDevices
785 #define prevDevice Rf_prevDevice
786 #define selectDevice Rf_selectDevice
787 #define AdobeSymbol2utf8 Rf_AdobeSymbol2utf8
790 int ndevNumber(pDevDesc );
795 int NumDevices(
void);
798 void R_CheckDeviceAvailable(
void);
799 Rboolean R_CheckDeviceAvailableBool(
void);
811 int selectDevice(
int);
814 void killDevice(
int);
818 void NewFrameConfirm(pDevDesc);
825 typedef enum {knUNKNOWN = -1,
826 knLEFT = 0, knUP, knRIGHT, knDOWN,
827 knF1, knF2, knF3, knF4, knF5, knF6, knF7, knF8, knF9, knF10,
829 knPGUP, knPGDN, knEND, knHOME, knINS, knDEL} R_KeyName;
833 typedef enum {meMouseDown = 0,
835 meMouseMove} R_MouseEvent;
838 #define middleButton 2
839 #define rightButton 4
841 #define doKeybd Rf_doKeybd
842 #define doMouseEvent Rf_doMouseEvent
844 void doMouseEvent(pDevDesc dd, R_MouseEvent event,
845 int buttons,
double x,
double y);
846 void doKeybd(pDevDesc dd, R_KeyName rkey,
847 const char *keyname);
855 #ifndef BEGIN_SUSPEND_INTERRUPTS
857 #define BEGIN_SUSPEND_INTERRUPTS do { \
858 Rboolean __oldsusp__ = R_interrupts_suspended; \
859 R_interrupts_suspended = TRUE;
860 #define END_SUSPEND_INTERRUPTS R_interrupts_suspended = __oldsusp__; \
861 if (R_interrupts_pending && ! R_interrupts_suspended) \
865 #include <R_ext/libextern.h>
868 extern void Rf_onintr(
void);
869 LibExtern Rboolean mbcslocale;
873 extern void *AdobeSymbol2utf8(
char*out,
const char *in,
int nwork);
874 int Rf_AdobeSymbol2ucs2(
int n);
876 extern size_t Rf_ucstoutf8(
char *s,
const unsigned int c);