BALL  1.4.79
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
13  #include <BALL/CONCEPT/timeStamp.h>
14 #endif
15 
16 class QColor;
17 namespace 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 
49  ColorRGBA();
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 
89  ColorRGBA
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 
106  ~ColorRGBA();
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 
247  ColorUnit& getRed();
248 
251  const ColorUnit& getRed() const;
252 
257  void setGreen(const ColorUnit& green_value);
258 
263  ColorUnit& getGreen();
264 
268  const ColorUnit& getGreen() const;
269 
274  void setBlue(const ColorUnit& blue_value);
275 
279  ColorUnit& getBlue();
280 
284  const ColorUnit& getBlue() const;
285 
290  void setAlpha(const ColorUnit& alpha_value);
291 
296  ColorUnit& getAlpha();
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 
343  ColorRGBA getInverseColor() const;
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>
443 template 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
ColorRGBA BALL_SELECTED_COLOR
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
BALL_EXPORT bool operator>(const String &s1, const String &s2)
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
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)
-*- Mode: C++; tab-width: 2; -*-
Definition: constants.h:12
std::ostream & operator<<(std::ostream &o, const PixelFormat &f)
Definition: pixelFormat.h:209
PreciseTime BALL_SELECTED_COLOR_CHANGE_TIME
BALL_EXPORT bool operator<(const String &s1, const String &s2)