Package javax.media.jai.util

Examples of javax.media.jai.util.ImagingListener


/*      */     }
/* 1510 */     return new BigInteger(uid);
/*      */   }
/*      */
/*      */   static void sendExceptionToListener(String message, Exception e) {
/* 1514 */     ImagingListener listener = getImagingListener((RenderingHints)null);
/*      */
/* 1516 */     listener.errorOccurred(message, e, ImageUtil.class, false);
/*      */   }
View Full Code Here


/*     */
/*     */ public class CodecRIFUtil
/*     */ {
/*     */   public static RenderedImage create(String type, ParameterBlock paramBlock, RenderingHints renderHints)
/*     */   {
/*  46 */     ImagingListener listener = ImageUtil.getImagingListener(renderHints);
/*     */
/*  48 */     SeekableStream source = (SeekableStream)paramBlock.getObjectParameter(0);
/*     */
/*  51 */     ImageDecodeParam param = null;
/*  52 */     if (paramBlock.getNumParameters() > 1) {
/*  53 */       param = (ImageDecodeParam)paramBlock.getObjectParameter(1);
/*     */     }
/*  55 */     int page = 0;
/*  56 */     if (paramBlock.getNumParameters() > 2) {
/*  57 */       page = paramBlock.getIntParameter(2);
/*     */     }
/*     */
/*  60 */     ImageDecoder dec = ImageCodec.createImageDecoder(type, source, param);
/*     */     try {
/*  62 */       int bound = 2;
/*  63 */       ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
/*     */
/*  65 */       if (renderHints != null)
/*     */       {
/*  68 */         RenderingHints.Key key = JAI.KEY_OPERATION_BOUND;
/*  69 */         if (renderHints.containsKey(key)) {
/*  70 */           bound = ((Integer)renderHints.get(key)).intValue();
/*     */         }
/*     */
/*     */       }
/*     */
/*  77 */       boolean canAttemptRecovery = source.canSeekBackwards();
/*     */
/*  80 */       long streamPosition = -9223372036854775808L;
/*  81 */       if (canAttemptRecovery) {
/*     */         try {
/*  83 */           streamPosition = source.getFilePointer();
/*     */         } catch (IOException ioe) {
/*  85 */           listener.errorOccurred(JaiI18N.getString("StreamRIF1"), ioe, CodecRIFUtil.class, false);
/*     */
/*  89 */           canAttemptRecovery = false;
/*     */         }
/*     */       }
/*     */
/*  93 */       OpImage image = null;
/*     */       try
/*     */       {
/*  96 */         image = new NullOpImage(dec.decodeAsRenderedImage(page), layout, renderHints, bound);
/*     */       }
/*     */       catch (OutOfMemoryError memoryError)
/*     */       {
/* 104 */         if (canAttemptRecovery)
/*     */         {
/* 106 */           TileCache cache = image != null ? image.getTileCache() : RIFUtil.getTileCacheHint(renderHints);
/*     */
/* 109 */           if (cache != null) {
/* 110 */             cache.flush();
/*     */           }
/*     */
/* 114 */           System.gc();
/*     */
/* 117 */           source.seek(streamPosition);
/*     */
/* 120 */           image = new NullOpImage(dec.decodeAsRenderedImage(page), layout, renderHints, bound);
/*     */         }
/*     */         else
/*     */         {
/* 126 */           String message = JaiI18N.getString("CodecRIFUtil0");
/* 127 */           listener.errorOccurred(message, new ImagingException(message, memoryError), CodecRIFUtil.class, false);
/*     */         }
/*     */
/*     */       }
/*     */
/* 135 */       return image;
/*     */     } catch (Exception e) {
/* 137 */       listener.errorOccurred(JaiI18N.getString("CodecRIFUtil1"), e, CodecRIFUtil.class, false);
/*     */     }
/*     */
/* 140 */     return null;
/*     */   }
View Full Code Here

/*    */     try {
/* 87 */       op = new MlibHistogramOpImage(src, xPeriod, yPeriod, numBins, lowValueFP, highValueFP);
/*    */     }
/*    */     catch (Exception e)
/*    */     {
/* 91 */       ImagingListener listener = ImageUtil.getImagingListener(hints);
/* 92 */       String message = JaiI18N.getString("MlibHistogramRIF0");
/* 93 */       listener.errorOccurred(message, e, this, false);
/*    */     }
/*    */
/* 96 */     return op;
/*    */   }
View Full Code Here

