Examples of RandomIter


Examples of javax.media.jai.iterator.RandomIter

/*     */     }
/*     */   }
/*     */
/*     */   private void computeRectFloat(PlanarImage src, RasterAccessor dst)
/*     */   {
/*     */     RandomIter iter;
/*     */     RandomIter iter;
/* 516 */     if (this.extender != null) {
/* 517 */       Rectangle bounds = new Rectangle(src.getMinX(), src.getMinY(), src.getWidth() + 1, src.getHeight() + 1);
/*     */
/* 520 */       iter = RandomIterFactory.create(src.getExtendedData(bounds, this.extender), bounds);
/*     */     }
/*     */     else
/*     */     {
/* 524 */       iter = RandomIterFactory.create(src, src.getBounds());
/*     */     }
/*     */
/* 527 */     int minX = src.getMinX();
/* 528 */     int maxX = src.getMaxX() - (this.extender != null ? 0 : 1);
/*     */
/* 530 */     int minY = src.getMinY();
/* 531 */     int maxY = src.getMaxY() - (this.extender != null ? 0 : 1);
/*     */
/* 534 */     int dstWidth = dst.getWidth();
/* 535 */     int dstHeight = dst.getHeight();
/* 536 */     int dstBands = dst.getNumBands();
/*     */
/* 538 */     int lineStride = dst.getScanlineStride();
/* 539 */     int pixelStride = dst.getPixelStride();
/* 540 */     int[] bandOffsets = dst.getBandOffsets();
/* 541 */     float[][] data = dst.getFloatDataArrays();
/*     */
/* 543 */     float[] warpData = new float[2 * dstWidth];
/*     */
/* 545 */     int lineOffset = 0;
/*     */
/* 547 */     float[] backgroundFloat = new float[dstBands];
/* 548 */     for (int i = 0; i < dstBands; i++) {
/* 549 */       backgroundFloat[i] = ((float)this.backgroundValues[i]);
/*     */     }
/* 551 */     for (int h = 0; h < dstHeight; h++) {
/* 552 */       int pixelOffset = lineOffset;
/* 553 */       lineOffset += lineStride;
/*     */
/* 555 */       this.warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
/*     */
/* 557 */       int count = 0;
/* 558 */       for (int w = 0; w < dstWidth; w++) {
/* 559 */         float sx = warpData[(count++)];
/* 560 */         float sy = warpData[(count++)];
/*     */
/* 562 */         int xint = floor(sx);
/* 563 */         int yint = floor(sy);
/* 564 */         float xfrac = sx - xint;
/* 565 */         float yfrac = sy - yint;
/*     */
/* 567 */         if ((xint < minX) || (xint >= maxX) || (yint < minY) || (yint >= maxY))
/*     */         {
/* 570 */           if (this.setBackground) {
/* 571 */             for (int b = 0; b < dstBands; b++) {
/* 572 */               data[b][(pixelOffset + bandOffsets[b])] = backgroundFloat[b];
/*     */             }
/*     */           }
/*     */         }
/*     */         else {
/* 577 */           for (int b = 0; b < dstBands; b++) {
/* 578 */             float s00 = iter.getSampleFloat(xint, yint, b);
/* 579 */             float s01 = iter.getSampleFloat(xint + 1, yint, b);
/* 580 */             float s10 = iter.getSampleFloat(xint, yint + 1, b);
/* 581 */             float s11 = iter.getSampleFloat(xint + 1, yint + 1, b);
/*     */
/* 583 */             float s0 = (s01 - s00) * xfrac + s00;
/* 584 */             float s1 = (s11 - s10) * xfrac + s10;
/* 585 */             float s = (s1 - s0) * yfrac + s0;
/*     */
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.