src/share/classes/sun/awt/image/JPEGImageDecoder.java

Print this page




  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<String, Object> props = new Hashtable<>();
  77 
  78     public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
  79         super(src, is);




  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("javajpeg");
  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<String, Object> props = new Hashtable<>();
  77 
  78     public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
  79         super(src, is);