-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColorHSB.pde
52 lines (45 loc) · 1.05 KB
/
ColorHSB.pde
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
class ColorHSB{
//Declarando variáveis
int hValue;
int sValue;
int bValue;
//Construtor
ColorHSB(int hValue,int sValue,int bValue){
this.hValue = hValue;
this.sValue = sValue;
this.bValue = bValue;
}
//Métodos
public int compColor(){ //Cor equivalente
int newHValue = 180 + hValue;
//println(newHValue);
if(newHValue > 360){
newHValue = newHValue - 360;
//println(newHValue);
}
return newHValue;
}
public int[] triadicColor(){
println("Matiz escolhida - "+hValue+"\n");
int[] newHValue = new int[3];
for(int i = 0; i<newHValue.length;i++){
newHValue[i]=hValue;
hValue+=120;
if(newHValue[i]>360){
newHValue[i] = newHValue[i] - 360;
}
println("Triadic Hue " + (i+1) + " - "+newHValue[i]);
}
println();
return newHValue;
}
int getH(){
return hValue;
}
int getS(){
return sValue;
}
int getB(){
return bValue;
}
}