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