zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Color.h
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * zenilib is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
34 #ifndef ZENI_COLOR_H
35 #define ZENI_COLOR_H
36 
37 #include <Zeni/Serialization.h>
38 
39 namespace Zeni {
40 
41  struct ZENI_DLL Color {
43  Color();
44  Color(const float &a, const float &r, const float &g, const float &b);
45  explicit Color(const Uint32 &argb);
46 
47  inline unsigned char a_ub() const;
48  inline unsigned char r_ub() const;
49  inline unsigned char g_ub() const;
50  inline unsigned char b_ub() const;
51 
52  inline Uint32 get_rgba() const;
53  inline Uint32 get_argb() const;
54  inline Uint32 get_bgra() const;
55 
56  Color interpolate_to(const float &rhs_part, const Color &rhs) const;
57 
58  bool operator<(const Color &rhs) const;
59 
60  bool operator==(const Color &rhs) const;
61 
62  // Indexing
63  inline const float & operator[](const int &index) const;
64  inline float & operator[](const int &index);
65 
66  float r;
67  float g;
68  float b;
69  float a;
70  };
71 
72  ZENI_DLL std::ostream & serialize(std::ostream &os, const Color &value);
73  ZENI_DLL std::istream & unserialize(std::istream &is, Color &value);
74 
75 }
76 
77 #endif
GLboolean GLboolean g
Definition: glew.h:8736
bool operator<(const TiXmlString &a, const TiXmlString &b)
Definition: tinystr.h:273
bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:8736
std::istream & unserialize(std::istream &is, Color &value)
Definition: Color.cpp:72
std::ostream & serialize(std::ostream &os, const Color &value)
Definition: Color.cpp:68
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:145
float a
Definition: Color.h:69
GLuint index
Definition: glew.h:1800
float b
Definition: Color.h:68
EGLSurface EGLint void ** value
Definition: eglext.h:301
GLdouble GLdouble GLdouble r
Definition: glew.h:1392
GLdouble GLdouble GLdouble b
Definition: glew.h:8383
float g
Definition: Color.h:67
float r
Definition: Color.h:66
Color.
Definition: Color.h:41