87 #ifndef R_EXT_QUARTZDEVICE_H_
88 #define R_EXT_QUARTZDEVICE_H_
101 #include <ApplicationServices/ApplicationServices.h>
103 typedef void* CGContextRef;
107 #define QNPF_REDRAW 0x0001
110 #define QDFLAG_DISPLAY_LIST 0x0001
111 #define QDFLAG_INTERACTIVE 0x0002
112 #define QDFLAG_RASTERIZED 0x0004
115 #define QPFLAG_ANTIALIAS 0x0100
117 typedef void* QuartzDesc_t;
119 typedef struct QuartzBackend_s {
121 double width, height;
122 double scalex, scaley, pointsize;
126 CGContextRef (*getCGContext)(QuartzDesc_t dev,
void*userInfo);
127 int (*locatePoint)(QuartzDesc_t dev,
void*userInfo,
double*x,
double*y);
128 void (*close)(QuartzDesc_t dev,
void*userInfo);
129 void (*newPage)(QuartzDesc_t dev,
void*userInfo,
int flags);
130 void (*state)(QuartzDesc_t dev,
void*userInfo,
int state);
131 void* (*par)(QuartzDesc_t dev,
void*userInfo,
int set,
const char *key,
void *value);
132 void (*sync)(QuartzDesc_t dev,
void*userInfo);
133 void* (*cap)(QuartzDesc_t dev,
void*userInfo);
137 typedef struct QuartzParameters_s {
139 const char *type, *file, *title;
140 double x, y, width, height, pointsize;
149 const char *pars1, *pars2;
151 } QuartzParameters_t;
154 QuartzDesc_t QuartzDevice_Create(
void *dd, QuartzBackend_t* def);
156 typedef struct QuartzFunctons_s {
157 void* (*Create)(
void *, QuartzBackend_t *);
158 int (*DevNumber)(QuartzDesc_t desc);
159 void (*Kill)(QuartzDesc_t desc);
160 void (*ResetContext)(QuartzDesc_t desc);
161 double (*GetWidth)(QuartzDesc_t desc);
162 double (*GetHeight)(QuartzDesc_t desc);
163 void (*SetSize)(QuartzDesc_t desc,
double width,
double height);
165 double (*GetScaledWidth)(QuartzDesc_t desc);
166 double (*GetScaledHeight)(QuartzDesc_t desc);
167 void (*SetScaledSize)(QuartzDesc_t desc,
double width,
double height);
169 double (*GetXScale)(QuartzDesc_t desc);
170 double (*GetYScale)(QuartzDesc_t desc);
171 void (*SetScale)(QuartzDesc_t desc,
double scalex,
double scaley);
173 void (*SetTextScale)(QuartzDesc_t desc,
double scale);
174 double (*GetTextScale)(QuartzDesc_t desc);
176 void (*SetPointSize)(QuartzDesc_t desc,
double ps);
177 double (*GetPointSize)(QuartzDesc_t desc);
179 int (*GetDirty)(QuartzDesc_t desc);
180 void (*SetDirty)(QuartzDesc_t desc,
int dirty);
182 void (*ReplayDisplayList)(QuartzDesc_t desc);
186 void* (*GetSnapshot)(QuartzDesc_t desc,
int last);
190 void (*RestoreSnapshot)(QuartzDesc_t desc,
void* snapshot);
193 int (*GetAntialias)(QuartzDesc_t desc);
194 void (*SetAntialias)(QuartzDesc_t desc,
int aa);
196 int (*GetBackground)(QuartzDesc_t desc);
197 void (*Activate)(QuartzDesc_t desc);
199 void* (*SetParameter)(QuartzDesc_t desc,
const char *key,
void *value);
200 void* (*GetParameter)(QuartzDesc_t desc,
const char *key);
203 #define QuartzParam_EmbeddingFlags "embeddeding flags"
204 #define QP_Flags_CFLoop 0x0001
205 #define QP_Flags_Cocoa 0x0002
206 #define QP_Flags_Front 0x0004
209 QuartzFunctions_t *getQuartzFunctions();
212 typedef QuartzDesc_t (*quartz_create_fn_t)(
void *dd, QuartzFunctions_t *fn, QuartzParameters_t *par);
225 QuartzDesc_t (*ptr_QuartzBackend)(
void *dd, QuartzFunctions_t *fn, QuartzParameters_t *par);
229 QuartzDesc_t Quartz_C(QuartzParameters_t *par, quartz_create_fn_t q_create,
int *errorCode);