-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcolor.cpp
More file actions
executable file
·57 lines (45 loc) · 1.06 KB
/
color.cpp
File metadata and controls
executable file
·57 lines (45 loc) · 1.06 KB
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
55
56
57
// Copyright Jasper van Poelgeest 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt)
#include "color.hpp"
dwarfNebula::Color::Color():
red(0),
green(0),
blue(0)
{}
dwarfNebula::Color::Color(const uint8_t & red, const uint8_t & green, const uint8_t & blue):
red(red),
green(green),
blue(blue)
{}
dwarfNebula::Color::Color(const uint32_t & hex){
blue = hex & 0xFF;
green = hex >> 8 & 0xFF;
red = hex >> 16 & 0xFF;
}
void dwarfNebula::Color::setRed(const uint8_t & value){
red = value;
}
void dwarfNebula::Color::setGreen(const uint8_t & value){
green = value;
}
void dwarfNebula::Color::setBlue(const uint8_t & value){
blue = value;
}
uint8_t dwarfNebula::Color::getRed(){
return red;
}
uint8_t dwarfNebula::Color::getGreen(){
return green;
}
uint8_t dwarfNebula::Color::getBlue(){
return blue;
}
uint32_t dwarfNebula::Color::getColor(){
uint32_t returnColor = green;
returnColor <<= 8;
returnColor |= red;
returnColor <<= 8;
returnColor |= blue;
return returnColor;
}