Re: [Flashcoders] Problems getting the brightness of a color returnedfrom getPixel

2006-07-30 Thread Bernard Poulin
In other words, to make your above code to compute brightness work from a value returned by getPixel(), just change the few first line of the HSB method from: RGBtoHSB = function(rgb){ var r = rgb.r var g = rgb.g var b = rgb.b ... to: RGBtoHSB = function(var pixelvalue){ var r = pixelvalue

Re: [Flashcoders] Problems getting the brightness of a color returnedfrom getPixel

2006-07-29 Thread Zeh Fernando
Thanks very much for your response Martin but I don't understand it. I don't have three vars called R G and B. I just have a number which was retuned from getPixel. Am I being stupid? I can't see how I should do what you sugest. Pease explain a little further. That number you're getting is a

RE: [Flashcoders] Problems getting the brightness of a color returnedfrom getPixel

2006-07-29 Thread Mike
You seem to be thinking of numbers as if they are stored like strings. They aren't. RGB colors are stored as 3-byte (24-bit) numbers. For example, red looks like this in binary: b ...which is the same thing as this in hexadecimal: 0xFF ... which is the