Package java.awt.image.renderable

Examples of java.awt.image.renderable.RenderableImage


    public Object getProperty(String name) {
        Object ret = props.get(name);
        if (ret != null) return ret;
        Iterator i = srcs.iterator();
        while (i.hasNext()) {
            RenderableImage ri = (RenderableImage)i.next();
            ret = ri.getProperty(name);
            if (ret != null) return ret;
        }
        return null;
    }
View Full Code Here


            ret[i++] = (String)iter.next();
        }

        iter = srcs.iterator();
        while (iter.hasNext()) {
            RenderableImage ri = (RenderableImage)iter.next();
            String [] srcProps = ri.getPropertyNames();
            if (srcProps.length != 0) {
                String [] tmp = new String[ret.length+srcProps.length];
                System.arraycopy(tmp,0,tmp,0,ret.length);
                System.arraycopy(tmp,ret.length,srcProps,0,srcProps.length);
                ret = tmp;
View Full Code Here

        // If the source is a local RenderableImage, the only way
        // to access it from a remote machine is to wrap it in
        // a SerializableRenderableImage and then set the SRI as
        // the source on the remote operation.
        RenderableImage ri = (RenderableImage)source;
        try {
      SerializableRenderableImage sri =
          new SerializableRenderableImage(ri);
      remoteImage.setRenderableSource(opID, sri, i);
      newPB.setSource(sri, i);
View Full Code Here

    /**
     * Gets the bounding box for the output of <code>AffineOpImage</code>.
     * This method satisfies the implementation of CRIF.
     */
    public Rectangle2D getBounds2D(ParameterBlock paramBlock) {
        RenderableImage source = paramBlock.getRenderableSource(0);
        Object arg0 = paramBlock.getObjectParameter(0);
        AffineTransform forward_tr = (AffineTransform)arg0;

        Object arg1 = paramBlock.getObjectParameter(1);
        Interpolation interp = (Interpolation)arg1;

        // Get the affine transform
        double tr[];
        tr = new double[6];
        forward_tr.getMatrix(tr);

        //
        // Check and see if the affine transform is doing a copy.
        //
        if ((tr[0] == 1.0) &&
            (tr[3] == 1.0) &&
            (tr[2] == 0.0) &&
            (tr[1] == 0.0) &&
            (tr[4] == 0.0) &&
            (tr[5] == 0.0)) {
            return new Rectangle2D.Float(source.getMinX(),
                                         source.getMinY(),
                                         source.getWidth(),
                                         source.getHeight());
        }

        //
        // Check and see if the affine transform is in fact doing
        // a Translate operation.
        //
        if ((tr[0] == 1.0) &&
            (tr[3] == 1.0) &&
            (tr[2] == 0.0) &&
            (tr[1] == 0.0) &&
            (Math.abs(tr[4] - (int) tr[4]) < TOLERANCE) &&
            (Math.abs(tr[5] - (int) tr[5]) < TOLERANCE)) {
            return new Rectangle2D.Float(source.getMinX() + (float)tr[4],
                                         source.getMinY() + (float)tr[5],
                                         source.getWidth(),
                                         source.getHeight());
        }

        //
        // Check and see if the affine transform is in fact doing
        // a Scale operation.
        //
        if ((tr[0] > 0.0) &&
            (tr[2] == 0.0) &&
            (tr[1] == 0.0) &&
            (tr[3] > 0.0)) {
            // Get the source dimensions
            float x0 = (float)source.getMinX();
            float y0 = (float)source.getMinY() ;
            float w = (float)source.getWidth();
            float h = (float)source.getHeight();

            // Forward map the source using x0, y0, w and h
            float d_x0 = x0 * (float)tr[0] + (float)tr[4];
            float d_y0 = y0 * (float)tr[3] + (float)tr[5];
            float d_w = w * (float)tr[0];
            float d_h = h * (float)tr[3];

            return new Rectangle2D.Float(d_x0,
           d_y0,
           d_w,
                                         d_h);
        }

        // It's an Affine

        //
        // Get sx0,sy0 coordinates and width & height of the source
        //
        float sx0 = (float) source.getMinX();
        float sy0 = (float) source.getMinY();
        float sw = (float) source.getWidth();
        float sh = (float) source.getHeight();

        //
        // The 4 points (clockwise order) are
        //      (sx0, sy0),    (sx0+sw, sy0)
        //      (sx0, sy0+sh), (sx0+sw, sy0+sh)
View Full Code Here

        // Check for a SoftReference hashed on a ParameterBlock-derived key.
        Object key = getKey(paramBlock);
        SoftReference ref = (SoftReference)mresTable.get(key);

        // Retrieve the image from the SoftReference if possible.
        RenderableImage mres = null;
        if(ref != null && (mres = (RenderableImage)ref.get()) == null) {
            // null referent: remove the ParameterBlock key from the Hashtable.
            mresTable.remove(key);
        }
View Full Code Here

     * in the renderable layer. This method satisfies the
     * implementation of CRIF.
     */
    public RenderedImage create(RenderContext renderContext,
                                ParameterBlock paramBlock) {
        RenderableImage mres = createRenderable(paramBlock);

        return mres.createRendering(renderContext);
    }
View Full Code Here

    /**
     * Gets the output bounding box in rendering-independent space.
     * This method satisfies the implementation of CRIF.
     */
    public Rectangle2D getBounds2D(ParameterBlock paramBlock) {       
        RenderableImage mres = createRenderable(paramBlock);

  return new Rectangle2D.Float(mres.getMinX(), mres.getMinY(),
                                     mres.getWidth(), mres.getHeight());
    }
View Full Code Here

     * Gets the bounding box for the output of <code>ScaleOpImage</code>.
     * This method satisfies the implementation of CRIF.
     */
    public Rectangle2D getBounds2D(ParameterBlock paramBlock) {       

        RenderableImage source = paramBlock.getRenderableSource(0);

        float scale_x = paramBlock.getFloatParameter(0);
        float scale_y = paramBlock.getFloatParameter(1);
        float trans_x = paramBlock.getFloatParameter(2);
        float trans_y = paramBlock.getFloatParameter(3);
        Interpolation interp = (Interpolation)paramBlock.getObjectParameter(4);

  // Get the source dimensions
  float x0 = (float)source.getMinX();
  float y0 = (float)source.getMinY() ;
  float w = (float)source.getWidth();
  float h = (float)source.getHeight();
 
  // Forward map the source using x0, y0, w and h
  float d_x0 = x0 * scale_x + trans_x;
  float d_y0 = y0 * scale_y + trans_y;
  float d_w = w * scale_x;
 
View Full Code Here

     * Gets the bounding box for the output of <code>ScaleOpImage</code>.
     * This method satisfies the implementation of CRIF.
     */
    public Rectangle2D getBounds2D(ParameterBlock paramBlock) {       

        RenderableImage source = paramBlock.getRenderableSource(0);

        double scaleX = paramBlock.getDoubleParameter(0);
        double scaleY = paramBlock.getDoubleParameter(1);

  // Get the source dimensions
  float x0 = (float)source.getMinX();
  float y0 = (float)source.getMinY() ;
  float w = (float)source.getWidth();
  float h = (float)source.getHeight();
 
  // Forward map the source using x0, y0, w and h
  float d_x0 = (float)(x0 * scaleX);
  float d_y0 = (float)(y0 * scaleY);
  float d_w = (float)(w * scaleX);
 
View Full Code Here

     */
    public RenderedImage create(RenderContext renderContext,
                                ParameterBlock paramBlock) {

  // Get the two renderable alpha images from the parameter block
  RenderableImage alphaImage1 =
      (RenderableImage)paramBlock.getObjectParameter(0);
  RenderableImage alphaImage2 =
      (RenderableImage)paramBlock.getObjectParameter(1);

  // Cause the two renderable alpha images to be rendered
  RenderedImage rAlphaImage1 =
      alphaImage1.createRendering(renderContext);
  RenderedImage rAlphaImage2 =
      alphaImage2.createRendering(renderContext);

  ParameterBlock newPB = (ParameterBlock)paramBlock.clone();

  // Replace the renderable alpha images in the ParameterBlock with
  // their renderings
View Full Code Here

TOP

Related Classes of java.awt.image.renderable.RenderableImage

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.