Package javax.media.jai.util

Examples of javax.media.jai.util.ImagingException


        } catch(Exception e) {

            ImagingListener listener =
                ImageUtil.getImagingListener(renderHints);
            listener.errorOccurred(JaiI18N.getString("IIPResolutionOpImage3"),
                                   new ImagingException(e),
                                   this, false);
/*
            String msg = JaiI18N.getString("IIPResolutionOpImage3")+" "+
                e.getMessage();
            throw new RuntimeException(msg);
View Full Code Here


                    cm = (ColorModel)cmMethod.invoke(null, args);
                } catch(Exception e) {
                    String message =
                        JaiI18N.getString("ImageUtil4") + cmMethod.getName();
                    sendExceptionToListener(message ,
                                            new ImagingException(message, e));
/*
                    // XXX Is this a reasonable Exception to throw?
                    throw new RuntimeException(cmMethod.getName()+" "+
                                               e.getMessage());
*/
 
View Full Code Here

                    sendExceptionToListener(JaiI18N.getString("SunTileScheduler6"), e);
//                    throw (RuntimeException)e;
                } else {
                    String message = JaiI18N.getString("SunTileScheduler6");
                    sendExceptionToListener(message,
                                            new ImagingException(message, e));
/*
                    throw new RuntimeException(e.getMessage()+"\n"+
                                               getStackTraceString(e));
*/
                }
View Full Code Here

                    if (e != null) {
                        // Throw a RuntimeException with the Exception's
                        // message concatenated with the stack trace.
                        String message = JaiI18N.getString("SunTileScheduler7");
                        sendExceptionToListener(message,
                                                new ImagingException(message, e));
/*
                        throw new RuntimeException(e.getMessage()+"\n"+
                                                   getStackTraceString(e));
*/
                    }
                }
            }
        } else { // numThreads == 0
            Request request = null;
            if(!isBlocking && !isPrefetch) {
                request = new Request(this, owner, tileIndices, listeners);
                returnValue = request;
            }

            // no workers; sequentially compute tiles in main thread
            Exception e = compute(owner, tileIndices, tiles, 0, numTiles,
                                  request);

            // Throw a RuntimeException with the Exception's
            // message concatenated with the stack trace.
            if(e != null) {
                String message = JaiI18N.getString("SunTileScheduler7");
                sendExceptionToListener(message,
                                        new ImagingException(message, e));
/*
                throw new RuntimeException(e.getMessage()+"\n"+
                                           getStackTraceString(e));
*/
            }
View Full Code Here

        try {
            this.i_transform = transform.createInverse();
        } catch (Exception e) {
            String message = JaiI18N.getString("AffineOpImage0");
            listener.errorOccurred(message,
                                   new ImagingException(message, e),
                                   this, false);
//            throw new RuntimeException(JaiI18N.getString("AffineOpImage0"));
        }
        this.f_transform = (AffineTransform)transform.clone();
View Full Code Here

                                                      bound);
                } else {
                    // Re-throw the error.
                    String message = JaiI18N.getString("CodecRIFUtil0");
                    listener.errorOccurred(message,
                                           new ImagingException(message,
                                                                memoryError),
                                           CodecRIFUtil.class, false);
//                    throw memoryError;
                }
            }
View Full Code Here

             pb,
             nodeSupport.getRenderingHints());

        // Throw an exception if the rendering is null.
        if (instance == null) {
            throw new ImagingException(JaiI18N.getString("RemoteRenderedOp2"));
        }

  // Save the state of the node.
  RenderingHints rh = nodeSupport.getRenderingHints();
        oldHints = rh == null ? null : (RenderingHints)rh.clone();
