[Sc-devel] propose: Color-addons [approve]

Fredrik Olofsson f at fredrikolofsson.com
Wed Jul 25 14:26:39 PDT 2007


sure.  you're binops would be really handy to have in the distro.   
please add them.

but, to start with, anyone against the bugfix to Color.sc below?

_f


Am 25.07.2007 um 11:40 schrieb Till Bovermann:

> Would be nice to have these.
> But I think it would be really great to have support for binaryOps  
> (+, -, *, /), too...
> For things like this:
> 	Color.rand + 0.1
>
> On 24.07.2007, at 22:26, Fredrik Olofsson wrote:
>
>> Till,
>> so would this be our proposed fix to Color.sc then?
>>
>>         divide { arg aColor, opacity=1.0;
>>                 var vals = aColor.asArray, d=0.0001 ! 3;
>> -               ^Color.fromArray(blend(vals, (vals / (this.asArray  
>> + d)).min(1.0), opacity) ++ alpha)
>> +               ^Color.fromArray(blend(vals, ((this.asArray + d) /  
>> vals).min(1.0), opacity) ++ alpha)
>>         }
>>         subtract { arg aColor, opacity=1.0;
>>                 var vals = aColor.asArray;
>> -               ^Color.fromArray(blend(vals, (vals -  
>> this.asArray).max(0.0), opacity) ++ alpha)
>> +               ^Color.fromArray(blend(vals, (this.asArray -  
>> vals).max(0.0), opacity) ++ alpha)
>>         }


   #|
      fredrikolofsson.com     klippav.org     musicalfieldsforever.com
   |#

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-devel/attachments/20070725/f1c85b73/attachment-0001.htm


More information about the Sc-devel mailing list