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

Angakok Thoth angakok.thoth at gmail.com
Fri Mar 30 11:42:11 CEST 2012


On Fri, Mar 23, 2012 at 4:54 AM, Mathieu Bouchard <matju at artengine.ca>wrote:

> 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 tried even that, but it was totally the same.
In the meantime I found that the formula work ok if I use it directly, but
when I put it in messagebox, the colour is changed.


>  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.
>

Yes,yes. That is the problem. Thanks.
Seems that I'll have to repatch all my color stuff this way.
Anyway, I have to say it's kinda awful to HAVE TO do that because of this
weird rounding "feature" and there are already too many workarounds in my
patch.
I think I'll try to count the numbers only once (on loadbang), and store
them into float object that i'll bang when I need the number and don't need
to recount everytime before use. (not simple thing to do, while I need this
loadbang happen sooner than a loadbang that is redrawing my toggleboxes
using those color numbers. Will have to switch to having only one loadbang
in whole patch and "t b b b b b" after it, sending to various parts of the
patch. Just because of this stupid bug). So, I think I know what I can do,
to make it work... but still, I just don't get it. Shouldn't the messagebox
just leave the number as is / as it would be a text? What an awful feature.
There also can't be any aesthetic reason for it, while the messageboxes
doesn't even show up when in GOP, which is another 'feature' of
messageboxes that I fail to understand. ((not sure if worth posting in
another topic, but what is the point, of having messageboxes invisible in
GOP? I can move messagebox away from GOP zone if I don't want to see it..
If I have the message box it the GOP zone, then I probably want it visible
to be visible, so i'm able to write in it and click it. Would be a nice
addition to the small set of objects that can be used for building the GUI.

thanks and regards,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20120330/eacba5fa/attachment-0001.htm>


More information about the Pd-list mailing list