Forums > MaxMSP

remaking swatch (sorta): xy data into rgb data?

November 2, 2007 | 4:29 pm

i need to make a simple color picker of a fixed size. My thought is to have an image of the swatch in a pictslider, and I can use xy data to create rgb values. The question is – how do i map the coordinates into RGB? What’s the function?


November 2, 2007 | 4:41 pm

No need for a function. Use the oft-overlooked "sucka" object in the palette (looks like a needle). Can send RGB of whatever you click on, or arbitrary screen coordinates. So you can have a nice big swatch looking any way you want, or a wheel, etc. as a picture, and just put the sucka rectangle on it.

Also nice for picking colors out of images or movies.

–CJ


November 2, 2007 | 4:49 pm

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 145 259 74 196617 hsl $1 255 $2;
#P newex 162 224 68 196617 vexpr $i1*2;
#P newex 159 188 30 196617 pack;
#P user swatch 151 285 108 108;
#P user pictslider 141 59 100 100 4 4 4 4 SliderDefaultKnob.pct 0 SliderDefaultBkgnd.pct 0 2163 0 8323072 127 1. 1.;
#P connect 4 0 1 0;
#P connect 3 0 4 0;
#P connect 2 0 3 0;
#P connect 0 1 2 1;
#P connect 0 0 2 0;
#P window clipboard copycount 5;

_
johan


November 2, 2007 | 5:43 pm

suckah…a good idea, but not practical for my needs.
that little patch is PERFECT, thanks jvkr.


Viewing 4 posts - 1 through 4 (of 4 total)