2015-03-22 15:06 GMT+01:00 Aliaksei Syrel <[email protected]>:
> Color white - (Color white alpha:0) = Color white
>> Color white - (Color white alpha:0.5) = Color gray.
>> Color white - (Color white alpha:1.0) = Color black.
>> For what do you need the color arithmetic ?
>> Maybe there are already other operations defined on Color that you can
>> used instead.
>
>
> That is too complicated :)
> The idea was to have one-line fix that just leaves the behaviour as it was
> before, simply makes it not produce garbage.
>
Yes, but I think the operation were defined as the Color class did not
contain the alpha value
> Basically there should be a long discussion after pharo 4 is released.
>
> How it is now:
> (Color white alpha: 0) = Color transparent => false
> Color white - (Color white alpha: 0) = Color black => true
>
> From logical point of view is should not be black. But from mathematical
> point of view Color is just a vector and operations with it should be the
> same or almost the same as with vectors.
>
Yes and no, I don't think the mathematical point of view should play here.
Color is not just a vector.
>
> For what do you need the color arithmetic ?
>
> I wanted to get linear discrete transformation from one color to another
> to use it in animation
>
Ah, Ok. In that case I would not use the arithmetic operations at all.
never :)
What is wrong with Color>>mix:shades:
?
| w r cl |
cl := Color red mix: Color green shades:50.
w := Display width // cl size.
r := 0@0 extent: w@((w min: 30) max: 10).
cl do: [:c |
Display fill: r fillColor: c.
r := r translateBy: w@0].
Or do you need to change the alpha based on the operands?
Nicolai
>
> Cheers,
> Alex
>
> On Sun, Mar 22, 2015 at 1:54 PM, Marcus Denker <[email protected]>
> wrote:
>
>>
>> On 22 Mar 2015, at 13:35, Nicolai Hess <[email protected]> wrote:
>>
>>
>>
>> 2015-03-22 12:43 GMT+01:00 Nicolai Hess <[email protected]>:
>>
>>>
>>>
>>> 2015-03-21 15:51 GMT+01:00 Eliot Miranda <[email protected]>:
>>>
>>>> Why not take the average of alpha in all cases?
>>>>
>>>> Eliot (phone)
>>>>
>>>> On Mar 21, 2015, at 6:32 AM, Aliaksei Syrel <[email protected]>
>>>> wrote:
>>>>
>>>
>>>
>>> Or weight the argument by its alpha and don't change the alpha of the
>>> receiver:
>>> Color white - (Color white alpha:0) = Color white
>>> Color white - (Color white alpha:0.5) = Color gray.
>>> Color white - (Color white alpha:1.0) = Color black.
>>>
>>> For what do you need the color arithmetic ?
>>> Maybe there are already other operations defined on Color that you can
>>> used instead.
>>>
>>> As the arithmetic operations on Color doesn't work (for years?), maybe
>>> we should remove
>>> the operation now, and replace them with a more verbose api
>>> addRGB/ addRGBA/ subRGBA ....
>>>
>>> nicolai
>>>
>>>
>> Ah, this issue is already closed. That was a rather short discussion. And
>> #/ and #* still don't work
>> for colors.
>>
>>
>> Yes… I think we have a problem that there is no “this is ready for
>> integration” check.
>>
>> We need to get more careful…
>>
>> Marcus
>>
>
>