package readers; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import javax.imageio.ImageIO; public class SoundVoltexReader extends Reader{ final static int REGION_PADDING = 32; List extraRegions = new ArrayList<>(); static int lastJump=0; public SoundVoltexReader(){ readRegions.add(new Box(434,1006,454,26)); //title[0] readRegions.add(new Box(458,1075,244,57)); //bigscore[1] readRegions.add(new Box(706,1096,137,34)); //score[2] readRegions.add(new Box(630,1142,110,16)); //exscore[3] readRegions.add(new Box(932,1194,55,19)); //health percentage[4] readRegions.add(new Box(617,1237,70,23)); //early error[5] readRegions.add(new Box(617,1268,70,23)); //early near[6] readRegions.add(new Box(617,1300,70,23)); //early critical[7] readRegions.add(new Box(617,1330,70,23)); //s-critical[8] readRegions.add(new Box(617,1362,70,23)); //late critical[9] readRegions.add(new Box(617,1393,70,23)); //late near[10] readRegions.add(new Box(617,1424,70,23)); //late error[11] readRegions.add(new Box(304,1364,70,23)); //max combo[12] readRegions.add(new Box(188,1231,70,23)); //chip s-critical[13] readRegions.add(new Box(188,1262,70,23)); //chip critical[14] readRegions.add(new Box(188,1294,70,23)); //chip near[15] readRegions.add(new Box(188,1324,70,23)); //chip error[16] readRegions.add(new Box(266,1231,70,23)); //long s-critical[17] readRegions.add(new Box(266,1324,70,23)); //long error[18] readRegions.add(new Box(345,1231,70,23)); //vol s-critical[19] readRegions.add(new Box(345,1324,70,23)); //vol error[20] readRegions.add(new Box(233,880,84,20)); //difficulty[21] readRegions.add(new Box(875,1046,125,82)); //rating[22] extraRegions.add(new Box(499,1238,78,23)); //early error text[0] extraRegions.add(new Box(499,1268,78,23)); //early near text[1] extraRegions.add(new Box(499,1300,93,23)); //early critical text[2] extraRegions.add(new Box(499,1332,108,23)); //s-critical text[3] extraRegions.add(new Box(499,1362,93,23)); //late critical text[4] extraRegions.add(new Box(499,1393,78,23)); //late near text[5] extraRegions.add(new Box(499,1424,78,23)); //late error text[6] extraRegions.add(new Box(62,1230,119,24)); //s-critical extra text[7] extraRegions.add(new Box(62,1262,119,24)); //critical extra text[8] extraRegions.add(new Box(62,1294,119,24)); //near extra text[9] extraRegions.add(new Box(62,1325,119,24)); //miss extra text[10] } 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++) { if (SEEKCOLOR.colorInRange(new Color(arr[i+x+y*width]))) { farthestRight=seek(arr,i+x+y*width,SEEKCOLOR,FINALCOLOR,width,farthestRight); } } } return X>farthestRight?X:farthestRight; } void ColorFilter(int[] arr,int region,int width) { final int TRANSPARENT = new Color(0,0,0,0).getRGB(); switch (region) { case 999:{ final ColorRange TARGETCOLOR = new ColorRange(240,255,130,150,0,10); final ColorRange SEEKINGCOLOR = new ColorRange(140,255,110,255,0,200); final Color FINALCOLOR = Color.MAGENTA; for (int i=0;imaxWidth) { maxWidth=readRegions.get(i).w; } } try { BufferedImage originalImg = ImageIO.read(img.toFile()); BufferedImage cutImg = new BufferedImage(maxWidth,regionHeights,BufferedImage.TYPE_INT_ARGB); Graphics2D g = cutImg.createGraphics(); int currentHeight=0; for (int i=0;i