marvin.image.MarvinBlob Maven / Gradle / Ivy
The newest version!
package marvin.image;
public class MarvinBlob {
private int width,
height,
area;
private boolean[][] pixels;
public MarvinBlob(int width, int height){
this.width = width;
this.height = height;
this.area = 0;
pixels = new boolean[width][height];
}
public int getWidth(){
return this.width;
}
public int getHeight(){
return this.height;
}
public void setValue(int x, int y, boolean value){
if(!pixels[x][y] && value){
area++;
} else if(pixels[x][y] && !value){
area--;
}
pixels[x][y] = value;
}
public int getArea(){
return this.area;
}
public boolean getValue(int x, int y){
return pixels[x][y];
}
public MarvinContour toContour(){
MarvinContour contour = new MarvinContour();
for(int y=0; y