protected native InputStream _getBuiltinInputStream();
// FIXME
- protected ImageDecoder _decodeJPEG(InputStream is, String name) {
- try {
- return new JPEG(is);
- } catch (Exception e) {
- Log.log(this, "Exception while decoding JPEG image " + name);
- Log.log(this, e);
- return null;
- }
- }
+ protected native Picture _decodeJPEG(InputStream is, String name);
- /** Converts an InputStream carrying a JPEG image into an ARGB int[] */
- private static class JPEG extends ImageDecoder {
- int[] data;
- byte[] buffer;
- int width, height;
- InputStream is;
-
- public final int[] getData() { return data; }
- public final int getWidth() { return width; }
- public final int getHeight() { return height; }
- private JPEG(InputStream is) { this.is = is; nativeDecompress(); buffer = null; }
- private native void nativeDecompress();
- }
-
// FIXME: This could be optimized (a lot) by using a custom hashtable
public final static class Retainer {
private static Hash table = new Hash();