39 #ifndef OME_XML_MODEL_PRIMITIVES_COLOR_H
40 #define OME_XML_MODEL_PRIMITIVES_COLOR_H
114 value(static_cast<composed_type>(value))
131 component_type a = std::numeric_limits<component_type>::max()):
132 value(static_cast<composed_type>(r) << 24U |
133 static_cast<composed_type>(g) << 16U |
134 static_cast<composed_type>(b) << 8U |
135 static_cast<composed_type>(a) << 0U)
148 Color (
const std::string& str,
161 inline component_type
164 return static_cast<component_type
>((this->
value >> 24U) & 0xffU);
175 this->
value &= ~(0xFFU << 24U);
176 this->
value |=
static_cast<composed_type
>(red) << 24U;
184 inline component_type
187 return static_cast<component_type
>((this->
value >> 16U) & 0xffU);
198 this->
value &= ~(0xffU << 16U);
199 this->
value |=
static_cast<composed_type
>(green) << 16U;
207 inline component_type
210 return static_cast<component_type
>((this->
value >> 8U) & 0xffU);
221 this->
value &= ~(0xffU << 8U);
222 this->
value |=
static_cast<composed_type
>(blue) << 8U;
230 inline component_type
233 return static_cast<component_type
>((this->
value >> 0) & 0xffU);
244 this->
value &= ~(0xffU << 0);
245 this->
value |=
static_cast<composed_type
>(alpha) << 0;
256 return static_cast<signed_type
>(this->
value);
278 this->value =
static_cast<composed_type
>(
value);
300 return static_cast<signed_type
>(this->
value);
455 template<
class charT,
class traits>
456 inline std::basic_ostream<charT,traits>&
457 operator<< (std::basic_ostream<charT,traits>& os,
460 return os << static_cast<Color::signed_type>(color);
470 template<
class charT,
class traits>
471 inline std::basic_istream<charT,traits>&
486 #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:81
void setAlpha(component_type alpha)
Set the alpha component of this color.
Definition: Color.h:242
bool operator!=(const Color &lhs, const Color &rhs)
Compare two Color objects for non-equality.
Definition: Color.h:386
int32_t signed_type
The type of all components composed as a single RGBA value (signed).
Definition: Color.h:85
Color(signed_type value)
Construct a Color from a signed integer value.
Definition: Color.h:113
void setValue(composed_type value)
Set the integer value of this color from an unsigned integer.
Definition: Color.h:265
component_type getGreen() const
Get the green component of this color.
Definition: Color.h:185
void setValue(signed_type value)
Set the integer value of this color from a signed integer.
Definition: Color.h:276
Color(composed_type value)
Construct a Color from an unsigned integer value.
Definition: Color.h:102
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:128
signed_type getValue() const
Get the signed integer value of this color.
Definition: Color.h:254
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
void setGreen(component_type green)
Set the green component of this color.
Definition: Color.h:196
bool operator==(const Color &lhs, const Color &rhs)
Compare two Color objects for equality.
Definition: Color.h:316
void setBlue(component_type blue)
Set the blue component of this color.
Definition: Color.h:219
uint32_t composed_type
The type of all components composed as a single RGBA value (unsigned).
Definition: Color.h:83
Color()
Construct a Color.
Definition: Color.h:91
component_type getBlue() const
Get the blue component of this color.
Definition: Color.h:208
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, Color &color)
Set Color from input stream.
Definition: Color.h:472
component_type getAlpha() const
Get the alpha component of this color.
Definition: Color.h:231
An RGBA color value.
Definition: Color.h:77
component_type getRed() const
Get the red component of this color.
Definition: Color.h:162
void setRed(component_type red)
Set the red component of this color.
Definition: Color.h:173
composed_type value
The color value.
Definition: Color.h:305
Xerces-C modern C++ wrapper.
Definition: Base.h:53