-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPixel.java
More file actions
53 lines (48 loc) · 1.15 KB
/
Pixel.java
File metadata and controls
53 lines (48 loc) · 1.15 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
public class Pixel
{
private int cor_x;
private int cor_y;
private float intensity;
/**
* Constructor
* @param x - row
* @param y - col
*/
public Pixel(int x, int y, float intensity) throws InvalidPixelIntensity {
this.cor_x = x;
this.cor_y = y;
if((intensity < 0 || intensity > 1) && intensity != -1)
throw new InvalidPixelIntensity();
this.intensity = intensity;
}
/**
* Getter for column coordinate
* @return col
*/
public int getCor_y() {
return this.cor_y;
}
/**
* Getter for row coordinate
* @return row
*/
public int getCor_x() {
return this.cor_x;
}
/**
* Getter for intensity
* @return intensity (value) of the pixel
*/
public float getIntensity() {
return this.intensity;
}
/**
* Setter for intensity
* @param intensity - value of the pixel
*/
public void setIntensity(float intensity) throws InvalidPixelIntensity {
if(intensity < 0 | intensity > 1)
throw new InvalidPixelIntensity();
this.intensity = intensity;
}
}