summaryrefslogtreecommitdiffstats
path: root/src/glcolorrgba.h
blob: 53efcc2f5a7ebd272f033c03dfc3f2942c79d5e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef GLCOLORRGBA_H
#define GLCOLORRGBA_H

#include <QVector4D>
/**
 * @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