Package javax.media.jai.util

Examples of javax.media.jai.util.ImagingListener


        return ti;
    }

    void sendExceptionToListener(String message, Exception e) {
        ImagingListener listener = null;
        if (renderingHints != null)
            listener =
                (ImagingListener)renderingHints.get(JAI.KEY_IMAGING_LISTENER);

        if (listener == null)
            listener = JAI.getDefaultInstance().getImagingListener();
        listener.errorOccurred(message, e, this, false);
    }
View Full Code Here


      clientCapabilities = rrif.getClientCapabilities();
  }
    }

    void sendExceptionToListener(Exception e) {
        ImagingListener listener = null;
        if (hints != null)
            listener = (ImagingListener)hints.get(JAI.KEY_IMAGING_LISTENER);
        else
            listener = JAI.getDefaultInstance().getImagingListener();
        String message = JaiI18N.getString("PlanarImageServerProxy2");
        listener.errorOccurred(message,
                               new RemoteImagingException(message, e),
                               this, false);
    }
View Full Code Here

    /**
     * Creates an image from a String containing a file name.
     */
    public RenderedImage create(ParameterBlock args,
                                RenderingHints hints) {
        ImagingListener listener = ImageUtil.getImagingListener(hints);

        try {
            // Create a SeekableStream from the file name (first parameter).
            String fileName = (String)args.getObjectParameter(0);

      SeekableStream src = null;
      try {
                src = new FileSeekableStream(fileName);
            } catch (FileNotFoundException fnfe) {
    // Try to get the file as an InputStream resource. This would
    // happen when the application and image file are packaged in
    // a JAR file
    InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
    if (is != null)
        src = SeekableStream.wrapInputStream(is, true);
            }

            ImageDecodeParam param = null;
            if (args.getNumParameters() > 1) {
                param = (ImageDecodeParam)args.getObjectParameter(1);
            }

            ParameterBlock newArgs = new ParameterBlock();
            newArgs.add(src);
            newArgs.add(param);

            RenderingHints.Key key = JAI.KEY_OPERATION_BOUND;
            int bound = OpImage.OP_IO_BOUND;
            if (hints == null) {
                hints = new RenderingHints(key, new Integer(bound));
            } else if (!hints.containsKey(key)) {
                hints = (RenderingHints)hints.clone();
                hints.put(key, new Integer(bound));
            }

            // Get the registry from the hints, if any.
            // Don't check for null hints as it cannot be null here.
            OperationRegistry registry =
                (OperationRegistry)hints.get(JAI.KEY_OPERATION_REGISTRY);

            // Create the image using the most preferred RIF for "stream".
            RenderedImage image =
    RIFRegistry.create(registry, "stream", newArgs, hints);

            return image == null ? null : new StreamImage(image, src);

        } catch (FileNotFoundException e) {
            String message =
                JaiI18N.getString("FileLoadRIF0") + args.getObjectParameter(0);
            listener.errorOccurred(message, e, this, false);
//            e.printStackTrace();
            return null;
        } catch (Exception e) {
            String message = JaiI18N.getString("FileLoadRIF1");
            listener.errorOccurred(message, e, this, false);
//            e.printStackTrace();
            return null;
        }
    }
View Full Code Here

         java.awt.RenderingHints.class};

      factoryMethod = factoryClass.getMethod("create", paramTypes);

  } catch (NoSuchMethodException e) {
            ImagingListener listener =
                JAI.getDefaultInstance().getImagingListener();
            String message = JaiI18N.getString("RegistryMode0") + " " +
                             factoryClass.getName() + ".";
            listener.errorOccurred(message, e,
                                   RenderedRegistryMode.class, false);
//      e.printStackTrace();
  }

  return factoryMethod;
View Full Code Here

                java.awt.image.SampleModel.class};

      factoryMethod = factoryClass.getMethod("createEncoder", paramTypes);

  } catch (NoSuchMethodException e) {
            ImagingListener listener =
                JAI.getDefaultInstance().getImagingListener();
            String message = JaiI18N.getString("RegistryMode0") + " " +
                             factoryClass.getName() + ".";
            listener.errorOccurred(message, e,
                                   TileEncoderRegistryMode.class, false);
//      e.printStackTrace();
  }

  return factoryMethod;
View Full Code Here

         java.awt.RenderingHints.class};

      factoryMethod = factoryClass.getMethod("create", paramTypes);

  } catch (NoSuchMethodException e) {
            ImagingListener listener =
                JAI.getDefaultInstance().getImagingListener();
            String message = JaiI18N.getString("RegistryMode0") + " " +
                             factoryClass.getName() + ".";
            listener.errorOccurred(message, e,
                                   CollectionRegistryMode.class, false);
//      e.printStackTrace();
  }

  return factoryMethod;
View Full Code Here

                TileCodecParameterList.class};

      factoryMethod = factoryClass.getMethod("createDecoder", paramTypes);

  } catch (NoSuchMethodException e) {
            ImagingListener listener =
                JAI.getDefaultInstance().getImagingListener();
            String message = JaiI18N.getString("RegistryMode0") + " " +
                             factoryClass.getName() + ".";
            listener.errorOccurred(message, e,
                                   TileDecoderRegistryMode.class, false);
//      e.printStackTrace();
  }

  return factoryMethod;
View Full Code Here

         java.awt.image.renderable.ParameterBlock.class,
         java.awt.RenderingHints.class};

      factoryMethod = factoryClass.getMethod("create", paramTypes);
  } catch (NoSuchMethodException e) {
            ImagingListener listener =
                JAI.getDefaultInstance().getImagingListener();
            String message = JaiI18N.getString("RegistryMode0") + " " +
                             factoryClass.getName() + ".";
            listener.errorOccurred(message, e,
                                   RemoteRenderedRegistryMode.class, false);
//      e.printStackTrace();
  }

  return factoryMethod;
View Full Code Here

        {java.awt.image.renderable.ParameterBlock.class};

      factoryMethod = factoryClass.getMethod("create", paramTypes);

  } catch (NoSuchMethodException e) {
            ImagingListener listener =
                JAI.getDefaultInstance().getImagingListener();
            String message = JaiI18N.getString("RegistryMode0") + " " +
                             factoryClass.getName() + ".";
            listener.errorOccurred(message, e,
                                   RenderableCollectionRegistryMode.class, false);
//      e.printStackTrace();
  }

  return factoryMethod;
View Full Code Here

    public ImagingListener getImagingListener() {
        return imagingListener;
    }

    private void sendExceptionToListener(String message, Exception e) {
        ImagingListener listener = getImagingListener();
        listener.errorOccurred(message, e, this, false);
    }
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.