package misc; import java.awt.Color; import java.awt.image.BufferedImage; import java.util.ArrayList; public class CompressedImage { private BufferedImage image; private int blockWidth, blockHeight, colors; private byte[] data; public CompressedImage(BufferedImage image, int blockWidth, int blockHeight, int colors) { ArrayList compData = new ArrayList(); int imageWidth = image.getWidth(), imageHeight = image.getHeight(); this.image = new BufferedImage(imageWidth, imageHeight, image.getType()); this.blockWidth = blockWidth; this.blockHeight = blockHeight; compData.add(Utils.intToByteArray(imageWidth)); compData.add(Utils.intToByteArray(imageHeight)); compData.add(Utils.intToByteArray(image.getType())); compData.add(Utils.intToByteArray(blockWidth)); compData.add(Utils.intToByteArray(blockHeight)); compData.add(Utils.intToByteArray(colors)); Color[][] block; int[][][] table; boolean inList; ArrayList list; for(int xb = 0; xb(); x: for(int x = 0; x=imageWidth) break y; if(yb+y>=imageHeight) continue x; block[x][y] = new Color(image.getRGB(xb+x, yb+y)); inList = false; for(int i = 0, size = list.size(); i top[4]) { a.ablegen(b.entnehmen()); count--; } b.ablegen(top); count++; } Color[] palette = new Color[colors]; Color previous = null; Integer[] current = null; for(int i = 0; i=imageWidth) break y; if(yb+y>=imageHeight) continue x; Color col = new Color(image.getRGB(xb+x, yb+y)); min = 2000; diff = 0; smallest = 0; for(int i = 0; i