The R Project SVN R

Rev

Rev 15680 | Rev 16135 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15680 Rev 16124
Line 68... Line 68...
68
 
68
 
69
 
69
 
70
#define X_BELL_VOLUME 50 /* integer between -100 and 100 for the volume 
70
#define X_BELL_VOLUME 50 /* integer between -100 and 100 for the volume 
71
                            of the bell in locator. */
71
                            of the bell in locator. */
72
 
72
 
-
 
73
/* a colour used to represent the background on png if transparent
-
 
74
   NB: must be grey as used as RGB and BGR
-
 
75
*/
-
 
76
#define PNG_TRANS 0xfefefe
-
 
77
 
73
	/********************************************************/
78
	/********************************************************/
74
	/* If there are resources that are shared by all devices*/
79
	/* If there are resources that are shared by all devices*/
75
	/* of this type, you may wish to make them globals	*/
80
	/* of this type, you may wish to make them globals	*/
76
	/* rather than including them in the device-specific	*/
81
	/* rather than including them in the device-specific	*/
77
	/* parameters structure (especially if they are large !)*/
82
	/* parameters structure (especially if they are large !)*/
Line 1108... Line 1113...
1108
	return FALSE;
1113
	return FALSE;
1109
    }
1114
    }
1110
 
1115
 
1111
    /* Foreground and Background Colors */
1116
    /* Foreground and Background Colors */
1112
 
1117
 
1113
    xd->bg =  dd->dp.bg	 = 0xffffffff; /* R_RGB(255, 255, 255); */
1118
    xd->bg = dd->dp.bg = 0xffffffff; /* transparent, was R_RGB(255, 255, 255); */
1114
    xd->fg =  dd->dp.fg	 = R_RGB(0, 0, 0);
1119
    xd->fg =  dd->dp.fg	 = R_RGB(0, 0, 0);
1115
    xd->col = dd->dp.col = xd->fg;
1120
    xd->col = dd->dp.col = xd->fg;
1116
    xd->canvas = canvascolor;
1121
    xd->canvas = canvascolor;
-
 
1122
    if(type == JPEG & !R_OPAQUE(xd->canvas)) {
-
 
1123
	warning("jpeg() does not support transparency: using white bg");
-
 
1124
	xd->canvas = 0xffffff;
-
 
1125
    }
-
 
1126
    if(type > WINDOW) xd->bg =  dd->dp.bg = xd->canvas;
-
 
1127
    
1117
 
1128
 
1118
    /* Try to create a simple window. */
1129
    /* Try to create a simple window. */
1119
    /* We want to know about exposures */
1130
    /* We want to know about exposures */
1120
    /* and window-resizes and locations. */
1131
    /* and window-resizes and locations. */
1121
 
1132
 
Line 1333... Line 1344...
1333
    x11Desc *xd = (x11Desc *) dd->deviceSpecific;
1344
    x11Desc *xd = (x11Desc *) dd->deviceSpecific;
1334
 
1345
 
1335
    if (xd->type > WINDOW) {
1346
    if (xd->type > WINDOW) {
1336
	if (xd->npages++)
1347
	if (xd->npages++)
1337
	    error("attempt to draw second page on pixmap device");
1348
	    error("attempt to draw second page on pixmap device");
-
 
1349
/* we want to override the default bg="transparent" */
1338
	xd->bg = R_OPAQUE(dd->dp.bg) ? dd->dp.bg : xd->canvas;
1350
/*	xd->bg = R_OPAQUE(dd->dp.bg) ? dd->dp.bg : xd->canvas; */
-
 
1351
	xd->bg = R_OPAQUE(dd->dp.bg) ? dd->dp.bg: PNG_TRANS;
1339
	SetColor(xd->bg, dd);
1352
	SetColor(xd->bg, dd);
1340
	XFillRectangle(display, xd->window, xd->wgc, 0, 0,
1353
	XFillRectangle(display, xd->window, xd->wgc, 0, 0,
1341
		       xd->windowWidth, xd->windowHeight);
1354
		       xd->windowWidth, xd->windowHeight);
1342
	return;
1355
	return;
1343
    }
1356
    }
Line 1435... Line 1448...
1435
			   xd->windowWidth, xd->windowHeight, 
1448
			   xd->windowWidth, xd->windowHeight, 
1436
			   AllPlanes, ZPixmap);
1449
			   AllPlanes, ZPixmap);
1437
	    if (xd->type == PNG) 
1450
	    if (xd->type == PNG) 
1438
		R_SaveAsPng(xi, xd->windowWidth, xd->windowHeight, 
1451
		R_SaveAsPng(xi, xd->windowWidth, xd->windowHeight, 
1439
			    bitgp, 0, xd->fp, 
1452
			    bitgp, 0, xd->fp, 
1440
			    R_OPAQUE(dd->dp.bg) ? 0 : xd->canvas);
1453
			    R_OPAQUE(dd->dp.bg) ? 0 : PNG_TRANS);
1441
	    else if (xd->type == JPEG)
1454
	    else if (xd->type == JPEG)
1442
		R_SaveAsJpeg(xi, xd->windowWidth, xd->windowHeight, 
1455
		R_SaveAsJpeg(xi, xd->windowWidth, xd->windowHeight, 
1443
			     bitgp, 0, xd->quality, xd->fp);
1456
			     bitgp, 0, xd->quality, xd->fp);
1444
	    XDestroyImage(xi);
1457
	    XDestroyImage(xi);
1445
	}
1458
	}