When converting from RGB to greyscale, it's common to use the formula
 
   (R, G, B) -> (Y, Y, Y)
 
where
 
   Y = 0.30 * R + 0.59 * G + 0.11 * B

R, G, and B range from 0 to 255, and Y will as well since 0.30 + 0.59 +
0.11 == 1.0. So using the value of 127.5 (halfway between black and
white) as the threshold might be reasonable.
 
Of course, you'll need to pull out R, G, and B from the uint that
represents the color. Its in the form 0x00rrggbb... the low 8 bits are
B, the next higher 8 bits are G, and the next higher 8 bits are R.
 
- Gordon
 
________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of barry.beattie
Sent: Tuesday, September 11, 2007 7:36 PM
To: [email protected]
Subject: [flexcoders] colour values: fill "threshold" colour to change
black to white labels?





I'm having custom fill colours on a chart and placing label text on
top of them.

since the colours are just unsigned Int's is there a simple thrashold
of fill values I can use to switch the label text from black to white?

fill.. | .label
black ... white
dk blu .. white
lt blu .. black
yellow .. black
red ..... white

some simple number for the fill colour I can use as a comparson/"if"
statement? this comparison will be done within an itemRenderer but the
fill colour value set outside (in the chart MXML)

thanx
barry.b



 

Reply via email to