View Full Code Here

  if (descriptor == null) {
      Object[] msgArg0 = {new String(protocolName)};
      MessageFormat formatter = new MessageFormat("");
      formatter.setLocale(Locale.getDefault());
      formatter.applyPattern(JaiI18N.getString("RemoteJAI16"));
      throw new ImagingException(formatter.format(msgArg0));
  }

  int count=0;
  int numRetries = getNumRetries();
  int retryInterval = getRetryInterval();

  Exception rieSave = null;
  while (count++ < numRetries) {
      try {
    serverCap = descriptor.getServerCapabilities(serverName);
    break;
      } catch (RemoteImagingException rie) {
    // Print that an Exception occured
    System.err.println(JaiI18N.getString("RemoteJAI24"));
    rieSave = rie;
    // Sleep for retryInterval milliseconds
    try {
        Thread.sleep(retryInterval);
    } catch (InterruptedException ie) {
//        throw new RuntimeException(ie.toString());
                    sendExceptionToListener(JaiI18N.getString("Generic5"),
                                            new ImagingException(JaiI18N.getString("Generic5"), ie));
    }
      }
  }

  if (serverCap == null && count > numRetries) {
View Full Code Here

        try {
            at.preConcatenate(scale.createInverse());
        } catch(Exception e) {
            String message = JaiI18N.getString("IIPCRIF6");
            listener.errorOccurred(message,
                                   new ImagingException(message, e),
                                   this, false);
//            throw new RuntimeException(JaiI18N.getString("IIPCRIF6"));
        }

        // Compose the inverse residual mapping with the renderable
        // transform.
        AffineTransform afn =
            (AffineTransform)paramBlock.getObjectParameter(6);
        try {
            afn.preConcatenate(at.createInverse());
        } catch(Exception e) {
            String message = JaiI18N.getString("IIPCRIF6");
            listener.errorOccurred(message,
                                   new ImagingException(message, e),
                                   this, false);
//            throw new RuntimeException(JaiI18N.getString("IIPCRIF6"));
        }

        if(isFull) {
            // Append the WID and HEI composed image command modifiers using
            // the dimensions of the rendered destination region of interest.
            buf.append("&WID="+dstROI.width+"&HEI="+dstROI.height);
            /* XXX Begin suppressed section.
        } else if((opMask & MASK_TRANSFORM) != 0) {
            Point2D[] dstPts =
                new Point2D[] {new Point2D.Double(rgn.getMinX(),
                                                  rgn.getMinY()),
                                   new Point2D.Double(rgn.getMaxX(),
                                                      rgn.getMinY()),
                                   new Point2D.Double(rgn.getMinX(),
                                                      rgn.getMaxY())};
            Point2D[] srcPts = new Point2D[3];
            afn.transform(dstPts, 0, srcPts, 0, 3);

            double LLeft = srcPts[0].distance(srcPts[2]);
            double LTop = srcPts[0].distance(srcPts[1]);

            int[] maxSize = (int[])lowRes.getProperty("max-size");

            double H = maxSize[1]*LLeft;
            double W = maxSize[1]*LTop;

            double m = Math.max(H, W*(double)maxSize[1]/(double)maxSize[0]);

            int Hp = (int)(m + 0.5);
            int Wp = (int)(m*(double)maxSize[0]/(double)maxSize[1] + 0.5);
            System.out.println("Estimated dimensions = "+Wp+" x "+Hp);

            AffineTransform scl =
                AffineTransform.getScaleInstance(dstROI.getWidth()/Wp,
                                                 dstROI.getHeight()/Hp);
            System.out.println("scl = "+scl);
            afn.preConcatenate(scl);
            End suppressed section. XXX */
        }


        // Append the affine tranform composed image command.
        double[] matrix = new double[6];
        afn.getMatrix(matrix);
        buf.append("&AFN="+
                   matrix[0]+","+matrix[2]+",0,"+matrix[4]+","+
                   matrix[1]+","+matrix[3]+",0,"+matrix[5]+
                   ",0,0,1,0,0,0,0,1");

        // Destination aspect ratio.
        if((opMask & MASK_ASPECT_RATIO) != 0) {
            buf.append("&RAR="+paramBlock.getFloatParameter(7));
        }

        // Destination rectangle of interest.
        if((opMask & MASK_ROI_DESTINATION) != 0) {
            Rectangle2D dstRGN =
                (Rectangle2D)paramBlock.getObjectParameter(8);
            buf.append("&RGN="+dstRGN.getX()+","+ dstRGN.getY()+","+
                       dstRGN.getWidth()+","+dstRGN.getHeight());
        }

        // Rotation and mirroring.
        if(isFull) {
            if((opMask & MASK_ROTATION) != 0 ||
               (opMask & MASK_MIRROR_AXIS) != 0) {
                buf.append("&RFM="+paramBlock.getIntParameter(9));
                if((opMask & MASK_MIRROR_AXIS) != 0) {
                    String axis = (String)paramBlock.getObjectParameter(10);
                    if(axis.equalsIgnoreCase("x")) {
                        buf.append(",0");
                    } else {
                        buf.append(",90");
                    }
                }
            }
        }

        // ICC profile.
        if((opMask & MASK_ICC_PROFILE) != 0) {
            // According to the IIP specification this is not supported
            // over HTTP connections and that is all that is available from
            // the vendors right now, i.e., no socket connections are
            // available (includes LivePicture and TrueSpectra).
        }

        // JPEG quality and compression group index.
        if(isJPEG) {
            if((opMask & MASK_JPEG_QUALITY) != 0) {
                buf.append("&QLT="+paramBlock.getIntParameter(12));
            }

            if((opMask & MASK_JPEG_TABLE) != 0) {
                buf.append("&CIN="+paramBlock.getIntParameter(13));
            }
        }

        // Set the format string.
        String format = isJPEG ? "JPEG" : "FPX";

        // Append the CVT command.
        buf.append("&CVT="+format);

        // Create a URL with the CVT string, open a stream from it, and
        // decode the image using the appropriate decoder.
        InputStream stream = null;
        RenderedImage rendering = null;
        try {
            URL url = new URL(buf.toString());
            stream = url.openStream();
            MemoryCacheSeekableStream sStream =
                new MemoryCacheSeekableStream(stream);
            rendering = JAI.create(format, sStream);
        } catch(Exception e) {
            String message =
                JaiI18N.getString("IIPCRIF7") + " " + buf.toString();
            listener.errorOccurred(message,
                                   new ImagingException(message, e),
                                   this, false);
//            throw new RuntimeException(e.getClass()+" "+e.getMessage());
        }

        // If WID and HEI modifiers are unavailable add scale.
View Full Code Here

                    try {
                    at = at.createInverse();
                    } catch(Exception e) {
                        String message = JaiI18N.getString("IIPCRIF6");
                        listener.errorOccurred(message,
                                               new ImagingException(message, e),
                                               this, false);

//                        throw new RuntimeException(JaiI18N.getString("IIPCRIF6"));
                    }
                }
View Full Code Here

TOP

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

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.