[metapost] Color of a point
Taco Hoekwater
taco at elvenkind.com
Tue Jun 16 12:47:52 CEST 2009
luigi scarso wrote:
> Sorry, again .
> Maybe a silly question:
> given a point, how can I know the background color of this point ?
Afaik, it can only be done the hard way: for a given picture,
take one of the corners, and draw a line from that corner to
the point you want to test.
Now for all the *expanded* fill or draw objects within the picture, see
if there are intersection points with your line. Assuming the path is
well-behaved, then the point will have the color of the last path in the
picture that you found an uneven number of intersections with.
I said *expanded* above, because you need to expand the pen envelopes
of path that have been drawn with a pen (Bogusław has written macros to
do that).
Testing for label texts is even nastier: you have to fetch the glyph
contour of each of the glyphs in the label and find its right place etc.
(but that is problably not needed anyway).
All in all: not simple at all.
Best wishes,
Taco
More information about the metapost
mailing list