On Thu, 2015-12-31 at 18:01 +0100, João Pais wrote:
> If understandable, I send this patch so that it's possible to see what
> I'm doing.
> 
> 
> The idea is actually to convert a pix into a bunch of canvases, pixel
> per pixel - so that a "picture" can be shown on vanilla. Follow the
> instructions in the patch, and everything should be clear.
> The conversion is done in [pd RGB]. There are 2 versions, but they
> have the same output.

There are quite a few different color encodings around in Pd world. For
the iemguis, there is a difference in encoding between sending a 'color'
message and defining a color as creation argument. What you've done
works well for sending 'color' messages to canvas, but not as a creation
argument. If you want to define a color as creation argument, you have
to encode it differently, namely as 6bit-per-channel value. So, instead
of multiplying by 255 and powers of 256, you need to multiply by 63 and
powers of 64. See attached patch. 

I guess the reason is a limitation in how Pd displays (and saves)
numbers. Although 32-bit float numbers can fully represent 24bit integer
numbers, numbers are saved with less precision in pd files (and text
files), since they are truncated to 6 digits. This limitation is
worked-around by reducing the resolution to 6 bits per channel. The
highest number (the one representing white) is -262144. It does not
exceed 6 digits and can be stored at full precision.

Roman
#N canvas 339 65 450 300 10;
#N canvas 687 323 301 267 rgb2iemcreate 0;
#X obj 29 15 inlet;
#X obj 29 37 unpack f f f;
#X obj 29 63 * 63;
#X obj 63 63 * 63;
#X obj 98 62 * 63;
#X obj 29 95 << 6;
#X obj 29 117 +;
#X obj 29 139 << 6;
#X obj 29 161 +;
#X obj 29 188 * -1;
#X obj 29 210 - 1;
#X obj 29 233 outlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 1 3 0;
#X connect 1 2 4 0;
#X connect 2 0 5 0;
#X connect 3 0 6 1;
#X connect 4 0 8 1;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X restore 17 107 pd rgb2iemcreate;
#X obj 20 20 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
-1 -1 12700 1;
#X obj 153 20 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
-1 -1 12100 1;
#X obj 287 20 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
-1 -1 0 1;
#X obj 17 80 pack f f f;
#X obj 150 40 t b f;
#X obj 284 40 t b f;
#N canvas 0 75 321 175 bla 1;
#X restore 18 213 pd bla;
#X obj 17 179 s pd-bla;
#X msg 17 141 clear \, obj 20 20 cnv 15 280 130 empty empty empty 29
12 0 14 \$1 -1 -1;
#X connect 0 0 9 0;
#X connect 1 0 4 0;
#X connect 2 0 5 0;
#X connect 3 0 6 0;
#X connect 4 0 0 0;
#X connect 5 0 4 0;
#X connect 5 1 4 1;
#X connect 6 0 4 0;
#X connect 6 1 4 2;
#X connect 9 0 8 0;

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to