The R Project SVN R

Rev

Rev 26207 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26207 Rev 27236
Line 15... Line 15...
15
 *  You should have received a copy of the GNU Library General Public
15
 *  You should have received a copy of the GNU Library General Public
16
 *  License along with this library; if not, write to the Free
16
 *  License along with this library; if not, write to the Free
17
 *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17
 *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18
 *  MA 02111-1307, USA
18
 *  MA 02111-1307, USA
19
 *
19
 *
20
 *  $Id: rproxy_dev.c,v 1.6 2003/09/13 15:14:09 murdoch Exp $
20
 *  $Id: rproxy_dev.c,v 1.7 2003/11/26 20:50:15 murrell Exp $
21
 */
21
 */
22
 
22
 
23
/* virtual device size */
23
/* virtual device size */
24
#define DEV_X 500
24
#define DEV_X 500
25
#define DEV_Y 500
25
#define DEV_Y 500
Line 51... Line 51...
51
#endif
51
#endif
52
#define MessageBox(a,b,c,d)
52
#define MessageBox(a,b,c,d)
53
 
53
 
54
static void R_Proxy_Graphics_Activate(NewDevDesc *dd);
54
static void R_Proxy_Graphics_Activate(NewDevDesc *dd);
55
static void R_Proxy_Graphics_Circle(double x, double y, double r,
55
static void R_Proxy_Graphics_Circle(double x, double y, double r,
56
		      int col, int fill, double gamma, int lty, double lwd,
56
				    R_GE_gcontext *gc,
57
		      NewDevDesc *dd);
57
				    NewDevDesc *dd);
58
static void R_Proxy_Graphics_Clip(double x0, double x1, double y0, double y1,
58
static void R_Proxy_Graphics_Clip(double x0, double x1, double y0, double y1,
59
		     NewDevDesc *dd);
59
		     NewDevDesc *dd);
60
static void R_Proxy_Graphics_Close(NewDevDesc *dd);
60
static void R_Proxy_Graphics_Close(NewDevDesc *dd);
61
static void R_Proxy_Graphics_Deactivate(NewDevDesc *dd);
61
static void R_Proxy_Graphics_Deactivate(NewDevDesc *dd);
62
static void R_Proxy_Graphics_Hold(NewDevDesc *dd);
62
static void R_Proxy_Graphics_Hold(NewDevDesc *dd);
63
static Rboolean R_Proxy_Graphics_Locator(double *x, double *y, NewDevDesc *dd);
63
static Rboolean R_Proxy_Graphics_Locator(double *x, double *y, NewDevDesc *dd);
64
static void R_Proxy_Graphics_Line(double x1, double y1, double x2, double y2,
64
static void R_Proxy_Graphics_Line(double x1, double y1, double x2, double y2,
65
		    int col, double gamma, int lty, double lwd,
65
				  R_GE_gcontext *gc,
66
		    NewDevDesc *dd);
66
				  NewDevDesc *dd);
67
static void R_Proxy_Graphics_MetricInfo(int c, int font, double cex, double ps,
67
static void R_Proxy_Graphics_MetricInfo(int c, 
-
 
68
					R_GE_gcontext *gc,
68
			  double* ascent, double* descent,
69
					double* ascent, double* descent,
69
			  double* width, NewDevDesc *dd);
70
					double* width, NewDevDesc *dd);
70
static void R_Proxy_Graphics_Mode(int mode, NewDevDesc *dd);
71
static void R_Proxy_Graphics_Mode(int mode, NewDevDesc *dd);
71
static void R_Proxy_Graphics_NewPage(int fill, double gamma, NewDevDesc *dd);
72
static void R_Proxy_Graphics_NewPage(R_GE_gcontext *gc,
-
 
73
				     NewDevDesc *dd);
72
static void R_Proxy_Graphics_Polygon(int n, double *x, double *y,
74
static void R_Proxy_Graphics_Polygon(int n, double *x, double *y,
73
		       int col, int fill, double gamma, int lty, double lwd,
75
				     R_GE_gcontext *gc,
74
		       NewDevDesc *dd);
76
				     NewDevDesc *dd);
