|
|
@ -2,6 +2,7 @@ package readers; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Graphics2D; |
|
|
|
import java.awt.Graphics2D; |
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.nio.file.Paths; |
|
|
|
import java.nio.file.Paths; |
|
|
@ -132,13 +133,19 @@ public class DDRReader extends Reader{ |
|
|
|
Graphics2D g = cutImg.createGraphics(); |
|
|
|
Graphics2D g = cutImg.createGraphics(); |
|
|
|
int currentHeight=0; |
|
|
|
int currentHeight=0; |
|
|
|
for (int i=0;i<readRegions.size();i++) { |
|
|
|
for (int i=0;i<readRegions.size();i++) { |
|
|
|
int[] arr = originalImg.getRGB(readRegions.get(i).x, readRegions.get(i).y, readRegions.get(i).w, readRegions.get(i).h, null, 0, readRegions.get(i).w); |
|
|
|
BufferedImage subRegion = new BufferedImage(readRegions.get(i).w, readRegions.get(i).h,BufferedImage.TYPE_INT_ARGB); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subRegion.setRGB(0,0,readRegions.get(i).w,readRegions.get(i).h,originalImg.getRGB(readRegions.get(i).x, readRegions.get(i).y, readRegions.get(i).w, readRegions.get(i).h, null, 0, readRegions.get(i).w),0,readRegions.get(i).w); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int[] arr = subRegion.getRGB(0, 0, readRegions.get(i).w, readRegions.get(i).h, null, 0, readRegions.get(i).w); |
|
|
|
//System.out.println(Arrays.toString(arr));
|
|
|
|
//System.out.println(Arrays.toString(arr));
|
|
|
|
//System.out.println(i);
|
|
|
|
//System.out.println(i);
|
|
|
|
//ImageIO.write(originalImg.getSubimage(readRegions.get(i).x, readRegions.get(i).y, readRegions.get(i).w, readRegions.get(i).h),"png",new File("cut.png"));
|
|
|
|
//ImageIO.write(originalImg.getSubimage(readRegions.get(i).x, readRegions.get(i).y, readRegions.get(i).w, readRegions.get(i).h),"png",new File("cut.png"));
|
|
|
|
ColorFilter(arr,i,readRegions.get(i).w); |
|
|
|
ColorFilter(arr,i,readRegions.get(i).w); |
|
|
|
|
|
|
|
subRegion.setRGB(0,0,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w); |
|
|
|
|
|
|
|
ImageIO.write(subRegion,"png",new File("sub.png")); |
|
|
|
cutImg.setRGB(0,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w); |
|
|
|
cutImg.setRGB(0,currentHeight,readRegions.get(i).w,readRegions.get(i).h,arr,0,readRegions.get(i).w); |
|
|
|
System.out.println(interpretImage(cutImg,i)); |
|
|
|
System.out.println(interpretImage(subRegion,i)); |
|
|
|
currentHeight+=readRegions.get(i).h+REGION_PADDING; |
|
|
|
currentHeight+=readRegions.get(i).h+REGION_PADDING; |
|
|
|
} |
|
|
|
} |
|
|
|
Path output = Paths.get("result.png"); |
|
|
|
Path output = Paths.get("result.png"); |
|
|
@ -176,6 +183,12 @@ public class DDRReader extends Reader{ |
|
|
|
} |
|
|
|
} |
|
|
|
return f.convertGlyphs(glyphs); |
|
|
|
return f.convertGlyphs(glyphs); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
case 8:{ |
|
|
|
|
|
|
|
Font f = Font.FONT_DDR_EXCOMBO; |
|
|
|
|
|
|
|
List<Glyph> glyphs = Glyph.split(cutImg); |
|
|
|
|
|
|
|
return f.convertGlyphs(glyphs); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|