-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFostroPixel.cpp
More file actions
100 lines (84 loc) · 1.44 KB
/
FostroPixel.cpp
File metadata and controls
100 lines (84 loc) · 1.44 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "FostroPixel.h"
#include "FostroDefines.h"
float FostroPixel::getRedVal() const {
return red;
}
float FostroPixel::getGreenVal() const {
return green;
}
float FostroPixel::getBlueVal() const {
return blue;
}
float FostroPixel::getAlphaVal() const {
return alpha;
}
float FostroPixel::getPixelVal(int c) const {
float val;
switch (c) {
case RED:
val = red;;
break;
case GREEN:
val = green;
break;
case BLUE:
val = blue;
break;
case ALPHA:
val = alpha;
break;
case GRAY:
val = grayscaleIntensity;
break;
}
return val;
}
void FostroPixel::setRedVal(float x) {
red = x;
}
void FostroPixel::setGreenVal(float x) {
green = x;
}
void FostroPixel::setBlueVal(float x) {
blue = x;
}
void FostroPixel::setAlphaVal(float x) {
alpha = x;
}
void FostroPixel::setPixelVal(float val, int c) {
switch (c) {
case RED:
red = val;
break;
case GREEN:
green = val;
break;
case BLUE:
blue = val;
break;
case ALPHA:
alpha = val;
break;
case GRAY:
grayscaleIntensity = val;
break;
}
}
void FostroPixel::invertRed() {
red = MAX_PIXEL_VAL - red;
}
void FostroPixel::invertGreen() {
green = MAX_PIXEL_VAL - green;
}
void FostroPixel::invertBlue() {
blue = MAX_PIXEL_VAL - blue;
}
void FostroPixel::invertAlpha() {
alpha = MAX_PIXEL_VAL - alpha;
}
void FostroPixel::calcGrayscaleIntensity() {
grayscaleIntensity = (red+blue+green)/3;
}
float FostroPixel::getGrayscaleIntensity() {
return grayscaleIntensity;
}