manpagez: man pages & more
info mathgl_en
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.3 mglColor class

Structure for working with colors. This structure is defined in #include <mgl2/type.h>.

There are two ways to set the color in MathGL. First one is using of mreal 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. See section Line styles.

Parameter of mglColor: mreal r, g, b, a

Reg, green and blue component of color.

Method on mglColor: mglColor (mreal R, mreal G, mreal B, mreal A=1)

Constructor sets the color by mreal values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1].

Method on mglColor: mglColor (char c='k', mreal bright=1)

Constructor sets the color from character id. The black color is used by default. Parameter br set additional “lightness” of color.

Method on mglColor: void Set (mreal R, mreal G, mreal B, mreal A=1)

Sets color from values of Red, Green, Blue and Alpha channels. These values should be in interval [0,1].

Method on mglColor: void Set (mglColor c, mreal bright=1)

Sets color as “lighted” version of color c.

Method on mglColor: void Set (char p, mreal bright=1)

Sets color from symbolic id.

Method on mglColor: bool Valid ()

Checks correctness of the color.

Method on mglColor: mreal Norm ()

Gets maximal of spectral component.

Method on mglColor: bool operator== (const mglColor &c)
Method on mglColor: bool operator!= (const mglColor &c)

Compare with another color

Method on mglColor: bool operator*= (mreal v)

Multiplies color components by number v.

Method on mglColor: bool operator+= (const mglColor &c)

Adds color c component by component.

Method on mglColor: bool operator-= (const mglColor &c)

Subtracts color c component by component.

Library Function: mglColor operator+ (const mglColor &a, const mglColor &b)

Adds colors by its RGB values.

Library Function: mglColor operator- (const mglColor &a, const mglColor &b)

Subtracts colors by its RGB values.

Library Function: mglColor operator* (const mglColor &a, mreal b)
Library Function: mglColor operator* (mreal a, const mglColor &b)

Multiplies color by number.

Library Function: mglColor operator/ (const mglColor &a, mreal b)

Divide color by number.

Library Function: mglColor operator! (const mglColor &a)

Return inverted color.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on March 21, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.