-
Notifications
You must be signed in to change notification settings - Fork 0
/
colour.h
54 lines (42 loc) · 1.22 KB
/
colour.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef colour_h
#define colour_h
/******************************************************************************
Colour class
NAME:colour.h
DATE:10/11/1996
AUTHOR: Z.A. Nolan
******************************************************************************/
// include the vector functions
#include "vector.h"
class TColour
{
private:
// Colour stored as bytes to save space in large pixmaps
unsigned char _Red ;
unsigned char _Green ;
unsigned char _Blue ;
// read and write functions
istream &Read (istream &In) ;
ostream &Write (ostream &Out) const ;
public:
// Constructors
TColour () ;
TColour (double Red,double Green,double Blue) ;
TColour (unsigned char Red, unsigned char Green, unsigned char Blue) ;
// Selectors
double Red() const ;
double Green() const;
double Blue() const;
// Modifiers
SetRed(double Red) ;
SetGreen (double Green) ;
SetBlue (double Blue) ;
// scale colours
TColour operator* (const double Scalar) const ;
// add colours
TColour operator+ (const TColour Colour) const ;
// streaming operators
friend istream &operator>>(istream &In, TColour &Colour);
friend ostream &operator<<(ostream &Out,const TColour &Colour) ;
} ;
#endif