diff --git a/src/main/java/MatrixGrayImage.java b/src/main/java/MatrixGrayImage.java index e000478f0ceebb6fec3b19abb9934cc0281a7899..5c44acddd7509ccea60fbb570751feb0454adb4b 100644 --- a/src/main/java/MatrixGrayImage.java +++ b/src/main/java/MatrixGrayImage.java @@ -22,7 +22,7 @@ public class MatrixGrayImage implements GrayImage { @Override public GrayColor getPixelGrayColor(int x, int y) { - return new ByteGrayColor(pixels[x][y].getLuminosity()); + return pixels[x][y]; } @Override @@ -40,10 +40,20 @@ public class MatrixGrayImage implements GrayImage { return this.height; } + public void setAllPixelsToWhite() { + for (int i = 0; i < this.width ; i++) { + for (int j = 0; j < this.height ; j++) { + setPixel(ByteGrayColor.WHITE, i, j); + } + } + + } + public MatrixGrayImage(int width, int height){ this.width = width; this.height = height; this.pixels = new GrayColor[this.width][this.height]; + setAllPixelsToWhite(); }