1 | /*
|
---|
2 | * ----------------------------------------------------------------------
|
---|
3 | * Color.h: RGBA color class
|
---|
4 | *
|
---|
5 | * ======================================================================
|
---|
6 | * AUTHOR: Wei Qiao <qiaow@purdue.edu>
|
---|
7 | * Purdue Rendering and Perceptualization Lab (PURPL)
|
---|
8 | *
|
---|
9 | * Copyright (c) 2004-2006 Purdue Research Foundation
|
---|
10 | *
|
---|
11 | * See the file "license.terms" for information on usage and
|
---|
12 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
---|
13 | * ======================================================================
|
---|
14 | */
|
---|
15 |
|
---|
16 | #ifndef _COLOR_H_
|
---|
17 | #define _COLOR_H_
|
---|
18 |
|
---|
19 | class Color
|
---|
20 | {
|
---|
21 | public:
|
---|
22 | double R; // Red component
|
---|
23 | double G; // Green component
|
---|
24 | double B; // Blue component
|
---|
25 |
|
---|
26 | void GetRGB(unsigned char *result);
|
---|
27 | void GetRGB(float *result);
|
---|
28 |
|
---|
29 | void SetRGBA(unsigned char *color);
|
---|
30 | void GetRGBA(double opacity, unsigned char *result);
|
---|
31 | Color operator *(Color &other);
|
---|
32 | Color* next; //pointer to the next color
|
---|
33 |
|
---|
34 | Color();
|
---|
35 | Color(double r, double g, double b);
|
---|
36 | Color(const Color& c);
|
---|
37 | Color& operator=(const Color& c);
|
---|
38 | ~Color();
|
---|
39 |
|
---|
40 | void LimitColors(); //Limits the color to be in range of 0.0 and 1.0
|
---|
41 | Color operator*(double k);
|
---|
42 | friend Color operator*(double k, Color &other);
|
---|
43 | Color operator+(Color &other);
|
---|
44 | };
|
---|
45 |
|
---|
46 | #endif
|
---|