[PD] issue with RGB colors in GUI (toggle,bang,...)

Mathieu Bouchard matju at artengine.ca
Fri Mar 23 04:54:12 CET 2012


Le 2012-03-23 à 04:09:00, Angakok Thoth a écrit :

> For example, this shade of red:
> Red=192. Green=0, Blue=0
> - (192*65536) - (0 * 256) - (0) = -12582912
> 
> If I make a messagebox |color -12582912[ and send it to the togglebox, i 
> get bright blue. what am I doing wrong? for most shades of colours it 
> seems to be working OK, but not for this one and not for some others.

You're supposed to also subtract 1 to the whole thing.

> I don't know, but also the fact, the PD rewrites my messagebox to |color 
> -1.25829e+007[ after save, seems suspicious to me. Is PD rounding the 
> numbers in messageboxes? (the new form seems to be missing few digits)

Yes, it is rounding numbers and this destroy part of the precision that 
the internal float format has. For this reason, I recompute those numbers 
everytime I use them, but there's another reason as well : separate r,g,b 
numbers is easier to understand when reading and modifying patches.

To convert values, I use the [#to_iem] abstraction :
   http://gridflow.ca/help/%23to_iem-help.html

  ______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC


More information about the Pd-list mailing list