All pastes #387157 Raw Edit

Something

public text v1 · immutable
·published 2007-03-09 03:27 UTC
rendered paste body
    public Sprite(String s, int i)
    {
	System.out.println(s);
        anInt1477 = -235;
        aBoolean1478 = true;
        aByte1479 = 5;
        anInt1480 = -3539;
        anInt1481 = -766;
        anInt1482 = -766;
        anInt1483 = 1;
        aBoolean1484 = true;
        aBoolean1485 = false;
        aBoolean1486 = false;
        aBoolean1487 = true;
        anInt1488 = 3600;
        ByteStream stream = new ByteStream(FileOperations.ReadFile("cache/"+s + ".dat"));
        ByteStream stream1 = new ByteStream(FileOperations.ReadFile("cache/"+"index.dat"));
        stream1.currentOffset = stream.readUnsignedWord();
        anInt1494 = stream1.readUnsignedWord();
        anInt1495 = stream1.readUnsignedWord();
        int j = stream1.readUnsignedByte();
        int ai[] = new int[j];
        for(int k = 0; k < j - 1; k++)
        {
            ai[k + 1] = stream1.read3Bytes();
            if(ai[k + 1] == 0)
                ai[k + 1] = 1;
        }

        for(int l = 0; l < i; l++)
        {
            stream1.currentOffset += 2;
            stream.currentOffset += stream1.readUnsignedWord() * stream1.readUnsignedWord();
            stream1.currentOffset++;
        }

        anInt1492 = stream1.readUnsignedByte();
        anInt1493 = stream1.readUnsignedByte();
        myWidth = stream1.readUnsignedWord();
        myHeight = stream1.readUnsignedWord();
        int i1 = stream1.readUnsignedByte();
        int j1 = myWidth * myHeight;
        myPixels = new int[j1];
        if(i1 == 0){
            for(int k1 = 0; k1 < j1; k1++)
                myPixels[k1] = ai[stream.readUnsignedByte()];
	SaveImage(myWidth ,  myHeight, myPixels, s+i);

            return;
        }
        if(i1 == 1)
        {
            for(int l1 = 0; l1 < myWidth; l1++)
            {
                for(int i2 = 0; i2 < myHeight; i2++)
                    myPixels[l1 + i2 * myWidth] = ai[stream.readUnsignedByte()];

            }

        }
    }


public void SaveImage(int w, int h, int[] pix,String i){   
        int width = w;
        int height = h;
        BufferedImage bi= new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
	bi.setRGB(0,0,width, height, pix, 0, width);
        Graphics2D g2d = bi.createGraphics();
        g2d.dispose();
    	try {
        	File file = new File("image/"+i+".png");
        	ImageIO.write(bi, "png", file);
    	} 
	catch (IOException e) {
	}
}