|
|
|
@ -2,7 +2,6 @@ package readers; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.nio.file.Path; |
|
|
|
|
import java.nio.file.Paths; |
|
|
|
@ -36,6 +35,7 @@ public class PopnReader extends Reader{ |
|
|
|
|
extraRegions.add(new Box(712,759,150,40)); //good text[3]
|
|
|
|
|
extraRegions.add(new Box(712,800,101,38)); //bad text[4]
|
|
|
|
|
extraRegions.add(new Box(708,861,170,39)); //combo text[5]
|
|
|
|
|
extraRegions.add(new Box(970,290,194,47)); //diff text[6]
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void seek(int[]arr,int i,ColorRange SEEKCOLOR,Color FINALCOLOR,int width) { |
|
|
|
@ -47,7 +47,8 @@ public class PopnReader extends Reader{ |
|
|
|
|
int X = i%width; |
|
|
|
|
for (int x=-1;x<=1;x++) { |
|
|
|
|
for (int y=-1;y<=1;y++) { |
|
|
|
|
if (SEEKCOLOR.colorInRange(new Color(arr[i+x+y*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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -57,9 +58,128 @@ public class PopnReader extends Reader{ |
|
|
|
|
|
|
|
|
|
void ColorFilter(int[] arr,int region,int width) { |
|
|
|
|
switch (region) { |
|
|
|
|
case 999:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(240,255,240,255,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(100,255,100,255,100,255); |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case 5:{ |
|
|
|
|
final ColorRange TARGETCOLOR = new ColorRange(0,10,0,60,240,255); |
|
|
|
|
final ColorRange SEEKINGCOLOR = new ColorRange(0,80,0,140,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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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); |
|
|
|
@ -74,6 +194,108 @@ public class PopnReader extends Reader{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -113,7 +335,7 @@ public class PopnReader extends Reader{ |
|
|
|
|
leftMost=j%readRegions.get(i).w; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (i<=5) { |
|
|
|
|
if (i<=6) { |
|
|
|
|
int[] arr2 = originalImg.getRGB(extraRegions.get(i).x, extraRegions.get(i).y, extraRegions.get(i).w, extraRegions.get(i).h, null, 0, extraRegions.get(i).w); |
|
|
|
|
int rightMost=0; |
|
|
|
|
ColorFilter(arr2,400+i,extraRegions.get(i).w); |
|
|
|
|