Package com.sun.image.codec.jpeg

Examples of com.sun.image.codec.jpeg.JPEGImageDecoder


/* 103 */       stream = new NoMarkStream(stream);
/*     */     }
/*     */
/* 108 */     BufferedImage image = null;
/* 109 */     synchronized (LOCK) {
/* 110 */       JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(stream);
/*     */       try
/*     */       {
/* 114 */         image = decoder.decodeAsBufferedImage();
/*     */       } catch (ImageFormatException e) {
/* 116 */         String message = JaiI18N.getString("JPEGImageDecoder1");
/* 117 */         sendExceptionToListener(message, e);
/*     */       }
/*     */       catch (IOException e) {
View Full Code Here


/*      */
/*      */   private static final Raster decodeJPEG(byte[] data, JPEGDecodeParam decodeParam, boolean colorConvert, int minX, int minY)
/*      */   {
/*  157 */     ByteArrayInputStream jpegStream = new ByteArrayInputStream(data);
/*      */
/*  160 */     JPEGImageDecoder decoder = decodeParam == null ? JPEGCodec.createJPEGDecoder(jpegStream) : JPEGCodec.createJPEGDecoder(jpegStream, decodeParam);
/*      */
/*  166 */     Raster jpegRaster = null;
/*      */     try {
/*  168 */       jpegRaster = colorConvert ? decoder.decodeAsBufferedImage().getWritableTile(0, 0) : decoder.decodeAsRaster();
/*      */     }
/*      */     catch (IOException ioe)
/*      */     {
/*  172 */       String message = JaiI18N.getString("TIFFImage13");
/*  173 */       ImagingListenerProxy.errorOccurred(message, new ImagingException(message, ioe), TIFFImage.class, false);
View Full Code Here

/*  741 */       if (dir.isTagPresent(347)) {
/*  742 */         TIFFField jpegTableField = dir.getField(347);
/*  743 */         byte[] jpegTable = jpegTableField.getAsBytes();
/*  744 */         ByteArrayInputStream tableStream = new ByteArrayInputStream(jpegTable);
/*      */
/*  746 */         JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(tableStream);
/*      */
/*  748 */         decoder.decodeAsRaster();
/*  749 */         this.decodeParam = decoder.getJPEGDecodeParam();
/*  750 */       }break;
/*      */     default:
/*  754 */       throw new RuntimeException(JaiI18N.getString("TIFFImage10"));
/*      */     }
/*      */
View Full Code Here

/*  924 */     if (tableIndex != 0) {
/*  925 */       decodeParam = getJPEGDecodeParam(tableIndex);
/*      */     }
/*      */
/*  928 */     ByteArrayInputStream byteStream = new ByteArrayInputStream(data);
/*  929 */     JPEGImageDecoder decoder = decodeParam == null ? JPEGCodec.createJPEGDecoder(byteStream) : JPEGCodec.createJPEGDecoder(byteStream, decodeParam);
/*      */
/*  933 */     Raster raster = null;
/*      */     try {
/*  935 */       raster = decoder.decodeAsRaster().createTranslatedChild(tx, ty);
/*      */     }
/*      */     catch (Exception e) {
/*  938 */       ImagingListener listener = ImageUtil.getImagingListener(this.renderHints);
/*      */
/*  940 */       listener.errorOccurred(JaiI18N.getString("IIPResolutionOpImage3"), new ImagingException(e), this, false);
View Full Code Here

/*  972 */       while ((label = getLabel(stream)) != null) {
/*  973 */         if (label.startsWith("comp-group")) {
/*  974 */           byte[] table = getDataAsByteArray(stream);
/*  975 */           ByteArrayInputStream tableStream = new ByteArrayInputStream(table);
/*      */
/*  977 */           JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(tableStream);
/*      */           try
/*      */           {
/*  981 */             decoder.decodeAsRaster();
/*      */           }
/*      */           catch (Exception e) {
/*      */           }
/*  985 */           decodeParam = decoder.getJPEGDecodeParam();
/*      */         } else {
/*  987 */           checkError(label, stream, true);
/*      */         }
/*      */       }
/*      */
View Full Code Here

/* 602 */     JPEGDecodeParam param = null;
/*     */
/* 604 */     if (table != 0) {
/* 605 */       InputStream tableStream = new ByteArrayInputStream(this.JPEGTable[table]);
/*     */
/* 607 */       JPEGImageDecoder dec = JPEGCodec.createJPEGDecoder(tableStream);
/* 608 */       Raster junk = dec.decodeAsRaster();
/* 609 */       param = dec.getJPEGDecodeParam();
/*     */     }
/*     */
/* 612 */     this.subimageDataStream.seek(getTileOffset(tileIndex));
/*     */     JPEGImageDecoder dec;
/*     */     JPEGImageDecoder dec;
/* 613 */     if (param != null)
/* 614 */       dec = JPEGCodec.createJPEGDecoder(this.subimageDataStream, param);
/*     */     else {
/* 616 */       dec = JPEGCodec.createJPEGDecoder(this.subimageDataStream);
/*     */     }
/* 618 */     Raster ras = dec.decodeAsRaster().createTranslatedChild(tx, ty);
/*     */
/* 620 */     DataBufferByte dataBuffer = (DataBufferByte)ras.getDataBuffer();
/* 621 */     byte[] data = dataBuffer.getData();
/*     */
/* 623 */     int subimageColorType = this.subimageColor[this.resolution][0] >> 16;
View Full Code Here

/*     */     finally {
/* 119 */       ois.close();
/*     */     }
/*     */
/* 122 */     ByteArrayInputStream bais = new ByteArrayInputStream(data);
/* 123 */     JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(bais);
/*     */
/* 125 */     Object ras = decoder.decodeAsRaster().createTranslatedChild(location.x, location.y);
/*     */
/* 127 */     extractParameters(decoder.getJPEGDecodeParam(), ((Raster)ras).getSampleModel().getNumBands());
/*     */
/* 131 */     if (sm != null) {
/* 132 */       int minX = ((Raster)ras).getMinX();
/* 133 */       int minY = ((Raster)ras).getMinY();
/* 134 */       int h = ((Raster)ras).getHeight();
View Full Code Here

/* 231 */     int size = in.readInt();
/* 232 */     byte[] buffer = new byte[size];
/* 233 */     in.readFully(buffer);
/* 234 */     ByteArrayInputStream byteStream = new ByteArrayInputStream(buffer);
/*     */
/* 236 */     JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(byteStream);
/* 237 */     byteStream.close();
/*     */
/* 239 */     return decoder.decodeAsBufferedImage();
/*     */   }
View Full Code Here

     * UPDATE (SM):
     * This appears to be fixed on JDK 1.4
     */
    private void convert(InputStream in, double w, double h, OutputStream out) throws IOException, ProcessingException {
        try {
            JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(in);
            Raster original = decoder.decodeAsRaster();
            JPEGDecodeParam decodeParam = decoder.getJPEGDecodeParam();
            double ow = (double) decodeParam.getWidth();
            double oh = (double) decodeParam.getHeight();
            AffineTransformOp filter = new AffineTransformOp(getTransform(ow, oh, w, h), AffineTransformOp.TYPE_BILINEAR);
            WritableRaster scaled = filter.createCompatibleDestRaster(original);
            filter.filter(original, scaled);
View Full Code Here

             * UPDATE (SM):
             * This appears to be fixed on JDK 1.4
             */

            try {
                JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(inputStream);
                BufferedImage original = decoder.decodeAsBufferedImage();
                BufferedImage currentImage = original;

                if (width > 0 || height > 0) {
                    JPEGDecodeParam decodeParam = decoder.getJPEGDecodeParam();
                    double ow = decodeParam.getWidth();
                    double oh = decodeParam.getHeight();

                    if (usePercent == true) {
                        if (width > 0) {
View Full Code Here

TOP

Related Classes of com.sun.image.codec.jpeg.JPEGImageDecoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.