I need to figure out a way to find out the RGB color value at a certain coordinate in a Graphics object. The Graphics object I am dealing with is continually Dynamically updated, so it is made of moving objects. How can I find the color at a certain point in this moving graphics object.
There is a function, for Image type, called ImageValue which will give color at the given point, but then I have to somehow convert the Graphics to a Image each time I want to check the color at a point, since the Graphics is changing. I have the following code to do that, but it takes much too long to do so, and causes a visible pause. I replace the Dynamic type of the Graphics with Image.
image = screen /. Dynamic -> Image
The above calculation takes too long, when I checked the timing of it.
What I am asking for is a faster, easier way to make a Dynamic Graphic an Image so I can take color like that, or a way to take color at a certain point in Graphics.
Please help, A frustrated student.
Code except:
screen = Dynamic[Show[{backdrop, carsList}];
image = screen /. Dynamic -> Image;
points = ImageValue[image, {newX, newY}];
For[i = 1, i < Length[points], i++,
If[points[[i]] == {0, 0, 2/3} || points[[i]] == {1, 0, 0},
valid = False;
Break[];
];
];
points would usually hold more color data for points, I shortened code.