-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor.h
54 lines (44 loc) · 1.42 KB
/
color.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef COLOR_H_
#define COLOR_H_
#include <stdio.h>
#include <cassert>
#include <string>
namespace Tracer {
struct Color_F;
struct Color_UINT8 {
Color_UINT8(std::uint8_t r, std::uint8_t g, std::uint8_t b);
Color_UINT8(const Color_F& color_float);
std::int32_t generate_hex() const;
void print_hex() const;
Color_UINT8 operator*(float scalar) const;
void operator*=(float scalar);
Color_UINT8 multiply_with_scaling(float scalar) const;
void multiply_with_scaling_in_place(float scalar);
Color_UINT8 operator+(const Color_UINT8& rhs) const;
void operator+=(const Color_UINT8& rhs);
Color_UINT8 addition_with_scaling(const Color_UINT8& rhs) const;
Color_UINT8 addition_with_scaling(const Color_F& rhs) const;
void addition_with_scaling_in_place(const Color_UINT8& rhs);
void addition_with_scaling_in_place(const Color_F& rhs);
std::uint8_t red;
std::uint8_t green;
std::uint8_t blue;
};
struct Color_F {
Color_F(float r, float g, float b);
Color_F(const Color_UINT8& color_u);
std::int32_t generate_hex() const;
void print_hex() const;
Color_F operator*(float scalar) const;
void operator*=(float scalar);
Color_F operator+(const Color_F& rhs) const;
Color_F operator+(const Color_UINT8& rhs) const;
void operator+=(const Color_F& rhs);
void operator+=(const Color_UINT8& rhs);
Color_UINT8 color_scale() const;
float red;
float green;
float blue;
};
} // namespace Tracer
#endif