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 LoveLiveReader extends Reader{ final static int REGION_PADDING = 32; List extraRegions = new ArrayList<>(); static int lastJump=0; public LoveLiveReader(){ readRegions.add(new Box(713,401,232,50)); //score[0] readRegions.add(new Box(613,290,65,36)); //rank[1] extraRegions.add(new Box(65,604,250,53)); //perfect outline[0] extraRegions.add(new Box(65,680,250,53)); //great outline[1] extraRegions.add(new Box(65,760,250,53)); //good outline[2] extraRegions.add(new Box(65,840,250,53)); //bad outline[3] extraRegions.add(new Box(65,920,250,53)); //miss outline[4] readRegions.add(new Box(509,604,190,54)); //notes[2] readRegions.add(new Box(509,680,190,54)); //notes[3] readRegions.add(new Box(509,760,190,54)); //notes[4] readRegions.add(new Box(509,840,190,54)); //notes[5] readRegions.add(new Box(509,920,190,54)); //notes[6] readRegions.add(new Box(26,374,265,36)); //difficulty[7] readRegions.add(new Box(277,165,572,40)); //title[8] readRegions.add(new Box(716,502,226,45)); //pct[9] readRegions.add(new Box(782,452,158,50)); //maxcombo[10] } void ColorFilter(int[] arr,int region,int width) { switch (region) { case 0:{ 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=2&&i<=6) { int[] arr2 = originalImg.getRGB(extraRegions.get(i-2).x, extraRegions.get(i-2).y, extraRegions.get(i-2).w, extraRegions.get(i-2).h, null, 0, extraRegions.get(i-2).w); int rightMost=0; ColorFilter(arr2,400+i-2,extraRegions.get(i-2).w); for (int j=0;jrightMost) { rightMost=j%extraRegions.get(i-2).w; } } //cutImg.setRGB(rightMost-leftMost,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w); cutImg.setRGB(0,currentHeight,extraRegions.get(i-2).w,extraRegions.get(i-2).h,arr2,0,extraRegions.get(i-2).w); final int PADDING = 8; for (int x=leftMost;x=spacing&&midpoint<=spacing+readRegions.get(j).h+REGION_PADDING /*&&accuracy[j]