Package java.awt.image.renderable

Examples of java.awt.image.renderable.RenderableImage


/* 300 */     return RC;
/*     */   }
/*     */
/*     */   public Rectangle2D getBounds2D(ParameterBlock paramBlock)
/*     */   {
/* 308 */     RenderableImage source = paramBlock.getRenderableSource(0);
/* 309 */     Object arg0 = paramBlock.getObjectParameter(0);
/* 310 */     AffineTransform forward_tr = (AffineTransform)arg0;
/*     */
/* 312 */     Object arg1 = paramBlock.getObjectParameter(1);
/* 313 */     Interpolation interp = (Interpolation)arg1;
/*     */
/* 317 */     double[] tr = new double[6];
/* 318 */     forward_tr.getMatrix(tr);
/*     */
/* 323 */     if ((tr[0] == 1.0D) && (tr[3] == 1.0D) && (tr[2] == 0.0D) && (tr[1] == 0.0D) && (tr[4] == 0.0D) && (tr[5] == 0.0D))
/*     */     {
/* 329 */       return new Rectangle2D.Float(source.getMinX(), source.getMinY(), source.getWidth(), source.getHeight());
/*     */     }
/*     */
/* 339 */     if ((tr[0] == 1.0D) && (tr[3] == 1.0D) && (tr[2] == 0.0D) && (tr[1] == 0.0D) && (Math.abs(tr[4] - (int)tr[4]) < 0.009999999776482582D) && (Math.abs(tr[5] - (int)tr[5]) < 0.009999999776482582D))
/*     */     {
/* 345 */       return new Rectangle2D.Float(source.getMinX() + (float)tr[4], source.getMinY() + (float)tr[5], source.getWidth(), source.getHeight());
/*     */     }
/*     */
/* 355 */     if ((tr[0] > 0.0D) && (tr[2] == 0.0D) && (tr[1] == 0.0D) && (tr[3] > 0.0D))
/*     */     {
/* 360 */       float x0 = source.getMinX();
/* 361 */       float y0 = source.getMinY();
/* 362 */       float w = source.getWidth();
/* 363 */       float h = source.getHeight();
/*     */
/* 366 */       float d_x0 = x0 * (float)tr[0] + (float)tr[4];
/* 367 */       float d_y0 = y0 * (float)tr[3] + (float)tr[5];
/* 368 */       float d_w = w * (float)tr[0];
/* 369 */       float d_h = h * (float)tr[3];
/*     */
/* 371 */       return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h);
/*     */     }
/*     */
/* 382 */     float sx0 = source.getMinX();
/* 383 */     float sy0 = source.getMinY();
/* 384 */     float sw = source.getWidth();
/* 385 */     float sh = source.getHeight();
/*     */
/* 392 */     Point2D[] pts = new Point2D[4];
/* 393 */     pts[0] = new Point2D.Float(sx0, sy0);
/* 394 */     pts[1] = new Point2D.Float(sx0 + sw, sy0);
/* 395 */     pts[2] = new Point2D.Float(sx0 + sw, sy0 + sh);
View Full Code Here


/*     */           }
/*     */
/*     */         }
/* 651 */         else if ((source instanceof RenderableImage))
/*     */         {
/* 657 */           RenderableImage ri = (RenderableImage)source;
/*     */           try {
/* 659 */             SerializableRenderableImage sri = new SerializableRenderableImage(ri);
/*     */
/* 661 */             remoteImage.setRenderableSource(opID, sri, i);
/* 662 */             newPB.setSource(sri, i);
View Full Code Here

/*     */     }
/*     */
/* 119 */     Object key = getKey(paramBlock);
/* 120 */     SoftReference ref = (SoftReference)this.mresTable.get(key);
/*     */
/* 123 */     RenderableImage mres = null;
/* 124 */     if ((ref != null) && ((mres = (RenderableImage)ref.get()) == null))
/*     */     {
/* 126 */       this.mresTable.remove(key);
/*     */     }
/*     */
View Full Code Here

/* 175 */     return paramBlock.getRenderedSource(0);
/*     */   }
/*     */
/*     */   public RenderedImage create(RenderContext renderContext, ParameterBlock paramBlock)
/*     */   {
/* 185 */     RenderableImage mres = createRenderable(paramBlock);
/*     */
/* 187 */     return mres.createRendering(renderContext);
/*     */   }
View Full Code Here

/* 187 */     return mres.createRendering(renderContext);
/*     */   }
/*     */
/*     */   public Rectangle2D getBounds2D(ParameterBlock paramBlock)
/*     */   {
/* 195 */     RenderableImage mres = createRenderable(paramBlock);
/*     */
/* 197 */     return new Rectangle2D.Float(mres.getMinX(), mres.getMinY(), mres.getWidth(), mres.getHeight());
/*     */   }
View Full Code Here

