[R] finding the colour at a point

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Jul 22 11:20:21 CEST 2002

On Mon, 22 Jul 2002, Richard Rowe wrote:

> I think this was asked recently but I can't find the item.
> Is it possible to find the colour at a point on a graphics page?
> I want to estimate the area of a complex shape by colouring it then random
> sampling from an enclosing box ...

In general the answer is no.  But I believe you use Windows, and as it
happens the windows() device keeps a bitmapped copy of the graphics
screen just in case you want to make a bmp/png/jpeg copy of it.
There is code in src/gnuwin32/devga.c to do so.

However, I would just plot on bmp/png and use some other tool to count the
number of `on' pixels.  ImageMagick's identify is one such tool.

Brian D. Ripley,                  ripley at 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-help 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-help-request at stat.math.ethz.ch

More information about the R-help mailing list