Thanks, Claude. I was really wondering if this was something that I am doing wrong. Is this documented somewhere? If not, it should be. But then again, the internals of the file format are not documented as they should be. One of the things that I found in the Help file (no mention made of the differences between the file format and the message format), was that it was not clear to the person writing the help file as to what the last number does.

Guess I have something to document with my project. (Anyone up for some Sudoku in Pd?)

Mike


On Mon, Jul 7, 2008 at 1:06 PM, Claude Heiland-Allen <claudiusmaximus@goto10.org> wrote:
Mike McGonagle wrote:
Hello all,

I have a program that I have written that creates lots of small 'cnv'
objects, where I am changing the colors of the backgrounds and the text in
the object. I was noticing that when I create these cnv objects, I have to
use a different 'color number' to get the same color when I change it with
the cnv 'color' message (which changes both the background and text colors
in the same message).

Is this documented anywhere as to the relation between these two different
color definitions?

Not as far as I'm aware, but here's my implementations that work for me:

/* colour */
float r, g, b; /* 0<={r,g,b}<=1 */

/* RGB -> Pd file */
int c = ((((int) (r * 63.0)) << 12)
     | (((int) (g * 63.0)) << 6)
     | ((int) (b * 63.0))) ^ (-1);

/* RGB -> Pd message */
int c = ((((int) (r * 255.0)) << 16)
     | (((int) (g * 255.0)) << 8)
     | ((int) (b * 255.0))) ^ (-1);


Claude
--
http://claudiusmaximus.goto10.org




--
Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal.
—Yehudi Menuhin (1916–1999), musician