37 import java.io.IOException;
38 import java.awt.image.*;
39
40 /**
41 * JPEG Image converter
42 *
43 * @author Jim Graham
44 */
45 public class JPEGImageDecoder extends ImageDecoder {
46 private static ColorModel RGBcolormodel;
47 private static ColorModel ARGBcolormodel;
48 private static ColorModel Graycolormodel;
49
50 private static final Class InputStreamClass = InputStream.class;
51 private static native void initIDs(Class InputStreamClass);
52
53 private ColorModel colormodel;
54
55 static {
56 java.security.AccessController.doPrivileged(
57 new sun.security.action.LoadLibraryAction("jpeg"));
58 initIDs(InputStreamClass);
59 RGBcolormodel = new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
60 ARGBcolormodel = ColorModel.getRGBdefault();
61 byte g[] = new byte[256];
62 for (int i = 0; i < 256; i++) {
63 g[i] = (byte) i;
64 }
65 Graycolormodel = new IndexColorModel(8, 256, g, g, g);
66 }
67
68 private native void readImage(InputStream is, byte buf[])
69 throws ImageFormatException, IOException;
70
71 Hashtable props = new Hashtable();
72
73 public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
74 super(src, is);
75 }
76
77 /**
|
37 import java.io.IOException;
38 import java.awt.image.*;
39
40 /**
41 * JPEG Image converter
42 *
43 * @author Jim Graham
44 */
45 public class JPEGImageDecoder extends ImageDecoder {
46 private static ColorModel RGBcolormodel;
47 private static ColorModel ARGBcolormodel;
48 private static ColorModel Graycolormodel;
49
50 private static final Class InputStreamClass = InputStream.class;
51 private static native void initIDs(Class InputStreamClass);
52
53 private ColorModel colormodel;
54
55 static {
56 java.security.AccessController.doPrivileged(
57 new java.security.PrivilegedAction<Void>() {
58 public Void run() {
59 System.loadLibrary("jpeg");
60 return null;
61 }
62 });
63 initIDs(InputStreamClass);
64 RGBcolormodel = new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
65 ARGBcolormodel = ColorModel.getRGBdefault();
66 byte g[] = new byte[256];
67 for (int i = 0; i < 256; i++) {
68 g[i] = (byte) i;
69 }
70 Graycolormodel = new IndexColorModel(8, 256, g, g, g);
71 }
72
73 private native void readImage(InputStream is, byte buf[])
74 throws ImageFormatException, IOException;
75
76 Hashtable props = new Hashtable();
77
78 public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
79 super(src, is);
80 }
81
82 /**
|