Package java.awt.image

Examples of java.awt.image.RenderedImage


    public Vector getSources(Long id) throws RemoteException {
        Vector sourceVector = getSource(id).getSources();
        int size = sourceVector.size();
        boolean isCloned = false;
        for(int i = 0; i < size; i++) {
            RenderedImage img = (RenderedImage)sourceVector.get(i);
            if(!(img instanceof Serializable)) {
                if(!isCloned) {
                    sourceVector = (Vector)sourceVector.clone();
                }
                sourceVector.set(i, new SerializableRenderedImage(img, false));
View Full Code Here


        if(!MediaLibAccessor.isMediaLibCompatible(args)) {
            return null;
        }

        // Return null if source data type is floating point.
        RenderedImage src = args.getRenderedSource(0);
        int dataType = src.getSampleModel().getDataType();
        if(dataType == DataBuffer.TYPE_FLOAT ||
           dataType == DataBuffer.TYPE_DOUBLE) {
            return null;
        }

        // Return null if ROI is non-null and not equals to source bounds.
        ROI roi = (ROI)args.getObjectParameter(0);
        if(roi != null &&
           !roi.equals(new Rectangle(src.getMinX(), src.getMinY(),
                                     src.getWidth(), src.getHeight()))) {
            return null;
        }

        // Get the non-ROI parameters.
        int xPeriod = args.getIntParameter(1);
View Full Code Here

            RenderedOp op = (RenderedOp)opNode;

            ParameterBlock pb = op.getParameterBlock();

            // Retrieve the rendered source image and its ROI.
            RenderedImage src = pb.getRenderedSource(0);
            Object property = src.getProperty("ROI");
            if (property == null ||
                property.equals(java.awt.Image.UndefinedProperty) ||
                !(property instanceof ROI)) {
                return java.awt.Image.UndefinedProperty;
            }
            ROI srcROI = (ROI)property;

            // Retrieve the Interpolation object.
            Interpolation interp = (Interpolation)pb.getObjectParameter(1);

            // Determine the effective source bounds.
            Rectangle srcBounds = null;
            PlanarImage dst = op.getRendering();
            if (dst instanceof GeometricOpImage &&
                ((GeometricOpImage)dst).getBorderExtender() == null) {
                srcBounds =
                    new Rectangle(src.getMinX() + interp.getLeftPadding(),
                                  src.getMinY() + interp.getTopPadding(),
                                  src.getWidth() - interp.getWidth() + 1,
                                  src.getHeight() - interp.getHeight() + 1);
            } else {
                srcBounds = new Rectangle(src.getMinX(),
            src.getMinY(),
            src.getWidth(),
            src.getHeight());
            }

            // If necessary, clip the ROI to the effective source bounds.
            if (!srcBounds.contains(srcROI.getBounds())) {
                srcROI = srcROI.intersect(new ROIShape(srcBounds));
View Full Code Here

                                RenderingHints hints) {
        if (!MediaLibAccessor.isMediaLibCompatible(args)) {
            return null;
        }

  RenderedImage source = args.getRenderedSource(0);
  ROI roi = (ROI)args.getObjectParameter(0);
        int xPeriod = args.getIntParameter(1);
        int yPeriod = args.getIntParameter(2);
  boolean saveLocations = ((Boolean)args.getObjectParameter(3)).booleanValue();
  int maxRuns = args.getIntParameter(4);
 
        int xStart = source.getMinX()// default values
        int yStart = source.getMinY();

        int maxWidth = source.getWidth();
        int maxHeight = source.getHeight();

  if (roi != null &&
      !roi.contains(xStart, yStart, maxWidth, maxHeight)) {
      return null;
  }
View Full Code Here

        }

  if (!modeName.equalsIgnoreCase("rendered"))
      return true;

        RenderedImage src1 = args.getRenderedSource(0);
        RenderedImage src2 = args.getRenderedSource(1);

        if (src1.getSampleModel().getNumBands() !=
            src2.getSampleModel().getNumBands()) {
            msg.append(getName() + " " +
                       JaiI18N.getString("PolarToComplexDescriptor1"));
            return false;
        }
View Full Code Here

        if(!oldParamBlock.getObjectParameter(4).equals(
                newParamBlock.getObjectParameter(4))) {
            // BorderExtender changed.

            // Get source and the left and top padding.
            RenderedImage src = oldParamBlock.getRenderedSource(0);
            int leftPad = oldParamBlock.getIntParameter(0);
            int topPad = oldParamBlock.getIntParameter(2);

            // Get source bounds.
            Rectangle srcBounds =
                new Rectangle(src.getMinX(), src.getMinY(),
                              src.getWidth(), src.getHeight());

            // Get destination bounds.
            Rectangle dstBounds =
                new Rectangle(srcBounds.x - leftPad,
                              srcBounds.y - topPad,
                              srcBounds.width + leftPad +
                              oldParamBlock.getIntParameter(1),
                              srcBounds.height + topPad +
                              oldParamBlock.getIntParameter(3));

            // Determine invalid area by subtracting source bounds.
            Area invalidArea = new Area(dstBounds);
            invalidArea.subtract(new Area(srcBounds));
            invalidRegion = invalidArea;

        } else if((newParamBlock.getIntParameter(1) <   // new R < old R
            oldParamBlock.getIntParameter(1) &&
            newParamBlock.getIntParameter(3) <=  // new B <= old B
            oldParamBlock.getIntParameter(3)) ||
           (newParamBlock.getIntParameter(3) <   // new B < old B
            oldParamBlock.getIntParameter(3) &&
            newParamBlock.getIntParameter(1) <=  // new R <= old R
            oldParamBlock.getIntParameter(1))) {
            // One or both right and bottom padding decreased.

            // Get source and the left and top padding.
            RenderedImage src = oldParamBlock.getRenderedSource(0);
            int leftPad = oldParamBlock.getIntParameter(0);
            int topPad = oldParamBlock.getIntParameter(2);

            // Get source bounds.
            Rectangle srcBounds =
                new Rectangle(src.getMinX(), src.getMinY(),
                              src.getWidth(), src.getHeight());

            // Get old destination bounds.
            Rectangle oldBounds =
                new Rectangle(srcBounds.x - leftPad,
                              srcBounds.y - topPad,
View Full Code Here

        }

        /* Get BorderExtender from hints if any. */
        BorderExtender extender = RIFUtil.getBorderExtenderHint(hints);

        RenderedImage source = args.getRenderedSource(0);

        /*
         * Get the Horizontal & Vertical kernels.
         * At this point these kernels should have the same width & height
         */
 
View Full Code Here

        if (!MediaLibAccessor.isMediaLibCompatible(new ParameterBlock())) {
            return null;
        }

        RenderedImage source = args.getRenderedSource(0);
        EnumeratedParameter scalingType =
            (EnumeratedParameter)args.getObjectParameter(0);
        EnumeratedParameter dataNature =
            (EnumeratedParameter)args.getObjectParameter(1);

        boolean isComplexSource =
            !dataNature.equals(DFTDescriptor.REAL_TO_COMPLEX);
        int numSourceBands = source.getSampleModel().getNumBands();

        // Use the two-dimensional mediaLib DFT if possible: it supports
        // only data which have a single component (real or complex)
        // per pixel and which have dimensions which are equal to a positive
        // power of 2.
        if(((isComplexSource && numSourceBands == 2) ||
            (!isComplexSource && numSourceBands == 1)) &&
           MlibDFTOpImage.isAcceptableSampleModel(source.getSampleModel())) {
            // If necessary, pad the source to ensure that
            // both dimensions are positive powers of 2.
            int sourceWidth = source.getWidth();
            int sourceHeight = source.getHeight();
            if(!MathJAI.isPositivePowerOf2(sourceWidth) ||
               !MathJAI.isPositivePowerOf2(sourceHeight)) {
                ParameterBlock pb = new ParameterBlock();
                pb.addSource(source);
                pb.add(0);
View Full Code Here

        // Retrieve the ImageEncodeParam object.
        ImageEncodeParam param =
            (ImageEncodeParam)args.getObjectParameter(2);

  RenderedImage src = args.getRenderedSource(0);

        // Verify that the image can be encoded with the given parameters.
        if (!codec.canEncodeImage(src, param)) {
            msg.append(getName() + " " +
                       JaiI18N.getString("EncodeDescriptor5"));
View Full Code Here

                                   this,
                                   false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
  }

  RenderedImage source;

  int size = getNumSources();
  for (int i=0; i < size; i++) {

      source = getSource(i);

      if (source instanceof RMIServerProxy) {
    try {
        RMIServerProxy rop = (RMIServerProxy)source;
        if (rop.serverName.equalsIgnoreCase(this.serverName)){
      // Send the id of the source
      remoteImage.setRenderedSource(id, rop.getRMIID(), i);
        } else {
      remoteImage.setRenderedSource(id,
                  rop.getRMIID(),
                  rop.serverName,
                  rop.operationName,
                  i);
        }
    } catch (RemoteException e) {
                    String message = JaiI18N.getString("RMIServerProxy6");
                    listener.errorOccurred(message,
                                           new RemoteImagingException(e),
                                           this, false);
//        throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
    }

      } else if (source instanceof RenderedOp) {
    /// XXX This should not happen, since by the time a
    // RMIServerProxy is created, all its sources should already
    // have been rendered. In any case, the following deals
    // correctly with the situation if it should arise.

    RenderedOp rop = (RenderedOp)source;
    RenderedImage rendering = rop.getRendering();
    if (!(rendering instanceof Serializable))
        rendering = new SerializableRenderedImage(rendering);

    try {
        remoteImage.setRenderedSource(id, rendering, i);
View Full Code Here

TOP

Related Classes of java.awt.image.RenderedImage

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.