[javascript-dev] Re: mouseover zone detection
gs
hmutant at yahoo.com
Thu Apr 17 03:04:33 MDT 2008
- Previous message: [javascript-dev] mouseover zone detection
- Next message: [javascript-dev] Re: mouseover zone detection
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
create an image file in an editor and set the size to the size of your patch window choose different RGB values for the different regions (a grey scale image also works) read the file into an image object use the getpixel method to read the RGB values of the pixels that correspond to the mouse position use this value to choose between different infos be careful of different compressions of image formats. Sometimes RGB values are not exactly what they seem If you have jitter you can do it without java script using jitter matrix The main problem is that you must be very careful with the window coordinates, they must always correspond to the image coordinates!!! which means that you must be careful with scroll bars. It is best if the origin of the window is fixed... On the other hand you can have arbitrary shapes for the regions, you can edit them in any image editor superimposing the patcher window and visually define regions, you can add or delete regions easily,... you can get rid of the ifs and replace them with a switch structure ;) I hope this helps george
- Previous message: [javascript-dev] mouseover zone detection
- Next message: [javascript-dev] Re: mouseover zone detection
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
