|
|
|
@ -16,7 +16,6 @@ public class PopnReader extends Reader{ |
|
|
|
|
final static int REGION_PADDING = 32; |
|
|
|
|
List<Box> extraRegions = new ArrayList<>(); |
|
|
|
|
static int lastJump=0; |
|
|
|
|
final int TRANSPARENT = new Color(0,0,0,0).getRGB(); |
|
|
|
|
public PopnReader(){ |
|
|
|
|
readRegions.add(new Box(941,609,275,54)); //score[0]
|
|
|
|
|
readRegions.add(new Box(1060,684,157,40)); //cool[1]
|
|
|
|
@ -38,263 +37,77 @@ public class PopnReader extends Reader{ |
|
|
|
|
extraRegions.add(new Box(970,290,194,47)); //diff text[6]
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void seek(int[]arr,int i,ColorRange SEEKCOLOR,Color FINALCOLOR,int width) { |
|
|
|
|
seek(arr,i,SEEKCOLOR,FINALCOLOR,width,0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int seek(int[]arr,int i,ColorRange SEEKCOLOR,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++) { |
|
|
|
|
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 ColorFilter(int[] arr,int region,int width) { |
|
|
|
|
switch (region) { |
|
|
|
|
case 0:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,100,130,0,10); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,100,255,0,100); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,100,130,0,10, |
|
|
|
|
240,255,100,255,0,100); |
|
|
|
|
}break; |
|
|
|
|
case 1:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,0,10,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,0,150,240,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,0,10,240,255, |
|
|
|
|
240,255,0,150,240,255); |
|
|
|
|
}break; |
|
|
|
|
case 2:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,180,225,0,10); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,180,255,0,140); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,180,225,0,10, |
|
|
|
|
240,255,180,255,0,140); |
|
|
|
|
}break; |
|
|
|
|
case 3:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,0,40,0,10); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,0,180,0,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,244,0,40,0,10, |
|
|
|
|
240,255,0,180,0,255); |
|
|
|
|
}break; |
|
|
|
|
case 4:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(90,120,180,220,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(90,255,180,255,0,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
90,120,180,220,240,255, |
|
|
|
|
90,255,180,255,0,255); |
|
|
|
|
}break; |
|
|
|
|
case 5:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(0,10,0,60,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(0,20,0,100,240,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
0,10,0,60,240,255, |
|
|
|
|
0,20,0,100,240,255); |
|
|
|
|
}break; |
|
|
|
|
case 6:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,230,255,0,40); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,230,255,0,240); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,230,255,0,40, |
|
|
|
|
240,255,230,255,0,240); |
|
|
|
|
}break; |
|
|
|
|
case 400:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,0,10,0,10); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,0,10,0,10); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,0,10,0,10, |
|
|
|
|
240,255,0,10,0,10); |
|
|
|
|
}break; |
|
|
|
|
case 401:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(230,255,0,10,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(230,255,0,10,240,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)&&TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
230,255,0,10,240,255, |
|
|
|
|
230,255,0,10,240,255); |
|
|
|
|
}break; |
|
|
|
|
case 402:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,200,255,0,10); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,200,255,0,10); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)&&TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,200,255,0,10, |
|
|
|
|
240,255,200,255,0,10); |
|
|
|
|
}break; |
|
|
|
|
case 403:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,0,50,0,10); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(240,255,0,50,0,10); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)&&TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,0,50,0,10, |
|
|
|
|
240,255,0,50,0,10); |
|
|
|
|
}break; |
|
|
|
|
case 404:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(90,120,180,220,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(85,120,160,220,180,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)&&TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
90,120,180,220,240,255, |
|
|
|
|
85,120,160,220,180,255); |
|
|
|
|
}break; |
|
|
|
|
case 405:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(0,20,0,80,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(0,20,0,80,240,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)&&TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
0,20,0,80,240,255, |
|
|
|
|
0,20,0,80,240,255); |
|
|
|
|
}break; |
|
|
|
|
case 406:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,240,255,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(210,255,210,255,210,255); |
|
|
|
|
final Color FINALCOLOR = Color.MAGENTA; |
|
|
|
|
for (int i=0;i<arr.length;i++) { |
|
|
|
|
Color col = new Color(arr[i],true); |
|
|
|
|
if (!col.equals(Color.MAGENTA)&&TARGETCOLOR.colorInRange(col)) { |
|
|
|
|
seek(arr,i,SEEKINGCOLOR,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
process(arr,width, |
|
|
|
|
240,255,240,255,240,255, |
|
|
|
|
210,255,210,255,210,255); |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|