OpenLayer Offline Manual

OpenLayer | Rgba Rgba The color structure which holds the 4 color components: Red, green, blue and alpha components.
Rgba( | float r, float g, float b, float a = 1.0 );
Construct the color from floating-point color components. The values should be between 0.0 and 1.0.
Rgba( | double r, double g, double b, double a = 1.0 );
Construct the color from double color components. The values should be between 0.0 and 1.0.
Rgba( | int r, int g, int b, int a = 255 );
Construct the color from integer color components. The values should be between 0 and 255.
Rgba( | int col, int a );
Construct the color from a 24-bit packed color value and an integer alpha value. The alpha value should be between 0 and 255.
Public fields
float r, g, b, a - The color components With the default blender the alpha value of the color tells the opacity of the color. This way you can have translucency where ever an Rgba color is needed. The higher the alpha value, the more visible the color is. With the maxium value the color is totally visible and with the minium value the color is totally transparent. Notice that in most constructors you don't have to pass the alpha value if you want the color to be totally opaque. There are several color constants to use:
static Rgba BLACK, WHITE, RED, YELLOW, GREEN, BLUE, INVISIBLE;
The color constants. All constant colors are totally opaque except Rgba::INVISIBLE, which is totally transparent. The name INVISIBLE is used instead of TRANSPARENT because TRANSPARENT seems to be a reserved name. If you can think of a better name then let me know! Examples // Create a pure white color using float color components // // (same as Rgba::WHITE) // Rgba white( 1.0, 1.0, 1.0 ); // Create a pure white color using integer color components // // (same as Rgba::WHITE) // Rgba white( 255, 255, 255 ); // Create a pure black color (same as Rgba::BLACK) // Rgba black( 0.0, 0.0, 0.0 ); // Create a medium gray color // Rgba gray( 0.5, 0.5, 0.5 ); // Create a pure red color (same as Rgba::RED) // Rgba red( 1.0, 0.0, 0.0 ); // Create a pure green color (same as Rgba::GREEN) // Rgba green( 0.0, 1.0, 0.0 ); // Create a pure blue color (same as Rgba::BLUE) // Rgba blue( 0.0, 0.0, 1.0 ); // Create a yellow color (same as Rgba::YELLOW) // Rgba yellow( 1.0, 1.0, 0.0 ); // Create a dark yellow color // Rgba yellowDark( 0.3, 0.3, 0.0 ) // Create a 50% opaque bright yellow color // Rgba yellowTranslucent( 1.0, 1.0, 0.0, 0.50 ); // Create a 20% opaque (almost transparent) cyan color // Rgba cyanTranslucent( 0.0, 1.0, 1.0, 0.20 ); // Create an transparent color (same as Rgba::INVISIBLE) // // It doesn't matter what you pass as the red, green and blue components // // as the color will be totally transparent anyways // Rgba transparentColor( 1.0, 1.0, 1.0, 0.0 ); Member functions
MixWith | Mixes two colors together with the given factor
WithAlpha | Creates a new color with the same color components but a different alpha value
Advanced functions
Packed | Returns the color packed in an integer
Select | Selects the color as the active OpenGL color
Back to the main page of the manual Questions about Rgba? Click here.