diff --git a/readers/Reader.java b/readers/Reader.java index ca1ac37..6775ab3 100644 --- a/readers/Reader.java +++ b/readers/Reader.java @@ -64,7 +64,9 @@ public abstract class Reader{ int X = i%width; for (int x=-1;x<=1;x++) { for (int y=-1;y<=1;y++) { - if (x>=0&&y>=0&&x<=width&&y<=arr.length/width) { + int newX=(i+x+y*width)%width; + int newY=(i+x+y*width)/width; + if (newX>=0&&newY>=0&&newX<=width&&newY<=arr.length/width) { Color col = new Color(arr[i+x+y*width]); if (!col.equals(Color.MAGENTA)&&SEEKCOLOR.colorInRange(col)) { farthestRight=seek(arr,i+x+y*width,SEEKCOLOR,FINALCOLOR,width,farthestRight); @@ -83,7 +85,9 @@ public abstract class Reader{ int X = i%width; for (int x=-1;x<=1;x++) { for (int y=-1;y<=1;y++) { - if (x>=0&&y>=0&&x<=width&&y<=arr.length/width) { + int newX=(i+x+y*width)%width; + int newY=(i+x+y*width)/width; + if (newX>=0&&newY>=0&&newX<=width&&newY<=arr.length/width) { Color col = new Color(arr[i+x+y*width]); if (!col.equals(Color.MAGENTA)&&colorIsBright(col, threshold)) { farthestRight=seekThreshold(arr,i+x+y*width,threshold,FINALCOLOR,width,farthestRight); diff --git a/result.png b/result.png index 2f1e6a9..4dc5860 100644 Binary files a/result.png and b/result.png differ