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

Nov 2, 2007 at 4:29pm

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

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?

#34429
Nov 2, 2007 at 4:41pm

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

#116196
Nov 2, 2007 at 4:49pm

#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

#116197
Nov 2, 2007 at 5:43pm

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

#116198

You must be logged in to reply to this topic.