views:

67

answers:

5

Hi


In Html we specify color as amount of red, green and blue. But in net we specify color as an amount alpha, red, green and blue.

a) What does alpha value represent? b) Since the purpose of Color structure is to specify a html supported color ( RGB value ), I don’t see a point in Color structure also including alpha value, since html/CSS doesn’t support it?!


thanx

+2  A: 

a) The alpha channel is the transparency channel. b) supply it with the appropriate value for not transparent and don't expose it in your own functions.

Peter Schuetze
What do you mean by "don't expose it in your own functions"?
carewithl
If you want to write a function that sets a color for something and which hides the color structure. Than only require the parameters for the color channels and omit the alpha channel. e.g. SetPageSchemeColor(red, green, blue)
Peter Schuetze
+1  A: 

The Alpha value indicates transparency.

.NET is used for more than just ASP.NET.

Anon.
+1  A: 

Alpha refers to transparency/opacity level. wikipedia on alpha

CSS does use opacity in some ways.

Arthur Thomas
+1  A: 

Alpha is the ratio in which the pixel should be blended with the background pixel below it. I didnt know html didnt support transparency. I always thought browsers would support transparency.

Andrew Keith
+3  A: 

The Color Structure is actually part of the System.Drawing namespace in the framework. It is used for things other than merely HTML color, including graphics and imagery, where an alpha channel makes sense.

When you're dealing with HTML color, you can just use the FromArgb overload that only specifies red, green, and blue (and alpha to fully opaque).

I think your confusion lies here:

"Since the purpose of Color structure is to specify a html supported color"

That is not the purpose of the Color structure, but rather one specific use of the Color structure. This structure has many other, very valid uses, where having an Alpha channel makes sense. Instead of requiring people to work with multiple Color structures, the framework uses a single, general purpose structure. I believe this was a good choice, since it simplifies the number of types, and keeps the "color" interoperable with other code using Color types.

Reed Copsey
thank you all for your help
carewithl