39 #ifndef OME_XML_MODEL_PRIMITIVES_COLOR_H 40 #define OME_XML_MODEL_PRIMITIVES_COLOR_H 48 #pragma push_macro("min") 50 #pragma push_macro("max") 121 value(static_cast<composed_type>(value))
138 component_type a = std::numeric_limits<component_type>::max()):
139 value(static_cast<composed_type>(r) << 24U |
140 static_cast<composed_type>(g) << 16U |
141 static_cast<composed_type>(b) << 8U |
142 static_cast<composed_type>(a) << 0U)
155 Color (
const std::string& str,
168 inline component_type
171 return static_cast<component_type
>((this->
value >> 24U) & 0xffU);
182 this->
value &= ~(0xFFU << 24U);
183 this->
value |=
static_cast<composed_type
>(red) << 24U;
191 inline component_type
194 return static_cast<component_type
>((this->
value >> 16U) & 0xffU);
205 this->
value &= ~(0xffU << 16U);
206 this->
value |=
static_cast<composed_type
>(green) << 16U;
214 inline component_type
217 return static_cast<component_type
>((this->
value >> 8U) & 0xffU);
228 this->
value &= ~(0xffU << 8U);
229 this->
value |=
static_cast<composed_type
>(blue) << 8U;
237 inline component_type
240 return static_cast<component_type
>((this->
value >> 0) & 0xffU);
251 this->
value &= ~(0xffU << 0);
252 this->
value |=
static_cast<composed_type
>(alpha) << 0;
263 return static_cast<signed_type
>(this->
value);
285 this->value =
static_cast<composed_type
>(
value);
307 return static_cast<signed_type
>(this->
value);
462 template<
class charT,
class traits>
463 inline std::basic_ostream<charT,traits>&
464 operator<< (std::basic_ostream<charT,traits>& os,
467 return os << static_cast<Color::signed_type>(color);
477 template<
class charT,
class traits>
478 inline std::basic_istream<charT,traits>&
494 #pragma pop_macro("min") 495 #pragma pop_macro("max") 498 #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:88
void setAlpha(component_type alpha)
Set the alpha component of this color.
Definition: Color.h:249
bool operator!=(const Color &lhs, const Color &rhs)
Compare two Color objects for non-equality.
Definition: Color.h:393
int32_t signed_type
The type of all components composed as a single RGBA value (signed).
Definition: Color.h:92
component_type getGreen() const
Get the green component of this color.
Definition: Color.h:192
Color(signed_type value)
Construct a Color from a signed integer value.
Definition: Color.h:120
void setValue(composed_type value)
Set the integer value of this color from an unsigned integer.
Definition: Color.h:272
void setValue(signed_type value)
Set the integer value of this color from a signed integer.
Definition: Color.h:283
signed_type getValue() const
Get the signed integer value of this color.
Definition: Color.h:261
Color(composed_type value)
Construct a Color from an unsigned integer value.
Definition: Color.h:109
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:135
Open Microscopy Environment C++ implementation.
void setGreen(component_type green)
Set the green component of this color.
Definition: Color.h:203
bool operator==(const Color &lhs, const Color &rhs)
Compare two Color objects for equality.
Definition: Color.h:323
void setBlue(component_type blue)
Set the blue component of this color.
Definition: Color.h:226
uint32_t composed_type
The type of all components composed as a single RGBA value (unsigned).
Definition: Color.h:90
Color()
Construct a Color.
Definition: Color.h:98
component_type getBlue() const
Get the blue component of this color.
Definition: Color.h:215
component_type getRed() const
Get the red component of this color.
Definition: Color.h:169
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, Color &color)
Set Color from input stream.
Definition: Color.h:479
An RGBA color value.
Definition: Color.h:84
component_type getAlpha() const
Get the alpha component of this color.
Definition: Color.h:238
void setRed(component_type red)
Set the red component of this color.
Definition: Color.h:180
composed_type value
The color value.
Definition: Color.h:312