75
static void R_Proxy_Graphics_Polyline(int n, double *x, double *y,
77
static void R_Proxy_Graphics_Polyline(int n, double *x, double *y,
76
			int col, double gamma, int lty, double lwd,
78
				      R_GE_gcontext *gc,
77
			NewDevDesc *dd);
79
				      NewDevDesc *dd);
78
static void R_Proxy_Graphics_Rect(double x0, double y0, double x1, double y1,
80
static void R_Proxy_Graphics_Rect(double x0, double y0, double x1, double y1,
79
		    int col, int fill, double gamma, int lty, double lwd,
81
				  R_GE_gcontext *gc,
80
		    NewDevDesc *dd);
82
				  NewDevDesc *dd);
81
static void R_Proxy_Graphics_Size(double *left, double *right,
83
static void R_Proxy_Graphics_Size(double *left, double *right,
82
		    double *bottom, double *top,
84
				  double *bottom, double *top,
83
		    NewDevDesc *dd);
85
				  NewDevDesc *dd);
84
#ifdef UNUSED
86
#ifdef UNUSED
85
static void R_Proxy_Graphics_Resize(NewDevDesc *dd);
87
static void R_Proxy_Graphics_Resize(NewDevDesc *dd);
86
#endif
88
#endif
87
static double R_Proxy_Graphics_StrWidth(char *str, int font,
89
static double R_Proxy_Graphics_StrWidth(char *str, 
-
 
90
					R_GE_gcontext *gc,
88
			  double cex, double ps, NewDevDesc *dd);
91
					NewDevDesc *dd);
89
static void R_Proxy_Graphics_Text(double x, double y, char *str,
92
static void R_Proxy_Graphics_Text(double x, double y, char *str,
90
		    double rot, double hadj,
93
				  double rot, double hadj,
91
		    int col, double gamma, int font, double cex, double ps,
94
				  R_GE_gcontext *gc,
92
		    NewDevDesc *dd);
95
				  NewDevDesc *dd);
93
static Rboolean R_Proxy_Graphics_Open (NewDevDesc* pDD,
96
static Rboolean R_Proxy_Graphics_Open (NewDevDesc* pDD,
94
				       void* pAXD,
97
				       void* pAXD,
95
				       char* pDisplay,
98
				       char* pDisplay,
96
				       double pWidth,
99
				       double pWidth,
97
				       double pHeight,
100
				       double pHeight,
Line 100... Line 103...
100
 
103
 
101
/* 00-06-22 | baier | added line type and width */
104
/* 00-06-22 | baier | added line type and width */
102
static void R_Proxy_Graphics_Circle (double pX,
105
static void R_Proxy_Graphics_Circle (double pX,
103
				     double pY,
106
				     double pY,
104
				     double pRad,
107
				     double pRad,
105
				     int pCol,
-
 
106
				     int pFill,
108
				     R_GE_gcontext *gc,
107
				     double pGamma,
-
 
108
				     int pLty,
-
 
109
				     double pLwd,
-
 
110
				     NewDevDesc* pDD)
109
				     NewDevDesc* pDD)
111
{
110
{
112
  if (__graphics_device)
111
  if (__graphics_device)
113
    {
112
    {
114
      __graphics_device->vtbl->circle (__graphics_device,
113
      __graphics_device->vtbl->circle (__graphics_device,
115
				       pX,
114
				       pX,
116
				       pY,
115
				       pY,
117
				       pRad,
116
				       pRad,
118
				       pFill,
117
				       gc->fill,
119
				       pCol,
118
				       gc->col,
120
				       pLty,
119
				       gc->lty,
121
				       pLwd);
120
				       gc->lwd);
122
      return;
121
      return;
123
    }
122
    }
124
 
123
 
125
  MessageBox (GetDesktopWindow (),"Circle()","R_Proxy_Graphics",MB_OK);
124
  MessageBox (GetDesktopWindow (),"Circle()","R_Proxy_Graphics",MB_OK);
126
}
125
}
Line 172... Line 171...
172
/* 00-06-22 | baier | added color, line type and width */
171
/* 00-06-22 | baier | added color, line type and width */
173
static void R_Proxy_Graphics_Line (double pX0,
172
static void R_Proxy_Graphics_Line (double pX0,
174
				   double pY0,
173
				   double pY0,
175
				   double pX1,
174
				   double pX1,
176
				   double pY1,
175
				   double pY1,
177
				   int pCol,
-
 
178
				   double pGamma,
-
 
179
				   int pLty,
-
 
180
				   double pLwd,
176
				   R_GE_gcontext *gc,
181
				   NewDevDesc* pDD)
177
				   NewDevDesc* pDD)
182
{
178
{
183
  if (__graphics_device)
179
  if (__graphics_device)
184
    {
180
    {
185
 
181
 
186
      __graphics_device->vtbl->line (__graphics_device,
182
      __graphics_device->vtbl->line (__graphics_device,
187
				     pX0,pY0,pX1,pY1,pCol,
183
				     pX0,pY0,pX1,pY1,gc->col,
188
				     pLty,pLwd);
184
				     gc->lty,gc->lwd);
189
      return;
185
      return;
190
    }
186
    }
191
 
187
 
192
  MessageBox (GetDesktopWindow (),"Line()","R_Proxy_Graphics",MB_OK);
188
  MessageBox (GetDesktopWindow (),"Line()","R_Proxy_Graphics",MB_OK);
193
}
189
}
Line 212... Line 208...
212
      return;
208
      return;
213
    }
209
    }