/*     */     {
/*  83 */       Object object = ois.readObject();
/*  84 */       return TileCodecUtils.deserializeRaster(object);
/*     */     }
/*     */     catch (ClassNotFoundException e) {
/*  87 */       ImagingListener listener = ImageUtil.getImagingListener((RenderingHints)null);
/*     */
/*  89 */       listener.errorOccurred(JaiI18N.getString("ClassNotFound"), e, this, false);
/*     */
/*  93 */       return null;
/*     */     }
/*     */     finally {
/*  96 */       ois.close();
View Full Code Here

/* 106 */       sm = TileCodecUtils.deserializeSampleModel(ois.readObject());
/* 107 */       location = (Point)ois.readObject();
/* 108 */       data = (byte[])ois.readObject();
/*     */     }
/*     */     catch (ClassNotFoundException e) {
/* 111 */       ImagingListener listener = ImageUtil.getImagingListener((RenderingHints)null);
/*     */
/* 113 */       listener.errorOccurred(JaiI18N.getString("ClassNotFound"), e, this, false);
/*     */
/* 116 */       return null;
/*     */     }
/*     */     finally {
/* 119 */       ois.close();
View Full Code Here

/*      */     }
/*      */   }
/*      */
/*      */   void sendExceptionToListener(String message, Throwable e)
/*      */   {
/* 1652 */     ImagingListener listener = ImageUtil.getImagingListener((RenderingHints)null);
/*      */
/* 1654 */     listener.errorOccurred(message, e, this, false);
/*      */   }
View Full Code Here

/* 1095 */       System.out.println(ct);
/*      */     }
/*      */   }
/*      */
/*      */   void sendExceptionToListener(String message, Exception e) {
/* 1100 */     ImagingListener listener = ImageUtil.getImagingListener((RenderingHints)null);
/*      */
/* 1102 */     listener.errorOccurred(message, e, this, false);
/*      */   }
View Full Code Here

/*      */   {
/* 2871 */     return this.imagingListener;
/*      */   }
/*      */
/*      */   private void sendExceptionToListener(String message, Exception e) {
/* 2875 */     ImagingListener listener = getImagingListener();
/* 2876 */     listener.errorOccurred(message, e, this, false);
/*      */   }
View Full Code Here

/* 50 */       Class[] paramTypes = { ParameterBlock.class };
/*    */
/* 53 */       factoryMethod = factoryClass.getMethod("create", paramTypes);
/*    */     }
/*    */     catch (NoSuchMethodException e) {
/* 56 */       ImagingListener listener = JAI.getDefaultInstance().getImagingListener();
/*    */
/* 58 */       String message = JaiI18N.getString("RegistryMode0") + " " + factoryClass.getName() + ".";
/*    */
/* 60 */       listener.errorOccurred(message, e, RenderableCollectionRegistryMode.class, false);
/*    */     }
/*    */
/* 65 */     return factoryMethod;
/*    */   }
View Full Code Here

/* 51 */       Class[] paramTypes = { RenderContext.class, ParameterBlock.class };
/*    */
/* 55 */       factoryMethod = factoryClass.getMethod("create", paramTypes);
/*    */     }
/*    */     catch (NoSuchMethodException e) {
/* 58 */       ImagingListener listener = JAI.getDefaultInstance().getImagingListener();
/*    */
/* 60 */       String message = JaiI18N.getString("RegistryMode0") + " " + factoryClass.getName() + ".";
/*    */
/* 62 */       listener.errorOccurred(message, e, RenderableRegistryMode.class, false);
/*    */     }
/*    */
/* 67 */     return factoryMethod;
/*    */   }
View Full Code Here

TOP

Related Classes of javax.media.jai.util.ImagingListener

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.