Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Color.h
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // Copyright (c) 1997 The CGAL Consortium
4 
5 // This software and related documentation is part of the Computational
6 // Geometry Algorithms Library (CGAL).
7 // This software and documentation is provided "as-is" and without warranty
8 // of any kind. In no event shall the CGAL Consortium be liable for any
9 // damage of any kind.
10 //
11 // Every use of CGAL requires a license.
12 //
13 // Academic research and teaching license
14 // - For academic research and teaching purposes, permission to use and copy
15 // the software and its documentation is hereby granted free of charge,
16 // provided that it is not a component of a commercial product, and this
17 // notice appears in all copies of the software and related documentation.
18 //
19 // Commercial licenses
20 // - A commercial license is available through Algorithmic Solutions, who also
21 // markets LEDA (http://www.algorithmic-solutions.de).
22 // - Commercial users may apply for an evaluation license by writing to
23 // Algorithmic Solutions (contact@algorithmic-solutions.com).
24 //
25 // The CGAL Consortium consists of Utrecht University (The Netherlands),
26 // ETH Zurich (Switzerland), Free University of Berlin (Germany),
27 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
28 // (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria),
29 // and Tel-Aviv University (Israel).
30 //
31 // ----------------------------------------------------------------------
32 //
33 // release : CGAL-2.2
34 // release_date : 2000, September 30
35 //
36 // file : include/CGAL/IO/Color.h
37 // package : iostream (2.8)
38 // source : $RCSfile: Color.h,v $
39 // revision : $Revision: 1.1.1.1 $
40 // revision_date : $Date: 2001/07/05 22:17:48 $
41 // author(s) : Andreas Fabri
42 //
43 // coordinator : Mariette Yvinec
44 //
45 // email : contact@cgal.org
46 // www : http://www.cgal.org
47 //
48 // ======================================================================
49 
50 
51 
52 #include <CGAL/config.h>
53 #ifndef CGAL_COLOR_H
54 #define CGAL_COLOR_H
55 
57 
58 class Color {
59 public:
60  Color() {}
61  Color(unsigned char red,
62  unsigned char green,
63  unsigned char blue,
64  unsigned char alpha = 120)
65  : _red(red), _green(green), _blue(blue), _alpha(alpha)
66  {}
67 
68  unsigned char r() const {return _red;}
69  unsigned char g() const {return _green;}
70  unsigned char b() const {return _blue;}
71 
72  unsigned char red() const {return _red;}
73  unsigned char green() const {return _green;}
74  unsigned char blue() const {return _blue;}
75  unsigned char alpha() const {return _alpha;}
76  void set_alpha(unsigned char a) {_alpha=a;}
77  bool operator==(const Color &c) const
78  {
79  return ( (red() == c.red()) &&
80  (green() == c.green()) &&
81  (blue() == c.blue()) );
82  }
83 
84  bool operator!=(const Color &c) const
85  {
86  return !( (*this) == c);
87  }
88 
89  Color& operator=(const Color &c)
90  {
91  _red = c.red();
92  _green = c.green();
93  _blue = c.blue();
94  _alpha = c.alpha();
95  return *this;
96  }
97 
98 private:
99  unsigned char _red;
100  unsigned char _green;
101  unsigned char _blue;
102  unsigned char _alpha;
103 };
104 
105 
106 extern const Color BLACK ;
107 extern const Color WHITE ;
108 extern const Color GRAY ;
109 
110 extern const Color RED ;
111 extern const Color GREEN ;
112 
113 extern const Color DEEPBLUE ;
114 extern const Color BLUE ;
115 extern const Color PURPLE ;
116 extern const Color VIOLET ;
117 
118 extern const Color ORANGE ;
119 extern const Color YELLOW ;
120 
121 
123 
124 #endif // CGAL_COLOR_H
const Color RED
Definition: Color.C:66
const Color BLACK
Definition: Color.C:55
const Color ORANGE
Definition: Color.C:67
void set_alpha(unsigned char a)
Definition: Color.h:76
unsigned char r() const
Definition: Color.h:68
Color()
Definition: Color.h:60
unsigned char _alpha
Definition: Color.h:102
const Color VIOLET
Definition: Color.C:63
unsigned char blue() const
Definition: Color.h:74
unsigned char b() const
Definition: Color.h:70
const Color GREEN
Definition: Color.C:59
unsigned char _red
Definition: Color.h:99
const Color WHITE
Definition: Color.C:56
const Color YELLOW
Definition: Color.C:68
unsigned char _blue
Definition: Color.h:101
const Color BLUE
Definition: Color.C:62
bool operator==(const Color &c) const
Definition: Color.h:77
const Color GRAY
Definition: Color.C:57
unsigned char green() const
Definition: Color.h:73
const Color DEEPBLUE
Definition: Color.C:61
Definition: Color.h:58
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
unsigned char alpha() const
Definition: Color.h:75
bool operator!=(const Color &c) const
Definition: Color.h:84
unsigned char _green
Definition: Color.h:100
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
const Color PURPLE
Definition: Color.C:64
unsigned char red() const
Definition: Color.h:72
Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=120)
Definition: Color.h:61
unsigned char g() const
Definition: Color.h:69
Color & operator=(const Color &c)
Definition: Color.h:89