214
 
210
 
215
  MessageBox (GetDesktopWindow (),"Mode()","R_Proxy_Graphics",MB_OK);
211
  MessageBox (GetDesktopWindow (),"Mode()","R_Proxy_Graphics",MB_OK);
216
}
212
}
217
static void R_Proxy_Graphics_NewPage (int pFill,
213
static void R_Proxy_Graphics_NewPage (R_GE_gcontext *gc,
218
				      double pGamma,
-
 
219
				      NewDevDesc* pDD)
214
				      NewDevDesc* pDD)
220
{
215
{
221
  if (__graphics_device)
216
  if (__graphics_device)
222
    {
217
    {
223
      __graphics_device->vtbl->newpage (__graphics_device);
218
      __graphics_device->vtbl->newpage (__graphics_device);
Line 246... Line 241...
246
}
241
}
247
 
242
 
248
static void R_Proxy_Graphics_Polygon (int pCount,
243
static void R_Proxy_Graphics_Polygon (int pCount,
249
				      double* pX,
244
				      double* pX,
250
				      double* pY,
245
				      double* pY,
251
				      int pCol,
-
 
252
				      int pFill,
246
				      R_GE_gcontext *gc,
253
				      double pGamma,
-
 
254
				      int pLty,
-
 
255
				      double pLwd,
-
 
256
				      NewDevDesc* pDD)
247
				      NewDevDesc* pDD)
257
{
248
{
258
  if (__graphics_device)
249
  if (__graphics_device)
259
    {
250
    {
260
      /* convert coordinates here: don't use alloca() -> overflow? */
251
      /* convert coordinates here: don't use alloca() -> overflow? */
Line 268... Line 259...
268
	  lX[i] = pX[i];
259
	  lX[i] = pX[i];
269
	  lY[i] = pY[i];
260
	  lY[i] = pY[i];
270
 
261
 
271
	}
262
	}
272
 
263
 
273
      /*      sprintf (x,"device::Polygon: bg is %08x, fg is %08x\n",pFill,pCol); */
264
      /*      sprintf (x,"device::Polygon: bg is %08x, fg is %08x\n",fill,col); */
274
      /*      OutputDebugString (x); */
265
      /*      OutputDebugString (x); */
275
      __graphics_device->vtbl->polygon (__graphics_device,
266
      __graphics_device->vtbl->polygon (__graphics_device,
276
					pCount,lX,lY,pFill,pCol);
267
					pCount,lX,lY,gc->fill,gc->col);
277
 
268
 
278
      free (lX);
269
      free (lX);
279
      free (lY);
270
      free (lY);
280
 
271
 
281
      return;
272
      return;
Line 285... Line 276...
285
}
276
}
286
/* 01-01-23 | baier | added "col" parameter */
277
/* 01-01-23 | baier | added "col" parameter */
287
static void R_Proxy_Graphics_Polyline (int pCount,
278
static void R_Proxy_Graphics_Polyline (int pCount,
288
				       double* pX,
279
				       double* pX,
289
				       double* pY,
280
				       double* pY,
290
				       int pCol,
-
 
291
				       double pGamma,
-
 
292
				       int pLty,
281
				       R_GE_gcontext *gc,
293
				       double pLwd,
-
 
294
				       NewDevDesc* pDD)
282
				       NewDevDesc* pDD)
295
{
283
{
296
  if (__graphics_device)
284
  if (__graphics_device)
297
    {
285
    {
298
      /* convert coordinates here: don't use alloca() -> overflow? */
286
      /* convert coordinates here: don't use alloca() -> overflow? */
Line 312... Line 300...
312
	  /*	  OutputDebugString (x); */
300
	  /*	  OutputDebugString (x); */
313
 
301
 
314
	}
302
	}
315
 
303
 
316
      __graphics_device->vtbl->polyline (__graphics_device,
304
      __graphics_device->vtbl->polyline (__graphics_device,
317
					 pCount,lX,lY,pCol);
305
					 pCount,lX,lY,gc->col);
318
 
306
 
319
      free (lX);
307
      free (lX);
320
      free (lY);
308
      free (lY);
321
 
309
 
322
      return;
310
      return;
Line 327... Line 315...
327
/* 00-06-22 | baier | added line type and width */
315
/* 00-06-22 | baier | added line type and width */
328
static void R_Proxy_Graphics_Rect (double pX0,
316
static void R_Proxy_Graphics_Rect (double pX0,
329
				   double pY0,
317
				   double pY0,
330
				   double pX1,
318
				   double pX1,
331
				   double pY1,
319
				   double pY1,
332
				   int pCol,
-
 
333
				   int pFill,
320
				   R_GE_gcontext *gc,
334
				   double pGamma,
-
 
335
				   int pLty,
-
 
336
				   double pLwd,
-
 
337
				   NewDevDesc* pDD)
321
				   NewDevDesc* pDD)
338
{
322
{
339
  if (__graphics_device)
323
  if (__graphics_device)
340
    {
324
    {
341
 
325
 
342
      __graphics_device->vtbl->rect (__graphics_device,
326
      __graphics_device->vtbl->rect (__graphics_device,
343
				     pX0,pY0,pX1,pY1,pFill,pCol,
327
				     pX0,pY0,pX1,pY1,gc->fill,gc->col,
344
				     pLty,pLwd);
328
				     gc->lty,gc->lwd);
345
      return;
329
      return;
346
    }
330
    }
347
 
331
 
348
  MessageBox (GetDesktopWindow (),"Rect()","R_Proxy_Graphics",MB_OK);
332
  MessageBox (GetDesktopWindow (),"Rect()","R_Proxy_Graphics",MB_OK);
349
}
333
}
Line 370... Line 354...
370
}
354
}
371
#endif
355
#endif
372
 
356
 
373
/* 00-06-22 | baier | added font and size parameters */
357
/* 00-06-22 | baier | added font and size parameters */
374
static double R_Proxy_Graphics_StrWidth (char* pString,
358
static double R_Proxy_Graphics_StrWidth (char* pString,
375
					 int pFont,
359
					 R_GE_gcontext *gc,
376
					 double pCex,
-
 
377
					 double pPs,
-
 
378
					 NewDevDesc* pDD)
360
					 NewDevDesc* pDD)
379
{
361
{
380
  if (__graphics_device)
362
  if (__graphics_device)
381
    {
363
    {
382
      int lSize = pCex * pPs + 0.5;
364
      int lSize = gc->cex * gc->ps + 0.5;
383
      return __graphics_device->vtbl->strwidth (__graphics_device,
365
      return __graphics_device->vtbl->strwidth (__graphics_device,
384
						pString,
366
						pString,
385
						pFont,
367
						gc->fontface,
386
						lSize);
368
						lSize);
387
    }
369
    }
388
 
370
 
389
  MessageBox (GetDesktopWindow (),"StrWidth()","R_Proxy_Graphics",MB_OK);
371
  MessageBox (GetDesktopWindow (),"StrWidth()","R_Proxy_Graphics",MB_OK);
390
  return 0.0;
372
  return 0.0;
Line 394... Line 376...
394
static void R_Proxy_Graphics_Text (double pX,
376
static void R_Proxy_Graphics_Text (double pX,
395
				   double pY,
377
				   double pY,
396
				   char* pString,
378
				   char* pString,
397
				   double pRot,
379
				   double pRot,
398
				   double pHadj,
380
				   double pHadj,
399
				   int pCol,
-
 
400
				   double pGamma,
-
 
401
				   int pFont,
381
				   R_GE_gcontext *gc,
402
				   double pCex,
-
 
403
				   double pPs,
-
 
404
				   NewDevDesc* pDD)
382
				   NewDevDesc* pDD)
405
{
383
{
406
  if (__graphics_device)
384
  if (__graphics_device)
407
    {
385
    {
408
      int lSize = pCex * pPs + 0.5;
386
      int lSize = gc->cex * gc->ps + 0.5;
409
 
387
 
410
      __graphics_device->vtbl->text (__graphics_device,
388
      __graphics_device->vtbl->text (__graphics_device,
411
				     pX,pY,pString,pRot,pHadj,
389
				     pX,pY,pString,pRot,pHadj,
412
				     pCol,pFont,lSize);
390
				     gc->col,gc->fontface,lSize);
413
      return;
391
      return;
414
    }
392
    }
415
 
393
 
416
  MessageBox (GetDesktopWindow (),"Text()","R_Proxy_Graphics",MB_OK);
394
  MessageBox (GetDesktopWindow (),"Text()","R_Proxy_Graphics",MB_OK);
417
}
395
}
418
 
396
 
419
/* 00-06-22 | baier | added font and size parameters */
397
/* 00-06-22 | baier | added font and size parameters */
420
static void R_Proxy_Graphics_MetricInfo(int c, int font, double cex, double ps,
398
static void R_Proxy_Graphics_MetricInfo(int c, 
-
 
399
					R_GE_gcontext *gc,
421
			  double* ascent, double* descent,
400
					double* ascent, double* descent,
422
			  double* width, NewDevDesc *dd);
401
					double* width, NewDevDesc *dd);
423
static void R_Proxy_Graphics_MetricInfo (int pC,
402
static void R_Proxy_Graphics_MetricInfo (int pC,
424
					 int pFont,
403
					 R_GE_gcontext *gc,
425
					 double pCex,
-
 
426
					 double pPs,
-
 
427
					 double* pAscent,
404
					 double* pAscent,
428
					 double* pDescent,
405
					 double* pDescent,
429
					 double* pWidth,
406
					 double* pWidth,
430
					 NewDevDesc* pDD)
407
					 NewDevDesc* pDD)
431
{
408
{
432
  if (__graphics_device)
409
  if (__graphics_device)
433
    {
410
    {
434
      int lSize = pCex * pPs + 0.5;
411
      int lSize = gc->cex * gc->ps + 0.5;
435
      __graphics_device->vtbl->metricinfo (__graphics_device,
412
      __graphics_device->vtbl->metricinfo (__graphics_device,
436
					   pC,
413
					   pC,
437
					   pAscent,
414
					   pAscent,
438
					   pDescent,
415
					   pDescent,
439
					   pWidth,
416
					   pWidth,
440
					   pFont,
417
					   gc->fontface,
441
					   lSize);
418
					   lSize);
442
      return;
419
      return;
443
    }
420
    }
444
 
421
 
445
  MessageBox (GetDesktopWindow (),"MetricInfo()","R_Proxy_Graphics",MB_OK);
422
  MessageBox (GetDesktopWindow (),"MetricInfo()","R_Proxy_Graphics",MB_OK);