according to the Unofficial Pd v0.37 fileformat specification by Simon Asselbergs and Tjeerd Sietsma at http://student-kmt.hku.nl/~tjeerd/pd/pd_fileformat.html, colors (for canvases, labels, etc) are stored in the Pd file according to the following scheme:
"Color: Some graphical elements have color attributes. Per color only one signed integer value is stored that contains the three 8-bit color components (RGB).
Formula to calculate color attribute values:
color = ( * -65536) + ( [green] * -256) + ( [blue] * -1) "
this isn't working for me though. does anyone know how colors are stored in the file. i imagine the calculation is something like this but with different numbers. i've been trying to figure this out for hours and have had no luck. hopefully i can figure this out soon.[/blue][/green]
-
Color values in Pd files
-
i love it when this happens...i post something and then within an hour later i solve my own problem. if you are curious and want the solution, i'll provide a brief synopsis now and maybe follow up later with a more detailed version.
above, it states that per color only one signed interger value is stored that containes the thre 8 bit color components (RGB)....however; the problem with that statement is that Pd scales RGB values down to 6-bit components. the number in the pd file is something like this:
xxxxx xxxx xxxxx xxRR RRRR GGGG GGBB BBBB
where each letter represents a bit in the the 32bit integer.
it's a little bit more complicated than that. i'll try to write out a more elegant description later.