Re: If with colors




<bjorn.wallstrom@xxxxxxxxx> wrote...

I try to test what vale a color variable has with

if (myColor==Color.green)

and even when I know it is true it doesn't work, any
idea how I could solve this?

Just because the instances may have the same "colour", the statement might
still not be "true".

Twins might look the same, but they are still two different people.

Try this instead:

if ( myColor.equals(Color.green) )

That would be true if they contain the same values for rgb & alpha.

/// Bjorn A


.



Relevant Pages

  • Re: Luminance calculation
    ... For RGB (without alpha) I use the gray formula for RGB whichs works ... Because compositing and luminance ...
    (comp.graphics.algorithms)
  • Re: 16 bit s/w nach Falschfarben und =?ISO-8859-15?Q?zur=FCck?=
    ... 3x8bit RGB Farbe. ... Wie sieht's mit ARGB aus, d.h. RGB mit Alpha? ...
    (de.sci.physik)
  • Re: convert Uint32 to System.drawing.color
    ... If it only represents an rgb value, ... The first option you wrote is not working since the value is Uint32 ... There is no such overload to the method. ... If it's an rgb value the top eight bits will be zero, which when used as alpha will make a completely transparent color. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: convert Uint32 to System.drawing.color
    ... If it only represents an rgb value, ... The first option you wrote is not working since the value is Uint32 ... There is no such overload to the method. ... If it's an rgb value the top eight bits will be zero, which when used as alpha will make a completely transparent color. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: texture filtering and transparency
    ... texure format with 24 bit RGB, so I would have to use 15 bit RGB which is also not an optimal solution. ... you can always use alpha testing to discard pixels instead of blending them. ...
    (microsoft.public.win32.programmer.directx.graphics)