BALL 1.5.0
colorRGBA.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
6#define BALL_VIEW_DATATYPE_COLORRGBA_H
7
8#ifndef BALL_VIEW_DATATYPE_COLORUNIT_H
10#endif
11
12#ifndef BALL_CONCEPT_TIMESTAMP_H
14#endif
15
16class QColor;
17namespace BALL
18{
19 namespace VIEW
20 {
21 // forward declarations
22 class ColorHSV;
23
32 {
36 friend class ColorHSV;
37
38 public:
39
40// BALL_CREATE(ColorRGBA)
41
45
50
53 ColorRGBA(const ColorRGBA& color);
54
58 ColorRGBA(const ColorHSV& color);
59
71 ColorRGBA(const char* value);
72
80 ColorRGBA(const String& value);
81
90 (const ColorUnit& red_value, const ColorUnit& green_value,
91 const ColorUnit& blue_value, const ColorUnit& alpha_value = (float)1);
92
94 ColorRGBA(const QColor& color);
95
97 ColorRGBA(const QColor& color, const ColorUnit& alpha);
98
100
103
107
116 void clear();
117
119
122
129 operator String() const;
130
132
135
139 void set(const ColorRGBA& color);
140
144 const ColorRGBA& operator = (const ColorRGBA& color);
145
148 void set(const ColorHSV& color);
149
153 const ColorRGBA& operator = (const ColorHSV& color);
154
157 void get(ColorHSV& color) const;
158
166 void set(const char* value);
167
176 const ColorRGBA& operator = (const char* value);
177
186 void get(char* value) const;
187
194 void set(const String& value);
195
206 const ColorRGBA& operator = (const String& value);
207
214 void get(String& value) const;
215
217 void get(QColor& color) const;
218
223 bool set(const QColor& color);
224
226 QColor getQColor() const;
227
231 void swap(ColorRGBA& color);
232
234
237
241 void setRed(const ColorUnit& red_value);
242
248
251 const ColorUnit& getRed() const;
252
257 void setGreen(const ColorUnit& green_value);
258
264
268 const ColorUnit& getGreen() const;
269
274 void setBlue(const ColorUnit& blue_value);
275
280
284 const ColorUnit& getBlue() const;
285
290 void setAlpha(const ColorUnit& alpha_value);
291
297
301 const ColorUnit& getAlpha() const;
302
314 void set
315 (const ColorUnit& red_value, const ColorUnit& green_value,
316 const ColorUnit& blue_value, const ColorUnit& alpha_value = (float)1);
317
327 void get(ColorUnit& red_value, ColorUnit& green_value,
328 ColorUnit& blue_value, ColorUnit& alpha_value) const;
329
338 void get(ColorUnit& red_value,
339 ColorUnit& green_value,
340 ColorUnit& blue_value) const;
341
344
346
349
353 bool operator == (const ColorRGBA& color) const;
354
357 bool operator != (const ColorRGBA& color) const;
358
363 bool operator < (const ColorRGBA& color) const;
364
369 bool operator <= (const ColorRGBA& color) const;
370
375 bool operator > (const ColorRGBA& color) const;
376
381 bool operator >= (const ColorRGBA& color) const;
382
384
387
395 void dump(std::ostream& s = std::cout, Size depth = 0) const;
396
398
401
410 friend BALL_VIEW_EXPORT std::istream& operator >> (std::istream& s, ColorRGBA& color);
411
420 friend BALL_VIEW_EXPORT std::ostream& operator << (std::ostream& s, const ColorRGBA& color);
421
423
424 private:
425
426 ColorUnit red_;
427 ColorUnit green_;
428 ColorUnit blue_;
429 ColorUnit alpha_;
430
431 // @throw Exception::InvalidRange
432 // @throw Exception::NotInHexFormat
433 void stringToRGBA_(const String& s);
434 };
435
439
441#ifdef BALL_COMPILER_MSVC
442#include <vector>
443template class BALL_VIEW_EXPORT std::vector<ColorRGBA>;
444#endif
445
446# ifndef BALL_NO_INLINE_FUNCTIONS
447# include <BALL/VIEW/DATATYPE/colorRGBA.iC>
448# endif
449
450 } // namespace VIEW
451} // namespace BALL
452
453#endif // <BALL/VIEW_DATATYPE_COLORRGBA_H
Definition: constants.h:13
BALL_EXPORT bool operator<(const String &s1, const String &s2)
BALL_EXPORT bool operator>(const String &s1, const String &s2)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
BALL_EXPORT bool operator>=(const String &s1, const String &s2)
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
BALL_EXPORT bool operator<=(const String &s1, const String &s2)
std::ostream & operator<<(std::ostream &o, const PixelFormat &f)
Definition: pixelFormat.h:209
ColorRGBA BALL_SELECTED_COLOR
PreciseTime BALL_SELECTED_COLOR_CHANGE_TIME
ColorRGBA(const char *value)
ColorUnit & getGreen()
QColor getQColor() const
Get a QColor representing this color.
const ColorUnit & getGreen() const
const ColorUnit & getRed() const
void get(char *value) const
void setGreen(const ColorUnit &green_value)
ColorRGBA(const String &value)
void set(const ColorUnit &red_value, const ColorUnit &green_value, const ColorUnit &blue_value, const ColorUnit &alpha_value=(float) 1)
void setBlue(const ColorUnit &blue_value)
void swap(ColorRGBA &color)
void get(String &value) const
void setRed(const ColorUnit &red_value)
void set(const ColorHSV &color)
ColorUnit & getRed()
const ColorUnit & getAlpha() const
const ColorUnit & getBlue() const
ColorUnit & getAlpha()
ColorRGBA getInverseColor() const
void get(QColor &color) const
Assign to a QT QColor.
ColorRGBA(const ColorUnit &red_value, const ColorUnit &green_value, const ColorUnit &blue_value, const ColorUnit &alpha_value=(float) 1)
ColorRGBA(const QColor &color, const ColorUnit &alpha)
Assignment from a QT QColor.
ColorRGBA(const ColorHSV &color)
void dump(std::ostream &s=std::cout, Size depth=0) const
ColorUnit & getBlue()
void set(const ColorRGBA &color)
ColorRGBA(const ColorRGBA &color)
void get(ColorUnit &red_value, ColorUnit &green_value, ColorUnit &blue_value, ColorUnit &alpha_value) const
void get(ColorUnit &red_value, ColorUnit &green_value, ColorUnit &blue_value) const
bool set(const QColor &color)
void set(const String &value)
void get(ColorHSV &color) const
void set(const char *value)
void setAlpha(const ColorUnit &alpha_value)
ColorRGBA(const QColor &color)
Assignment from a QT QColor.
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52