From: Hendrik B. <nh...@us...> - 2014-06-09 17:29:04
|
Update of /cvsroot/arianne/unrelated-stuff/src/net/sf/arianne/tools/image In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7122/src/net/sf/arianne/tools/image Modified Files: ImageSplit.java Log Message: added support for cutOff and changed background color to white Index: ImageSplit.java =================================================================== RCS file: /cvsroot/arianne/unrelated-stuff/src/net/sf/arianne/tools/image/ImageSplit.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ImageSplit.java 16 Aug 2011 20:32:00 -0000 1.6 --- ImageSplit.java 9 Jun 2014 17:29:00 -0000 1.7 *************** *** 37,40 **** --- 37,41 ---- private final int offsetX; private final int offsetY; + private final int cutOff; /** *************** *** 47,52 **** * @param offsetX offset for the x-coordinate in the target filenames * @param offsetY offset for the y-coordinate in the target filenames */ ! public ImageSplit(String imageFilename, String targetFolder, String prefix, int tileSizeSource, int tileSizeTarget, int offsetX, int offsetY) { this.imageFilename = imageFilename; this.targetFolder = targetFolder; --- 48,54 ---- * @param offsetX offset for the x-coordinate in the target filenames * @param offsetY offset for the y-coordinate in the target filenames + * @param cutOff number of pixels to cut of at each side of the original image */ ! public ImageSplit(String imageFilename, String targetFolder, String prefix, int tileSizeSource, int tileSizeTarget, int offsetX, int offsetY, int cutOff) { this.imageFilename = imageFilename; this.targetFolder = targetFolder; *************** *** 56,59 **** --- 58,62 ---- this.offsetX = offsetX; this.offsetY = offsetY; + this.cutOff = cutOff; } *************** *** 65,69 **** System.out.println(prefix); BufferedImage img = ImageIO.read(new File(imageFilename)); ! Color bgColor = new Color(95, 152, 96); for (int x = 0; x < divRoundingUp(img.getWidth(), tileSizeSource); x++) { for (int y = 0; y < divRoundingUp(img.getHeight(), tileSizeSource); y++) { --- 68,72 ---- System.out.println(prefix); BufferedImage img = ImageIO.read(new File(imageFilename)); ! Color bgColor = new Color(255, 255, 255); for (int x = 0; x < divRoundingUp(img.getWidth(), tileSizeSource); x++) { for (int y = 0; y < divRoundingUp(img.getHeight(), tileSizeSource); y++) { *************** *** 74,78 **** graphics.fillRect(0, 0, tileSizeTarget, tileSizeTarget); graphics.drawImage(img, 0, 0, tileSizeTarget, tileSizeTarget, ! x * tileSizeSource, y * tileSizeSource, (x+1) * tileSizeSource, (y+1) * tileSizeSource, bgColor, null); --- 77,81 ---- graphics.fillRect(0, 0, tileSizeTarget, tileSizeTarget); graphics.drawImage(img, 0, 0, tileSizeTarget, tileSizeTarget, ! x * tileSizeSource + cutOff, y * tileSizeSource + cutOff, (x+1) * tileSizeSource, (y+1) * tileSizeSource, bgColor, null); *************** *** 107,117 **** */ public static void main(String[] args) throws IOException { ! new ImageSplit("/tmp/world.png", "/tmp/map", "0-", 4096, 256, 0, 0).split(); ! new ImageSplit("/tmp/world.png", "/tmp/map", "1-", 2048, 256, 0, 0).split(); ! new ImageSplit("/tmp/world.png", "/tmp/map", "2-", 1024, 256, 0, 0).split(); ! new ImageSplit("/tmp/world.png", "/tmp/map", "3-", 512, 256, 0, 0).split(); ! new ImageSplit("/tmp/world-large.png", "/tmp/map", "4-", 1024, 256, 0, 0).split(); ! new ImageSplit("/tmp/world-large.png", "/tmp/map", "5-", 512, 256, 0, 0).split(); ! new ImageSplit("/tmp/world-large.png", "/tmp/map", "6-", 256, 256, 0, 0).split(); } } --- 110,121 ---- */ public static void main(String[] args) throws IOException { ! new ImageSplit("/tmp/world.png", "/tmp/map", "0-", 4096, 256, 0, 0, 64).split(); ! new ImageSplit("/tmp/world.png", "/tmp/map", "1-", 2048, 256, 0, 0, 64).split(); ! /* new ImageSplit("/tmp/world.png", "/tmp/map", "2-", 1024, 256, 0, 0, 64).split(); ! new ImageSplit("/tmp/world.png", "/tmp/map", "3-", 512, 256, 0, 0, 64).split(); ! new ImageSplit("/tmp/world-large.png", "/tmp/map", "4-", 1024, 256, 0, 0, 255).split(); ! new ImageSplit("/tmp/world-large.png", "/tmp/map", "5-", 512, 256, 0, 0, 255).split(); ! new ImageSplit("/tmp/world-large.png", "/tmp/map", "6-", 256, 256, 0, 0, 255).split(); ! */ } } |