File: Color.h

package info (click to toggle)
r-cran-igraph 0.7.1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 14,280 kB
  • sloc: ansic: 150,105; cpp: 19,404; fortran: 3,777; yacc: 1,164; tcl: 931; lex: 484; makefile: 13; sh: 9
file content (40 lines) | stat: -rwxr-xr-x 880 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/** Color.h
 */

#ifndef COLOR_H
#define COLOR_H

namespace igraph {

class Color
{
public:
	Color();
	Color(double vRed, double vGreen, double vBlue, 
	      double vTransparent=1.0);
	~Color();
	
	Color operator* (double vRhs) const; // returns multiplication of a scalar with a vector
	Color operator+ (const Color& vRhs) const; // returns the addition of this color with another color

	void Red(double vRed);
	double Red() const;
	void Green(double vGreen);
	double Green() const;
	void Blue(double vBlue);
	double Blue() const;
	void Transparent(double vTransparent);
	double Transparent() const;

	unsigned char RedByte() const;
	unsigned char GreenByte() const;
	unsigned char BlueByte() const;
	unsigned char TransparentByte() const;
private:
	unsigned char ByteValue(double vZeroToOne) const;
	double mRed, mGreen, mBlue, mTransparent;
};

} // namespace igraph

#endif