color.h
Go to the documentation of this file.
1 #ifndef COLORH
2 #define COLORH
3 
4 #include "boolean.h"
5 
6 #include <stdio.h>
7 
23 #define RED 0
24 
30 #define GREEN 1
31 
37 #define BLUE 2
38 
44 #define BLACK 3
45 
51 #define GREY 4
52 
58 #define WHITE 5
59 
65 #define YELLOW 6
66 
72 #define PURPLE 7
73 
79 #define CYAN 8
80 
86 typedef struct {
87  double r;
88  double g;
89  double b;
90 } Tcolor;
91 
92 
103 void NewColor(double r,double g,double b,Tcolor *c);
104 
113 void NewColorWithID(unsigned int id,Tcolor *c);
114 
123 void CopyColor(Tcolor *c_dst,Tcolor *c_src);
124 
138 boolean NullColor(Tcolor *c);
139 
149 void Add2Color(double s,Tcolor *c);
150 
161 void ScaleColor(double s,Tcolor *c);
162 
171 void AccumulateColor(Tcolor *c1,Tcolor *c);
172 
187 void CostColor(double cost,double minCost,Tcolor *c);
188 
197 void SetRed(double r,Tcolor *c);
198 
207 void SetGreen(double g,Tcolor *c);
208 
217 void SetBlue(double b,Tcolor *c);
218 
227 double GetRed(Tcolor *c);
228 
237 double GetGreen(Tcolor *c);
238 
247 double GetBlue(Tcolor *c);
248 
263 void PrintColor(FILE *f,Tcolor *c);
264 
272 void DeleteColor(Tcolor *c);
273 
274 #endif
275 
Definition of the boolean type.
void AccumulateColor(Tcolor *c1, Tcolor *c)
Adds a color.
Definition: color.c:83
void CopyColor(Tcolor *c_dst, Tcolor *c_src)
Copy constructor.
Definition: color.c:57
double b
Definition: color.h:89
double GetRed(Tcolor *c)
Gets the red component of a color.
Definition: color.c:123
A color.
Definition: color.h:86
double GetBlue(Tcolor *c)
Gets the blue component of a color.
Definition: color.c:133
double g
Definition: color.h:88
double GetGreen(Tcolor *c)
Gets the green component of a color.
Definition: color.c:128
boolean NullColor(Tcolor *c)
Identifies a non-valid color.
Definition: color.c:64
void DeleteColor(Tcolor *c)
Destructor.
Definition: color.c:143
void Add2Color(double s, Tcolor *c)
Adds to a color.
Definition: color.c:69
void NewColor(double r, double g, double b, Tcolor *c)
Constructor.
Definition: color.c:14
double r
Definition: color.h:87
void CostColor(double cost, double minCost, Tcolor *c)
Definees a color in function of a cost.
Definition: color.c:90
void NewColorWithID(unsigned int id, Tcolor *c)
Constructor.
Definition: color.c:21
void ScaleColor(double s, Tcolor *c)
Scales a color.
Definition: color.c:76
void SetBlue(double b, Tcolor *c)
Changes the blue component of a color.
Definition: color.c:118
void SetRed(double r, Tcolor *c)
Changes the red component of a color.
Definition: color.c:108
void PrintColor(FILE *f, Tcolor *c)
Prints the color.
Definition: color.c:138
void SetGreen(double g, Tcolor *c)
Changes the green component of a color.
Definition: color.c:113