/*     */
/* 216 */     if (numSources == 0) {
/* 217 */       return null;
/*     */     }
/*     */
/* 220 */     RenderableImage src = paramBlock.getRenderableSource(0);
/* 221 */     Rectangle2D.Float box1 = new Rectangle2D.Float(src.getMinX(), src.getMinY(), src.getWidth(), src.getHeight());
/*     */
/* 226 */     for (int i = 1; i < numSources; i++) {
/* 227 */       src = paramBlock.getRenderableSource(i);
/* 228 */       Rectangle2D.Float box2 = new Rectangle2D.Float(src.getMinX(), src.getMinY(), src.getWidth(), src.getHeight());
/*     */
/* 231 */       box1 = (Rectangle2D.Float)box1.createIntersection(box2);
/* 232 */       if (box1.isEmpty())
/*     */       {
/*     */         break;
View Full Code Here

/* 216 */     return RC;
/*     */   }
/*     */
/*     */   public Rectangle2D getBounds2D(ParameterBlock paramBlock)
/*     */   {
/* 224 */     RenderableImage source = paramBlock.getRenderableSource(0);
/* 225 */     float xTrans = paramBlock.getFloatParameter(0);
/* 226 */     float yTrans = paramBlock.getFloatParameter(1);
/*     */
/* 228 */     return new Rectangle2D.Float(source.getMinX() + xTrans, source.getMinY() + yTrans, source.getWidth(), source.getHeight());
/*     */   }
View Full Code Here

/*  898 */     ParameterBlock pb = new ParameterBlock();
/*  899 */     pb.add(paramBlock.getObjectParameter(0)).add(res).add(subImage);
/*  900 */     RenderedImage iipRes = JAI.create("iipresolution", pb);
/*  901 */     Vector sources = new Vector(1);
/*  902 */     sources.add(iipRes);
/*  903 */     RenderableImage ri = new MultiResolutionRenderableImage(sources, 0.0F, 0.0F, 1.0F);
/*      */
/*  908 */     if ((opMask & 0x1) != 0) {
/*  909 */       float filter = paramBlock.getFloatParameter(2);
/*  910 */       pb = new ParameterBlock().addSource(ri).add(filter);
/*  911 */       ri = new RenderableImageOp(new FilterCRIF(), pb);
/*      */     }
/*      */
/*  918 */     int nBands = iipRes.getSampleModel().getNumBands();
/*  919 */     if ((opMask & 0x2) != 0) {
/*  920 */       double[][] ctw = getColorTwistMatrix(iipRes.getColorModel(), paramBlock);
/*      */
/*  922 */       pb = new ParameterBlock().addSource(ri).add(ctw);
/*  923 */       ri = JAI.createRenderable("bandcombine", pb);
/*  924 */       nBands = ctw.length;
/*      */     }
/*      */
/*  928 */     if ((opMask & 0x4) != 0) {
/*  929 */       int csType = iipRes.getColorModel().getColorSpace().getType();
/*  930 */       boolean isPYCC = (csType != 6) && (csType != 5);
/*      */
/*  934 */       if (isPYCC)
/*      */       {
/*      */         double[][] matrix;
/*      */         double[][] matrix;
/*  936 */         if (nBands == 3)
/*  937 */           matrix = composeMatrices(YCC_TO_RGB, YCC_TO_RGB_CONST);
/*      */         else {
/*  939 */           matrix = composeMatrices(YCCA_TO_RGBA, YCCA_TO_RGBA_CONST);
/*      */         }
/*  941 */         pb = new ParameterBlock().addSource(ri).add(matrix);
/*  942 */         ri = JAI.createRenderable("bandcombine", pb);
/*      */       }
/*      */
/*  945 */       float contrast = paramBlock.getFloatParameter(4);
/*  946 */       LookupTableJAI lut = createContrastLUT(contrast, nBands);
/*      */
/*  948 */       pb = new ParameterBlock().addSource(ri).add(lut);
/*  949 */       ri = JAI.createRenderable("lookup", pb);
/*      */
/*  951 */       if (isPYCC)
/*      */       {
/*      */         double[][] matrix;
/*      */         double[][] matrix;
/*  953 */         if (nBands == 3)
/*  954 */           matrix = composeMatrices(RGB_TO_YCC, RGB_TO_YCC_CONST);
/*      */         else {
/*  956 */           matrix = composeMatrices(RGBA_TO_YCCA, RGBA_TO_YCCA_CONST);
/*      */         }
/*  958 */         pb = new ParameterBlock().addSource(ri).add(matrix);
/*  959 */         ri = JAI.createRenderable("bandcombine", pb);
/*      */       }
/*      */
/*      */     }
/*      */
/*  964 */     if ((opMask & 0x8) != 0)
/*      */     {
/*  966 */       Rectangle2D rect = (Rectangle2D)paramBlock.getObjectParameter(5);
/*      */
/*  969 */       if (!rect.intersects(0.0D, 0.0D, aspectRatioSource, 1.0D)) {
/*  970 */         throw new RuntimeException(JaiI18N.getString("IIPCRIF5"));
/*      */       }
/*      */
/*  974 */       Rectangle2D rectS = new Rectangle2D.Float(0.0F, 0.0F, aspectRatioSource, 1.0F);
/*      */
/*  978 */       if (!rect.equals(rectS))
/*      */       {
/*  980 */         rect = rect.createIntersection(rectS);
/*      */
/*  983 */         pb = new ParameterBlock().addSource(ri);
/*  984 */         pb.add((float)rect.getMinX()).add((float)rect.getMinY());
/*  985 */         pb.add((float)rect.getWidth()).add((float)rect.getHeight());
/*  986 */         ri = JAI.createRenderable("crop", pb);
/*      */       }
/*      */
/*      */     }
/*      */
/*  999 */     if ((opMask & 0x10) != 0) {
/* 1000 */       AffineTransform afn = (AffineTransform)paramBlock.getObjectParameter(6);
/*      */       try
/*      */       {
/* 1004 */         afn = afn.createInverse();
/*      */       }
/*      */       catch (NoninvertibleTransformException e) {
/* 1007 */         listener.errorOccurred(JaiI18N.getString("AffineNotInvertible"), e, this, false);
/*      */       }
/*      */
/* 1011 */       pb = new ParameterBlock().addSource(ri).add(afn);
/* 1012 */       if ((hints != null) && (hints.containsKey(JAI.KEY_INTERPOLATION))) {
/* 1013 */         pb.add(hints.get(JAI.KEY_INTERPOLATION));
/*      */       }
/* 1015 */       ri = JAI.createRenderable("affine", pb);
/*      */     }
/*      */
/* 1020 */     Rectangle2D rgn = (opMask & 0x40) != 0 ? (Rectangle2D)paramBlock.getObjectParameter(8) : bounds2D;
/*      */
/* 1024 */     if (rgn.isEmpty()) {
/* 1025 */       throw new RuntimeException(JaiI18N.getString("IIPCRIF3"));
/*      */     }
/*      */
/* 1029 */     Rectangle2D riRect = new Rectangle2D.Float(ri.getMinX(), ri.getMinY(), ri.getWidth(), ri.getHeight());
/*      */
/* 1036 */     if (!rgn.equals(riRect))
/*      */     {
/* 1038 */       rgn = rgn.createIntersection(riRect);
/*      */
/* 1041 */       pb = new ParameterBlock().addSource(ri);
/* 1042 */       pb.add((float)rgn.getMinX()).add((float)rgn.getMinY());
/* 1043 */       pb.add((float)rgn.getWidth()).add((float)rgn.getHeight());
/* 1044 */       ri = JAI.createRenderable("crop", pb);
/*      */     }
/*      */
/* 1048 */     return ri.createRendering(renderContext);
/*      */   }
View Full Code Here

/* 1048 */     return ri.createRendering(renderContext);
/*      */   }
/*      */
/*      */   public RenderedImage create(ParameterBlock paramBlock, RenderingHints renderHints)
/*      */   {
/* 1057 */     RenderableImage iipImage = JAI.createRenderable("iip", paramBlock);
/*      */
/* 1059 */     return iipImage.createDefaultRendering();
/*      */   }
View Full Code Here

/* 477 */           RenderedImage rdrdImage = null;
/* 478 */           Object source = sources.elementAt(i);
/* 479 */           if ((source instanceof RenderableImage)) {
/* 480 */             RenderContext rcOut = this.remoteCRIF.mapRenderContext(this.serverName, this.nodeSupport.getOperationName(), i, renderContext, this.nodeSupport.getParameterBlock(), this);
/*     */
/* 489 */             RenderableImage src = (RenderableImage)source;
/* 490 */             rdrdImage = src.createRendering(rcOut);
/* 491 */           } else if ((source instanceof RenderedOp)) {
/* 492 */             rdrdImage = ((RenderedOp)source).getRendering();
/* 493 */           } else if ((source instanceof RenderedImage)) {
/* 494 */             rdrdImage = (RenderedImage)source;
/*     */           }
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.