-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolor.h
More file actions
28 lines (24 loc) · 930 Bytes
/
color.h
File metadata and controls
28 lines (24 loc) · 930 Bytes
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
#pragma once
#include <iostream>
namespace libMesh {
struct Color {
public:
Color() : Color(1.0f, 1.0f, 1.0f, 1.0f) {}
Color(float red, float green, float blue, float alpha = 1.0f): red(red), green(green), blue(blue), alpha(alpha) {}
Color(const Color& other) : Color(other.red, other.green, other.blue, other.alpha) {}
float red;
float green;
float blue;
float alpha;
Color& operator=(const Color& other) {
red = other.red;
green = other.green;
blue = other.blue;
alpha = other.alpha;
return *this;
}
friend std::ostream& operator <<(std::ostream& os, const Color& col) {
return os << "RGBA(" << col.red << ", " << col.green << ", " << col.blue << ", " << col.alpha << ")";
}
};
}