KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gr_opengl_color.h
Go to the documentation of this file.
1 /* $Id: gr_opengl_color.h 17632 2014-09-30 05:54:15Z ksimek $ */
2 /* {{{=========================================================================== *
3  |
4  | Copyright (c) 1994-2010 by Kobus Barnard (author)
5  |
6  | Personal and educational use of this code is granted, provided that this
7  | header is kept intact, and that the authorship is not misrepresented, that
8  | its use is acknowledged in publications, and relevant papers are cited.
9  |
10  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
11  |
12  | Please note that the code in this file has not necessarily been adequately
13  | tested. Naturally, there is no guarantee of performance, support, or fitness
14  | for any particular task. Nonetheless, I am interested in hearing about
15  | problems that you encounter.
16  |
17  | Author: Kyle Simek
18  * =========================================================================== }}}*/
19 
20 // vim: tabstop=4 shiftwidth=4 foldmethod=marker
21 //
22 #ifndef KJB_CPP_OPENGL_COLOR_H
23 #define KJB_CPP_OPENGL_COLOR_H
24 
25 #include <m_cpp/m_vector_d.h>
26 
27 namespace kjb
28 {
29 namespace opengl
30 {
31 
32 extern const Vector3 WHITE;
33 extern const Vector3 BLACK;
34 
35 extern const Vector3 RED;
36 extern const Vector3 GREEN;
37 extern const Vector3 BLUE;
38 
39 extern const Vector3 YELLOW;
40 extern const Vector3 CYAN;
41 extern const Vector3 MAGENTA;
42 
48 inline void uint_to_rgb(unsigned int i, unsigned char* rgb)
49 {
50  rgb[0] = i & 0xFF;
51  rgb[1] = (i >> 8) & 0xFF;
52  rgb[2] = (i >> 16) & 0xFF;
53 }
54 
59 inline unsigned int rgb_to_uint(unsigned char rgb[3])
60 {
61  return
62  static_cast<unsigned int>(rgb[0]) |
63  (static_cast<unsigned int>(rgb[1]) << 8) |
64  (static_cast<unsigned int>(rgb[2]) << 16);
65 }
66 
67 }
68 }
69 
70 #endif
unsigned int rgb_to_uint(unsigned char rgb[3])
Definition: gr_opengl_color.h:59
const Vector3 BLACK(0.0, 0.0, 0.0)
Definition: gr_opengl_color.h:33
const Vector3 WHITE(1.0, 1.0, 1.0)
Definition: gr_opengl_color.h:32
const Vector3 CYAN(0.0, 1.0, 1.0)
Definition: gr_opengl_color.h:40
const Vector3 YELLOW(1.0, 1.0, 0.0)
Definition: gr_opengl_color.h:39
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
const Vector3 BLUE(0.0, 0.0, 1.0)
Definition: gr_opengl_color.h:37
void uint_to_rgb(unsigned int i, unsigned char *rgb)
Definition: gr_opengl_color.h:48
const Vector3 GREEN(0.0, 1.0, 0.0)
Definition: gr_opengl_color.h:36
const Vector3 MAGENTA(1.0, 0.0, 1.0)
Definition: gr_opengl_color.h:41
const Vector3 RED(1.0, 0.0, 0.0)
Definition: gr_opengl_color.h:35