33 #ifndef DCOLOR_H_INCLUDED
34 #define DCOLOR_H_INCLUDED
39 #include <unordered_map>
57 Component(
const double & f) {data = f*255;}
58 Component(
const float & f) {data = f*255;}
61 Component(
const unsigned int & f) {data = f;}
65 Component & operator*=(
const Component & other) {*
this = (float)*
this * (
float)other;
return *
this;}
66 Component & operator/=(
const Component & other) {*
this = (float)*
this / (
float)other;
return *
this;}
69 operator float()
const {
79 bool operator==(
const Component & other)
const {
return data == other.data;}
80 bool operator!=(
const Component & other)
const {
return data != other.data;}
89 Color(
int red,
int green,
int blue,
int alpha = 255);
90 Color(
float redf,
float greenf,
float bluef,
float alphaf = 1.f);
91 Color(
const std::vector<Component> & c);
105 Color(
const std::string & name );
106 Color(
const char * sname);
107 Color(
const Color &);
113 uint32_t
Int()
const;
116 Color & operator= (
const Color &);
120 Color &
Define(
int red,
int green,
int blue,
int alpha);
124 Color &
Define(uint32_t c);
126 Color operator+ (
const Color &)
const;
127 Color operator- (
const Color &)
const;
128 Color operator* (
const Color &)
const;
129 Color operator/ (
float)
const;
130 Color operator* (
float)
const;
131 Color & operator+=(
const Color &);
132 Color & operator-=(
const Color &);
133 bool operator==(
const Color &)
const;
134 bool operator!=(
const Color &)
const;
154 static void Define(
const std::string &,
const Color &);
157 bool operator<(
const Color & b)
const {
A standard object representing an RGBA color.
Definition: Color.h:47
Component g
The green amount.
Definition: Color.h:142
std::string ToString() const
Returns the string form of the Color.
Component b
The green amount.
Definition: Color.h:145
Component a
The blue amount.
Definition: Color.h:148
A component of Color. Is from 0.f to 1.f but is stored as a byte. When used, Component s are implicit...
Definition: Color.h:54
Color & Define(int red, int green, int blue, int alpha)
Sets the color.
Component r
The red amount.
Definition: Color.h:139
uint32_t Int() const
Returns an unsigned, 32-bit integer where each byte refers to a color component in RGBA form...
uint8_t Byte() const
Returns the byte-value form of the component.
Definition: Color.h:75
Class that extends the functionality of an Entity, but as a removable and addable object...
Definition: Component.h:66