From af64f953d4f01a7c7bd3415ff5edfff8d4f7c48d Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Tue, 6 Oct 2015 12:52:40 +0200 Subject: Initial commit --- src/glcolorrgba.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/glcolorrgba.h (limited to 'src/glcolorrgba.h') diff --git a/src/glcolorrgba.h b/src/glcolorrgba.h new file mode 100644 index 0000000..53efcc2 --- /dev/null +++ b/src/glcolorrgba.h @@ -0,0 +1,38 @@ +#ifndef GLCOLORRGBA_H +#define GLCOLORRGBA_H + +#include +/** + * @brief The GlColorRgba class is a convenience class to replace QVector4D for color variables. + */ +class GLColorRgba: public QVector4D{ +public: + GLColorRgba(float r = 0.0, float g= 0.0, float b = 0.0, float a = 1.0); + GLColorRgba(const GLColorRgba & other); + GLColorRgba(const QVector4D & other); + /** + * Returns the inverted color with a= 1.0 + */ + GLColorRgba inverted(); + + GLColorRgba operator * (float factor); + //convenience getters + float red()const{return x();} + float green()const{return y();} + float blue()const{return z();} + float alpha()const{return w();} + +//predefined colors + static GLColorRgba clBlack; + static GLColorRgba clRed; + static GLColorRgba clYellow; + static GLColorRgba clGreen; + static GLColorRgba clCyan; + static GLColorRgba clBlue; + static GLColorRgba clMagenta; + static GLColorRgba clGray; + static GLColorRgba clWhite; +}; + + +#endif // GLCOLORRGBA_H -- cgit v1.2.3-70-g09d2