[Pharo-dev] Color arithmetical operations are broken

2015-03-20 Thread Aliaksei Syrel
Hi, I played with colors and found out, that arithmetical operations with colors are completely broken. https://pharo.fogbugz.com/f/cases/15188/Color-ariphmetical-operations-are-broken Result is not a valid Color - just garbage. It happens because alpha is not being initialized and stays nil. It

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-20 Thread Nicolai Hess
2015-03-21 0:19 GMT+01:00 Aliaksei Syrel : > Hi, > > I played with colors and found out, that arithmetical operations with > colors are completely broken. > > > https://pharo.fogbugz.com/f/cases/15188/Color-ariphmetical-operations-are-broken > > Result is not a valid Color - just garbage. It happe

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-20 Thread Aliaksei Syrel
> > I would not change the alpha at all. Instead, set alpha 255 in > setPrivateRed: r green: g blue: b It makes sense to be consistent. However blindly setting it to 255 is sometimes unexpected too: Color transparent + Color transparent is assume to get Color transparent and not black. Maybe fo

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-20 Thread Ben Coman
Do we need to do something for Pharo 4? And what is the simplest/quickest thing that would work - even if it needs revisiting in Pharo 5? cheers -ben On Sat, Mar 21, 2015 at 8:31 AM, Aliaksei Syrel wrote: > I would not change the alpha at all. Instead, set alpha 255 in >> setPrivateRed: r green:

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-21 Thread Aliaksei Syrel
On Sat, Mar 21, 2015 at 3:41 AM, Ben Coman wrote: > Do we need to do something for Pharo 4? And what is the simplest/quickest > thing that would work - even if it needs revisiting in Pharo 5? The most simple that works is to at least set alpha to any value. - Multiplication - alpha doesn't

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-21 Thread stepharo
Yes it sounds reasonable. Stef Le 21/3/15 14:32, Aliaksei Syrel a écrit : On Sat, Mar 21, 2015 at 3:41 AM, Ben Coman > wrote: Do we need to do something for Pharo 4? And what is the simplest/quickest thing that would work - even if it needs revisitin

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-21 Thread Eliot Miranda
Why not take the average of alpha in all cases? Eliot (phone) On Mar 21, 2015, at 6:32 AM, Aliaksei Syrel wrote: > > On Sat, Mar 21, 2015 at 3:41 AM, Ben Coman wrote: >> Do we need to do something for Pharo 4? And what is the simplest/quickest >> thing that would work - even if it needs revi

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Nicolai Hess
2015-03-21 15:51 GMT+01:00 Eliot Miranda : > Why not take the average of alpha in all cases? > > Eliot (phone) > > On Mar 21, 2015, at 6:32 AM, Aliaksei Syrel wrote: > Or weight the argument by its alpha and don't change the alpha of the receiver: Color white - (Color white alpha:0) = Color whi

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Nicolai Hess
2015-03-22 12:43 GMT+01:00 Nicolai Hess : > > > 2015-03-21 15:51 GMT+01:00 Eliot Miranda : > >> Why not take the average of alpha in all cases? >> >> Eliot (phone) >> >> On Mar 21, 2015, at 6:32 AM, Aliaksei Syrel wrote: >> > > > Or weight the argument by its alpha and don't change the alpha of t

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Nicolai Hess
No wait, multiplication and division aren't supposed to work with colors , only aNumberOrArray. And this is working now. 2015-03-22 13:35 GMT+01:00 Nicolai Hess : > > > 2015-03-22 12:43 GMT+01:00 Nicolai Hess : > >> >> >> 2015-03-21 15:51 GMT+01:00 Eliot Miranda : >> >>> Why not take the average

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Marcus Denker
> On 22 Mar 2015, at 13:35, Nicolai Hess wrote: > > > > 2015-03-22 12:43 GMT+01:00 Nicolai Hess >: > > > 2015-03-21 15:51 GMT+01:00 Eliot Miranda >: > Why not take the average of alpha in all cases? > > Eliot (phone) > > On Mar 2

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Aliaksei Syrel
> > 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.

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread kilon alios
wait a sec why Alpha affects the Color ? o_O Color white - (Color white alpha:0.5) = Color gray. What ? No ! This make no sense Color white - (Color white alpha:0) = Color white Ok reasonable Color white - (Color white alpha:1.0) = Color black. again reasonable On Sun, Mar 22, 2015 at 4

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Aliaksei Syrel
On Sun, Mar 22, 2015 at 3:31 PM, kilon alios wrote: > Color white - (Color white alpha:1.0) = Color black. > again reasonable No, it's not really reasonable ;) > (Color white alpha: 1.0) = Color white => true I personally assume to get Color transparent when subtract two absolutely equal col

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread kilon alios
"I personally assume to get Color transparent when subtract two absolutely equal colors." why ? that makes no sense to me. I guess we reason about things differently. In art black and white are not colors, they are called "neutrals" and they have the meaning of the existence of light (white) and n

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Nicolai Hess
2015-03-22 15:06 GMT+01:00 Aliaksei Syrel : > 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

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Aliaksei Syrel
On Sun, Mar 22, 2015 at 8:17 PM, Nicolai Hess wrote: > Yes, but I think the operation were defined as the Color class did not > contain the alpha value Exactly Ah, Ok. In that case I would not use the arithmetic operations at all. > never :) I wanted to solve the problem without actually sol

Re: [Pharo-dev] Color arithmetical operations are broken

2015-03-22 Thread Nicolai Hess
2015-03-22 21:26 GMT+01:00 Aliaksei Syrel : > > On Sun, Mar 22, 2015 at 8:17 PM, Nicolai Hess wrote: > >> Yes, but I think the operation were defined as the Color class did not >> contain the alpha value > > > Exactly > > Ah, Ok. In that case I would not use the arithmetic operations at all. >> n