39 #ifndef OME_XML_MODEL_PRIMITIVES_COLOR_H 40 #define OME_XML_MODEL_PRIMITIVES_COLOR_H 47 #pragma push_macro("min") 49 #pragma push_macro("max") 120 value(static_cast<composed_type>(value))
137 component_type a = std::numeric_limits<component_type>::max()):
138 value(static_cast<composed_type>(r) << 24U |
139 static_cast<composed_type>(g) << 16U |
140 static_cast<composed_type>(b) << 8U |
141 static_cast<composed_type>(a) << 0U)
154 Color (
const std::string& str,
167 inline component_type
170 return static_cast<component_type
>((this->
value >> 24U) & 0xffU);
181 this->
value &= ~(0xFFU << 24U);
182 this->
value |=
static_cast<composed_type
>(red) << 24U;
190 inline component_type
193 return static_cast<component_type
>((this->
value >> 16U) & 0xffU);
204 this->
value &= ~(0xffU << 16U);
205 this->
value |=
static_cast<composed_type
>(green) << 16U;
213 inline component_type
216 return static_cast<component_type
>((this->
value >> 8U) & 0xffU);
227 this->
value &= ~(0xffU << 8U);
228 this->
value |=
static_cast<composed_type
>(blue) << 8U;
236 inline component_type
239 return static_cast<component_type
>((this->
value >> 0) & 0xffU);
250 this->
value &= ~(0xffU << 0);
251 this->
value |=
static_cast<composed_type
>(alpha) << 0;
262 return static_cast<signed_type
>(this->
value);
284 this->value =
static_cast<composed_type
>(
value);
306 return static_cast<signed_type
>(this->
value);
461 template<
class charT,
class traits>
462 inline std::basic_ostream<charT,traits>&
463 operator<< (std::basic_ostream<charT,traits>& os,
466 return os << static_cast<Color::signed_type>(color);
476 template<
class charT,
class traits>
477 inline std::basic_istream<charT,traits>&
493 #pragma pop_macro("min") 494 #pragma pop_macro("max") 497 #endif // OME_XML_MODEL_PRIMITIVES_COLOR_H uint8_t component_type
The type of an individual color component (R, G, B, A).
Definition: Color.h:87
void setAlpha(component_type alpha)
Set the alpha component of this color.
Definition: Color.h:248
bool operator!=(const Color &lhs, const Color &rhs)
Compare two Color objects for non-equality.
Definition: Color.h:392
int32_t signed_type
The type of all components composed as a single RGBA value (signed).
Definition: Color.h:91
component_type getGreen() const
Get the green component of this color.
Definition: Color.h:191
Color(signed_type value)
Construct a Color from a signed integer value.
Definition: Color.h:119
void setValue(composed_type value)
Set the integer value of this color from an unsigned integer.
Definition: Color.h:271
void setValue(signed_type value)
Set the integer value of this color from a signed integer.
Definition: Color.h:282
signed_type getValue() const
Get the signed integer value of this color.
Definition: Color.h:260
Color(composed_type value)
Construct a Color from an unsigned integer value.
Definition: Color.h:108
Color(component_type r, component_type g, component_type b, component_type a=std::numeric_limits< component_type >::max())
Construct a Color from separate red, green, blue and alpha components.
Definition: Color.h:134
Open Microscopy Environment C++ implementation.
void setGreen(component_type green)
Set the green component of this color.
Definition: Color.h:202
bool operator==(const Color &lhs, const Color &rhs)
Compare two Color objects for equality.
Definition: Color.h:322
void setBlue(component_type blue)
Set the blue component of this color.
Definition: Color.h:225
uint32_t composed_type
The type of all components composed as a single RGBA value (unsigned).
Definition: Color.h:89
Color()
Construct a Color.
Definition: Color.h:97
component_type getBlue() const
Get the blue component of this color.
Definition: Color.h:214
component_type getRed() const
Get the red component of this color.
Definition: Color.h:168
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, Color &color)
Set Color from input stream.
Definition: Color.h:478
An RGBA color value.
Definition: Color.h:83
component_type getAlpha() const
Get the alpha component of this color.
Definition: Color.h:237
void setRed(component_type red)
Set the red component of this color.
Definition: Color.h:179
composed_type value
The color value.
Definition: Color.h:311