Hi Holger,

         I don't think there is an easy Ecmascript way to query a pixel
value at the client. I've used a server based a approach on some projects
which sends a coordinate back to the server and then gets the pixel value
from the server side image. This can then be passed back to the Ecmascript
on the client. If you are in a Java environment the Sun JAI api is a useful
tool for imagery queries. This approach works better if you are using a low
res image on the client since you can go back to the full resolution tiff
for a more accurate pixel value.

        If I'm wrong about an easy Ecmascript approach it would sure be nice
to know.

Thanks
randy

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of Holger Will
Sent: Tuesday, June 21, 2005 5:33 AM
To: [email protected]
Subject: Re: [svg-developers] Value of a pixel

Nicolas BOUTET schrieb:

> Hi,
>
> does someone know if it's possible (and how), using ECMAScript, to get the
> RGB value (or LookUpTable index) of a pixel (using X,Y coordinates) of an
> image item.
>
> Thanks
>
> Nicolas

Hi Nicolas
im sorry to say, but , no, this is currently not really possible.  at 
least not that easy.
there is only one way i can think of how to do it, you could
1) embed your images in your SVG via the data:image/png;base64 syntax
2)implement a base64 decoder in js
3)implement a png decoder in js
4) use 2 and 3 to turn the embedded image into an array of color values 
for each point (bitmap)
5) map the coordinates of your image to the array index
6) get the right color value on mouseover/ click ...


steps 1-4 can be precomputed. so you can use existing implementations of 
the decoders, and send the right data structure to the client.
so you only need to implement 5 and 6 in js.

cheers
Holger


-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
---- 
Yahoo! Groups Links



 




-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to