No subject

Prof Brian Ripley
Thu, 9 Aug 2001 16:44:23 +0100 (BST)

Philippe Grosjean raised the question of transparency in the context of
writing Windows metafiles, but it has come up before for bitmapped

I've taken a look in the sources, and what we do now is inconsistent.
The postscript/xfig/pdf devices do not paint the background iff it is
"white".  All the screen devices always paint the background, as do
the bitmap devices and all the Windows devices (including writing to
metafile and to the printer).

I think this is unsatisfactory, and inconsistent with the way
colour is handled for filled objects (rectangles and circles).
Not painting a white background is also undocumented!

For 1.3.1 I think we should document this, and alter win.metafile and
win.printer to make a white background mean transparent. (I've tested
that, and it works.)

However, for the future (1.4.x), I think we should handle "white" and
"transparent" differently, and have bg default to "transparent" for
all devices.  A quick look shows that this is would be easy, as only
24 bits of the rcolor type are used.  So would there be an objections
to using a bit (or a single value) of the upper byte to denote
"transparent"?  (Actually, Peter D has 0xffffffff in use as invalid,
but that's more bits than are needed.)  For consistency "transparent"
should be an alternative to NA in the fill routines, which means that
the obvious rcolor value is (unsigned) NA_INTEGER.

One question then is what bg="transparent" would mean for a screen
device. I think it should mean "white", but the difference would
emerge if the device was copied.  An alternative for the windows()
device (which can have a canvas larger than the device region) would
be the canvas colour (default grey50).  In that case one might want a
default of "white".

Clearly some thought would be needed to get the png devices to handle
transparency, but it should be doable.


Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: