-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLighten10Filter.java
More file actions
36 lines (33 loc) · 1.1 KB
/
Lighten10Filter.java
File metadata and controls
36 lines (33 loc) · 1.1 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
public class Lighten10Filter extends Filter
{
public void modifyPixels() {
Pixel[][] data = super.getData();
for (int row = 0; row < data.length; row++){
for (int col = 0; col < data[row].length; col++){
Pixel temp = data[row][col];
int red = (int)(temp.getRed() * 1.1);
int green = (int)(temp.getGreen() * 1.1);
int blue = (int)(temp.getBlue() * 1.1);
if (red >= 255){
data[row][col].setRed(255);
}
else {
data[row][col].setRed(red);
}
if (green >= 255){
data[row][col].setGreen(255);
}
else {
data[row][col].setGreen(green);
}
if (blue >= 255){
data[row][col].setBlue(255);
}
else {
data[row][col].setBlue(blue);
}
}
}
//write code to modify pixels
}
}