-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMazeImage.java
44 lines (37 loc) · 911 Bytes
/
MazeImage.java
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
package maze;
import image.ImageDrawer;
import image.ImagePixelArray;
import image.PixelColorParser;
import search.PositionNode;
import search.SolveGraph;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
public class MazeImage {
private BufferedImage img = null;
private File f = null;
int[][] pixelArray;
public MazeImage(String path) {
try {
f = new File(path);
img = ImageIO.read(f);
} catch (IOException e) {
e.printStackTrace();
}
pixelArray = new ImagePixelArray(img).getPixelArray();
}
public void prettyPrint() {
for (int[] ints : pixelArray) {
System.out.println(Arrays.toString(ints));
}
}
public int[][] getPixelArray() {
return pixelArray;
}
public BufferedImage getImg() {
return img;
}
}