viewing paste Unknown #405 | Java

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
private static void compressed(GravityInputStream in, GSprite out) throws IOException {
        byte[] storage;
        Integer i, len, pt;
        GSpriteImage image;
 
        // allocate the sprite image space for storage
        image = new GSpriteImage();
        image.resize(in.nextUShort(), in.nextUShort());
        len = in.nextUShort();
 
        // allocate space for storing the bytes of compressed data
        storage = new byte[len];
 
        // store the compressed pixel data within local storage
        in.read(storage);
 
        // process the pixels from the compressed data into uncompressed data
        for (i = 0, pt = 0; len > i; i++) {
            if (storage[i] == 0) {
                i++;
                pt += (storage[i] & 0xff);
            } else {
                image.setBinaryData(pt++, storage[i]);
            }
        }
 
        // append this uncompressed image onto the final sprite object
        out.getFrames().add(image);
    }
Viewed 809 times, submitted by Epoque.