|
|
|
@ -64,12 +64,33 @@ 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) { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return X>farthestRight?X:farthestRight; |
|
|
|
|
} |
|
|
|
|
void seekThreshold(int[]arr,int i,int threshold,Color FINALCOLOR,int width) { |
|
|
|
|
seekThreshold(arr,i,threshold,FINALCOLOR,width,0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int seekThreshold(int[]arr,int i,int threshold,Color FINALCOLOR,int width,int farthestRight) { |
|
|
|
|
arr[i]=FINALCOLOR.getRGB(); |
|
|
|
|
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) { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return X>farthestRight?X:farthestRight; |
|
|
|
|
} |
|
|
|
|
void process(int[]arr,int width,int a,int b,int c,int d,int e,int f,int g,int h,int ii,int j,int k,int l) { |
|
|
|
@ -89,4 +110,22 @@ public abstract class Reader{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
boolean colorIsBright(Color col,int brightnessThreshold) { |
|
|
|
|
return col.getRed()+col.getBlue()+col.getGreen()>brightnessThreshold; |
|
|
|
|
} |
|
|
|
|
void processBrightness(int[]arr,int width,int threshold1,int threshold2) { |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (colorIsBright(col, threshold1)) { |
|
|
|
|
seekThreshold(arr,i,threshold2,FINALCOLOR,width); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)) { |
|
|
|
|
arr[i]=TRANSPARENT; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |