| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.4 mglColor class
Structure for working with colors. This structure is defined in #include <mgl/mgl.h>.
There are two ways to set the color in MathGL. First one is using of float values of red, green and blue channels for precise color definition. The second way is the using of character id. There are a set of characters specifying frequently used colors. Normally capital letter gives more dark color than lowercase one. The full list of characters is: ‘k’ – black, ‘r’ – red, ‘R’ – dark red, ‘g’ – green, ‘G’ – dark green, ‘b’ – blue, ‘B’ – dark blue, ‘c’ – cyan, ‘C’ – dark cyan, ‘m’ – magenta, ‘M’ – dark magenta, ‘y’ – yellow, ‘Y’ – dark yellow (gold), ‘h’ – gray, ‘H’ – dark gray, ‘w’ – white, ‘W’ – bright gray, ‘l’ – green-blue, ‘L’ – dark green-blue, ‘e’ – green-yellow, ‘E’ – dark green-yellow, ‘n’ – sky-blue, ‘N’ – dark sky-blue, ‘u’ – blue-violet, ‘U’ – dark blue-violet, ‘p’ – purple, ‘P’ – dark purple, ‘q’ – orange, ‘Q’ – dark orange (brown).
Also you may use “lighted” colors in color scheme specification (not in line style!). The “lighted” color contain 2 symbols: first one is usual symbol for color specification, second one is digit for its brightness. The digit can be in range ‘1’...‘9’. At this ‘5’ correspond to normal color, ‘1’ is very dark version of the color (practically black), ‘9’ is very bright version of the color (practically white).
Colors and its ids.
- Method on mglColor:
mglColor (floatR,floatG,floatB) Constructor sets the color by float values of Red, Green and Blue channels.
- Method on mglColor:
mglColor (charc='k') Constructor sets the color from character id. The black color is used by default.
- Method on mglColor:
voidSet (floatR,floatG,floatB) Sets color from values of Red, Green and Blue channels. This values should be in interval [0,1].
- Method on mglColor:
voidSet (mglColorc,floatbright=1) Sets color as “lighted” version of color c.
- Library Function: inline mglColor operator+ (
const mglColor &a,const mglColor &b) Adds colors by its RGB values.
- Library Function: inline mglColor operator- (
const mglColor &a,const mglColor &b) Subtracts colors by its RGB values.
- Library Function: inline mglColor operator* (
const mglColor &a,floatb) Multiplies color by number.
- Library Function: inline mglColor operator* (
floata,const mglColor &b) Multiplies color by number.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
