Package java.awt.image.renderable

Examples of java.awt.image.renderable.RenderableImage


/* 155 */     return RC;
/*     */   }
/*     */
/*     */   public Rectangle2D getBounds2D(ParameterBlock paramBlock)
/*     */   {
/* 164 */     RenderableImage source = paramBlock.getRenderableSource(0);
/*     */
/* 166 */     float scale_x = paramBlock.getFloatParameter(0);
/* 167 */     float scale_y = paramBlock.getFloatParameter(1);
/*     */
/* 170 */     float x0 = source.getMinX();
/* 171 */     float y0 = source.getMinY();
/* 172 */     float w = source.getWidth();
/* 173 */     float h = source.getHeight();
/*     */
/* 176 */     float d_x0 = x0 * scale_x;
/* 177 */     float d_y0 = y0 * scale_y;
/* 178 */     float d_w = w * scale_x;
/* 179 */     float d_h = h * scale_y;
 
View Full Code Here


/* 281 */     return RC;
/*     */   }
/*     */
/*     */   public Rectangle2D getBounds2D(ParameterBlock paramBlock)
/*     */   {
/* 289 */     RenderableImage source = paramBlock.getRenderableSource(0);
/*     */
/* 291 */     float x_center = paramBlock.getFloatParameter(0);
/* 292 */     float y_center = paramBlock.getFloatParameter(1);
/* 293 */     float angle = paramBlock.getFloatParameter(2);
/* 294 */     Interpolation interp = (Interpolation)paramBlock.getObjectParameter(3);
/*     */
/* 302 */     int dangle = 0;
/* 303 */     double tmp_angle = 180.0F * angle / 3.141592653589793D;
/* 304 */     double rnd_angle = Math.round(tmp_angle);
/*     */
/* 306 */     if (Math.abs(rnd_angle - tmp_angle) < 0.0001D)
/* 307 */       dangle = (int)rnd_angle;
/*     */     else {
/* 309 */       dangle = (int)tmp_angle;
/*     */     }
/*     */
/* 315 */     if (dangle % 360 == 0) {
/* 316 */       return new Rectangle2D.Float(source.getMinX(), source.getMinY(), source.getWidth(), source.getHeight());
/*     */     }
/*     */
/* 325 */     float x0 = source.getMinX();
/* 326 */     float y0 = source.getMinY();
/* 327 */     float s_width = source.getWidth();
/* 328 */     float s_height = source.getHeight();
/* 329 */     float x1 = x0 + s_width - 1.0F;
/* 330 */     float y1 = y0 + s_height - 1.0F;
/*     */
/* 332 */     float tx0 = 0.0F;
/* 333 */     float ty0 = 0.0F;
/* 334 */     float tx1 = 0.0F;
/* 335 */     float ty1 = 0.0F;
/*     */
/* 337 */     if (dangle % 270 == 0) {
/* 338 */       if (dangle < 0)
/*     */       {
/* 340 */         tx0 = s_height - y1 - 1.0F;
/* 341 */         ty0 = x0;
/* 342 */         tx1 = s_height - y0 - 1.0F;
/* 343 */         ty1 = x1;
/* 344 */         return new Rectangle2D.Float(tx0, ty0, tx1 - tx0 + 1.0F, ty1 - ty0 + 1.0F);
/*     */       }
/*     */
/* 350 */       tx0 = y0;
/* 351 */       ty0 = s_width - x1 - 1.0F;
/* 352 */       tx1 = y1;
/* 353 */       ty1 = s_width - x0 - 1.0F;
/* 354 */       return new Rectangle2D.Float(tx0, ty0, tx1 - tx0 + 1.0F, ty1 - ty0 + 1.0F);
/*     */     }
/*     */
/* 361 */     if (dangle % 180 == 0) {
/* 362 */       tx0 = s_width - x1 - 1.0F;
/* 363 */       ty0 = s_height - y1 - 1.0F;
/* 364 */       tx1 = s_width - x0 - 1.0F;
/* 365 */       ty1 = s_height - y0 - 1.0F;
/*     */
/* 367 */       return new Rectangle2D.Float(tx0, ty0, tx1 - tx0 + 1.0F, ty1 - ty0 + 1.0F);
/*     */     }
/*     */
/* 373 */     if (dangle % 90 == 0) {
/* 374 */       if (dangle < 0)
/*     */       {
/* 376 */         tx0 = y0;
/* 377 */         ty0 = s_width - x1 - 1.0F;
/* 378 */         tx1 = y1;
/* 379 */         ty1 = s_width - x0 - 1.0F;
/* 380 */         return new Rectangle2D.Float(tx0, ty0, tx1 - tx0 + 1.0F, ty1 - ty0 + 1.0F);
/*     */       }
/*     */
/* 386 */       tx0 = s_height - y1 - 1.0F;
/* 387 */       ty0 = x0;
/* 388 */       tx1 = s_height - y0 - 1.0F;
/* 389 */       ty1 = x1;
/* 390 */       return new Rectangle2D.Float(tx0, ty0, tx1 - tx0 + 1.0F, ty1 - ty0 + 1.0F);
/*     */     }
/*     */
/* 400 */     AffineTransform rotate = AffineTransform.getRotateInstance(angle, x_center, y_center);
/*     */
/* 406 */     float sx0 = source.getMinX();
/* 407 */     float sy0 = source.getMinY();
/* 408 */     float sw = source.getWidth();
/* 409 */     float sh = source.getHeight();
/*     */
/* 416 */     Point2D[] pts = new Point2D[4];
/* 417 */     pts[0] = new Point2D.Float(sx0, sy0);
/* 418 */     pts[1] = new Point2D.Float(sx0 + sw, sy0);
/* 419 */     pts[2] = new Point2D.Float(sx0 + sw, sy0 + sh);
View Full Code Here

/* 228 */       msg.append(getName() + " " + JaiI18N.getString("CropDescriptor5"));
/*     */
/* 230 */       return false;
/*     */     }
/*     */
/* 234 */     RenderableImage src = (RenderableImage)args.getSource(0);
/*     */
/* 236 */     Rectangle2D rect_src = new Rectangle2D.Float(src.getMinX(), src.getMinY(), src.getWidth(), src.getHeight());
/*     */
/* 242 */     if (!rect_src.contains(rect_req)) {
/* 243 */       msg.append(getName() + " " + JaiI18N.getString("CropDescriptor6"));
/*     */
/* 245 */       return false;
View Full Code Here

        // No sources and we are PaintRable so the chain is PaintRable.
        if (v == null) return true;

        Iterator i = v.iterator();
        while (i.hasNext()) {
            RenderableImage nri = (RenderableImage)i.next();
            // A source is not paintRable so we are not 100% paintRable.
            if (!allPaintRable(nri)) return false;
        }

        return true;
View Full Code Here

            List v = comp.getSources();
            if (v == null) return true;
            ListIterator li = v.listIterator(v.size());
            while (li.hasPrevious()) {
                RenderableImage csrc = (RenderableImage)li.previous();
                if (!allPaintRable(csrc)) {
                    li.next();
                    break;
                }
            }
View Full Code Here

    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(ret,0,tmp,0,ret.length);
                System.arraycopy(tmp,ret.length,srcProps,0,srcProps.length);
                ret = tmp;
View Full Code Here

                    scaleY = filterResolutionY / (float)devRect.height;
                }
               
                // Only resample if either scaleX or scaleY is
                // smaller than 1
                RenderableImage localSource = getSource();
                RenderContext localRenderContext = renderContext;
               
                if((scaleX < 1) || (scaleY < 1)){
                    // System.out.println("filterRes X " + filterResolutionX +
                    //                    " Y : " + filterResolutionY);

                    scaleX = scaleX < scaleY ? scaleX : scaleY;
                    scaleY = scaleX;

                    //
                    // Create a rendering that will be less than
                    // or equal to filterResolutionX by filterResolutionY.
                    //
                    AffineTransform newUsr2Dev
                        = AffineTransform.getScaleInstance(scaleX, scaleY);
                   
                    newUsr2Dev.concatenate(usr2dev);
                   
                    // This splits out the scale so we know how much to pad
                    // in user space so we have a pixel surround in device
                    // space for the affine.
                    double sx = newUsr2Dev.getScaleX();
                    double sy = newUsr2Dev.getScaleY();

                    double shx = newUsr2Dev.getShearX();
                    double shy = newUsr2Dev.getShearY();

                    // The Scale is roughly the "hypotonose" of the
                    // matrix vectors.
                    double devSX = Math.sqrt(sx*sx + shy*shy);
                    double devSY = Math.sqrt(sy*sy + shx*shx);

                    //
                    // Create a new RenderingContext
                    //
                    RenderContext newRenderContext
                        = (RenderContext)renderContext.clone();
                    newRenderContext.setTransform(newUsr2Dev);

                    Shape aoi = renderContext.getAreaOfInterest();
                    if (aoi == null)
                        aoi = getBounds2D();
                   
                    //
                    // We need to grow the area of interest by a few
                    // pixels in device space so the AffineRed can
                    // interpolate at the edges..
                    //
                    Rectangle2D newAOI = aoi.getBounds2D();
                    newAOI = new Rectangle2D.Double
                        (newAOI.getX()-1/devSX,
                         newAOI.getY()-1/devSY,
                         newAOI.getWidth()+2/devSX,
                         newAOI.getHeight()+2/devSY);

                    newRenderContext.setAreaOfInterest(newAOI);

                    //
                    // Now, use an AffineRable that will apply the
                    // resampling
                    //
                    AffineTransform resampleTxf
                        = AffineTransform.getScaleInstance(1/scaleX, 1/scaleY);
                   
                    RenderedImage result = null;
                    result = localSource.createRendering(newRenderContext);
                    // org.ImageDisplay.showImage("AT: " + newUsr2Dev, result);
                    if (result != null)
                        result = new AffineRed
                            (GraphicsUtil.wrap(result),
                             resampleTxf, renderContext.getRenderingHints());

                    return result;
                }

                return localSource.createRendering(localRenderContext);
            }
        }

        return null;
    }
View Full Code Here

    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

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.