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; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import javax.imageio.ImageIO; import readers.fonts.Font; import readers.fonts.Glyph; public class LoveLiveReader extends Reader{ List extraRegions = new ArrayList<>(); static int lastJump=0; public LoveLiveReader(){ addRegion(new Box(713,401,232,50),NUMBER); //score[0] addRegion(new Box(867,710,286,156)); //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] addRegion(new Box(509,606,190,54),NUMBER); //notes[2] addRegion(new Box(509,680,190,54),NUMBER); //notes[3] addRegion(new Box(509,760,190,54),NUMBER); //notes[4] addRegion(new Box(509,840,190,54),NUMBER); //notes[5] addRegion(new Box(509,920,190,54),NUMBER); //notes[6] addRegion(new Box(26,374,265,36)); //difficulty[7] addRegion(new Box(277,165,572,40)); //title[8] addRegion(new Box(716,502,226,45),NUMBER); //pct[9] addRegion(new Box(782,452,158,50),NUMBER); //maxcombo[10] addRegion(new Box(100,470,84,42)); //difficultylv[11] init(); } 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,120,255,0,180); final Color FINALCOLOR = Color.MAGENTA; for (int i=0;iamt; } public void interpretBoxes(Path img,boolean testingMode){ /*String dataString = readAllBoxes(img); String[] data = dataString.split(Pattern.quote("\n")); String[] ja_data = data[0].split(Pattern.quote(")")); String[] en_data = data[2].split(Pattern.quote(")")); trimAllData(ja_data); trimAllData(en_data); System.out.println(Arrays.toString(ja_data)); System.out.println(Arrays.toString(en_data));*/ int regionHeights = 0; int maxWidth = 0; int counter = 0; 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 glyphs = Glyph.split(cutImg); return f.convertGlyphs(glyphs); } case 2: case 3: case 4: case 5: case 6:{ Font f = Font.FONT_LOVELIVE_NOTECOUNT; List glyphs = Glyph.split(cutImg); return f.convertGlyphs(glyphs); } case 9:{ Font f = Font.FONT_LOVELIVE_PCT; List glyphs = Glyph.split(cutImg); if (glyphs.size()>3) { glyphs.remove(glyphs.size()-3); glyphs.remove(glyphs.size()-1); String res = f.convertGlyphs(glyphs); return res.substring(0,glyphs.size()-1)+"."+res.substring(glyphs.size()-1,glyphs.size()); } else { return ""; } } } return ""; } String interpretResults(String[] finalData) { for (int i=0;i