Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
Color.h
Go to the documentation of this file.
1#pragma once
2#include <GL/gl.h>
3#include <QColor>
4#include <QDebug>
5#include <xgl/Types.h>
6#include <xgl/global.h>
7
8namespace sf::xgl
9{
10
15{
16 static_assert(std::is_same_v<GLfloat, value_type>);
17
18 public:
19 // Same constructors as the base class.
20 using vector4f::vector4f;
21
26
30 explicit Color(const QColor& color);
31
35 explicit Color(const QColor& color, float alpha);
36
42 Color(const Color& color, GLfloat alpha);
43
51 Color(float r, float g, float b, float a = 1.0f);
52
53 // ReSharper disable once CppNonExplicitConversionOperator
57 operator const float*() const;
58
59 // ReSharper disable once CppNonExplicitConversionOperator
63 operator float*();
64
68 Color inverted() const;
69
74 bool isZero() const;
75
76 // ReSharper disable once CppNonExplicitConversionOperator
80 operator QColor() const;
81
85 Color& operator=(QColor color);
86};
87
88QDebug operator<<(QDebug dbg, const Color& color);
89
90}// namespace sf::xgl
Color class used in vertex arrays and has layout of 4 x GLfloat.
Definition Color.h:15
Color(const Color &color, GLfloat alpha)
Initializing constructor copying a color but setting a different alpha value.
Color & operator=(QColor color)
Assignment operator accepting a QColor instance.
Color(const QColor &color, float alpha)
Constructor for Qt QColor with a different alpha value.
Color(float r, float g, float b, float a=1.0f)
Initializing constructor for separate rgba values.
Color inverted() const
bool isZero() const
Checks if the all values are zero.
Color(const QColor &color)
Constructor for Qt QColor.
Color()
Default constructor initializing with a black color.
Definition DemoRenderer.h:6
QDebug operator<<(QDebug dbg, const Color &color)
std::array< GLfloat, 4 > vector4f
Type which correspond with a GLSL type and used to implement Vertex structures.
Definition Types.h:25
#define _XGL_CLASS
Definition xgl/global.h:35