brightness()
Color / Creating & ReadingDescription
Extracts the brightness value from a color (HSB mode).
Syntax
float brightness(color c)
Parameters
| Name | Type | Description |
|---|---|---|
| c | color | any color value |
Returns
floatRelated
Under the Hood
From Processing.h:
float brightness() const { return std::fmax(r,std::fmax(g,b))/255.f*100.f; }
float brightness(color c);
Under the Hood
From Processing.cpp:
float PApplet::brightness(color c) {
unsigned int v=c.value;
float r=(v>>16&0xFF)/255.f, g=(v>>8&0xFF)/255.f, b=(v&0xFF)/255.f;
return max(r, max(g, b)) * colorMaxB;
}