[Rd] re: transparency

Prof Brian D Ripley ripley@stats.ox.ac.uk
Fri, 10 Aug 2001 23:37:52 +0100 (BST)


On Sat, 11 Aug 2001, Ross Ihaka wrote:

> Rather than a yes/no tranparency indicator, should we consider using
> entire "unused byte" as an alpha-channel? (meaning that we specify
> transparency as a value in [0,255]).  Many graphics/paint programs (e.g.
> gimp) do this sort of thing.  Transparency would need to be device
> dependent, but a simple yes/no transparency could be obtained by
> thresholding the alpha value.  This would entail a change to way indices
> into colour palettes are handled, but Peter D has pointed out that this
> is currently broken anyway.
>
> The rendering extension to the X server includes support for
> transparency and this might be a place to look for how screen devices
> should behave.

I had thought of that, but it's a lot more complicated (and software does
not even agree which of 0 or 255 is transparent).  I think for now I am
going to look into using 0 and 255 (for solid and transparent) and leave
open the possibility of implementing the intermediate values. For example,
it may be my ignorance, but I don't know of support for alpha channels in
postscript or PDF (at least, PDF 1.3) or Windows Metafiles. PNG does have
alpha channel support, but simple transparency is more widely implemented.

An hour hacking has convinced me we can get something rather useful out of
this.


One design question, probably to Ross.  The postscript() device has a `bg'
argument, but all the others seem to use par("bg"), and that works on
postscript() too.  Is there any reason for this, or anything subtle I have
missed?   Thomas' suggestion to add a canvas colour arg to the
screen devices is a good one that looks easy to add.

Brian

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
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 http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._