• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RasterFormatTag类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中javax.media.jai.RasterFormatTag的典型用法代码示例。如果您正苦于以下问题:Java RasterFormatTag类的具体用法?Java RasterFormatTag怎么用?Java RasterFormatTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RasterFormatTag类属于javax.media.jai包,在下文中一共展示了RasterFormatTag类的38个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: computeRect

点赞 3

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
@Override
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) {
    RasterFormatTag[] formatTags = getFormatTags();
    RasterAccessor s = new RasterAccessor(sources[0], destRect, formatTags[0], getSourceImage(0).getColorModel());
    RasterAccessor d = new RasterAccessor(dest, destRect, formatTags[1], getColorModel());
    switch (d.getDataType()) {
        case 4: // '\004'
            computeRectFloat(s, d, (float) replacementValue);
            break;

        case 5: // '\005'
            computeRectDouble(s, d, replacementValue);
            break;
    }
    d.copyDataToRaster();
}
 

开发者ID:senbox-org,
项目名称:s2tbx,
代码行数:17,
代码来源:ReplaceNaNOpImage.java

示例2: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
@Override
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) {
    RasterFormatTag[] formatTags = getFormatTags();
    RasterAccessor s = new RasterAccessor(sources[0], destRect, formatTags[0], getSourceImage(0).getColorModel());
    RasterAccessor d = new RasterAccessor(dest, destRect, formatTags[1], getColorModel());
    switch (d.getDataType()) {
        case 4: // '\004'
            computeRectFloat(s, d);
            break;
        case 5: // '\005'
            computeRectDouble(s, d);
            break;
    }
    d.copyDataToRaster();
}
 

开发者ID:senbox-org,
项目名称:s2tbx,
代码行数:16,
代码来源:Log10OpImage.java

示例3: WarpSourceCoordinatesOpImage

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
private WarpSourceCoordinatesOpImage(Warp warp, ImageLayout layout, Map configuration) {
    super(layout, configuration, layout.getSampleModel(null), layout.getMinX(null), layout.getMinY(null),
            layout.getWidth(null), layout.getHeight(null));
    this.warp = warp;
    int compatibleTag = RasterAccessor.findCompatibleTag(null, layout.getSampleModel(null));
    rasterFormatTag = new RasterFormatTag(layout.getSampleModel(null), compatibleTag);
    OperatorContext.setTileCache(this);
}
 

开发者ID:senbox-org,
项目名称:s2tbx,
代码行数:9,
代码来源:WarpSourceCoordinatesOpImage.java

示例4: getFormatTags

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/** Returns the format tags to be used with <code>RasterAccessor</code>. */
protected synchronized RasterFormatTag[] getFormatTags() {
    RenderedImage[] ri;
    if (alpha2 == null) {
        ri = new RenderedImage[3];
    } else {
        ri = new RenderedImage[4];
        ri[3] = alpha2;
    }
    ri[0] = getSourceImage(0);
    ri[1] = getSourceImage(1);
    ri[2] = alpha1;

    return RasterAccessor.findCompatibleTags(ri, this);
}
 

开发者ID:senbox-org,
项目名称:s2tbx,
代码行数:16,
代码来源:CompositeNoDestAlphaOpImage.java

示例5: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/** Warps a rectangle. */
protected void computeRect(PlanarImage[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    RasterAccessor d = new RasterAccessor(dest, destRect,
                                          formatTags[1], getColorModel());

    switch (d.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(sources[0], d);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(sources[0], d);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(sources[0], d);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(sources[0], d);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(sources[0], d);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(sources[0], d);
        break;
    }

    if (d.isDataCopy()) {
        d.clampDataArrays();
        d.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:37,
代码来源:WarpNearestOpImage.java

示例6: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Map the pixels inside a specified rectangle whose value is within a 
 * range to a constant on a per-band basis.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor src = new RasterAccessor(sources[0], srcRect,  
                                            formatTags[0], 
                                            getSourceImage(0).getColorModel());
    RasterAccessor dst = new RasterAccessor(dest, destRect,  
                                            formatTags[1], getColorModel());

    switch (dst.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src, dst);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(src, dst);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src, dst);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(src, dst);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(src, dst);
        break;
    }

    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:47,
代码来源:ClampOpImage.java

示例7: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Logically "xors" a constant with the pixel values within a specified
 * rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor dst = new RasterAccessor(dest, destRect, 
                                            formatTags[1], getColorModel());
    RasterAccessor src = new RasterAccessor(sources[0], srcRect,  
                                            formatTags[0], 
                                            getSource(0).getColorModel());

    switch (dst.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src, dst);
        break;
    case DataBuffer.TYPE_USHORT:
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src, dst);
        break;
    }

    /* Do not clamp dst data. */
    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:40,
代码来源:XorConstOpImage.java

示例8: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Copies the pixel values of a source image within a specified
 * rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();


    RasterAccessor src = new RasterAccessor(sources[0], destRect,  
                                            formatTags[0], 
                                            getSource(0).getColorModel());
    RasterAccessor dst = new RasterAccessor(dest, destRect,  
                                            formatTags[1], getColorModel());

    switch (dst.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src, dst);
        break;
    case DataBuffer.TYPE_USHORT:
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src, dst);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(src, dst);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(src, dst);
        break;
    }

    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:44,
代码来源:OverlayOpImage.java

示例9: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
    * Logically "ands" a constant to the pixel values within a specified
    * rectangle.
    *
    * @param sources   Cobbled sources, guaranteed to provide all the
    *                  source data necessary for computing the rectangle.
    * @param dest      The tile containing the rectangle to be computed.
    * @param destRect  The rectangle within the tile to be computed.
    */
   protected void computeRect(Raster[] sources,
                              WritableRaster dest,
                              Rectangle destRect) {
       // Retrieve format tags.
       RasterFormatTag[] formatTags = getFormatTags();

       Rectangle srcRect = mapDestRect(destRect, 0);

       RasterAccessor dst = new RasterAccessor(dest, destRect,  
                                               formatTags[1], getColorModel());
       RasterAccessor src = new RasterAccessor(sources[0], srcRect,  
                                               formatTags[0], 
                                               getSourceImage(0).getColorModel());

       switch (dst.getDataType()) {
case DataBuffer.TYPE_BYTE:
           computeRectByte(src, dst);
           break;
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_SHORT:
           computeRectShort(src, dst);
           break;
case DataBuffer.TYPE_INT:
           computeRectInt(src, dst);
           break;
       }

       /* Do not clamp dst data. */
       dst.copyDataToRaster();
   }
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:40,
代码来源:AndConstOpImage.java

示例10: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Logically "ors" a constant with the pixel values within a specified
 * rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor dst = new RasterAccessor(dest, destRect, 
                                            formatTags[1], getColorModel());
    RasterAccessor src = new RasterAccessor(sources[0], srcRect,  
                                            formatTags[0], 
                                            getSource(0).getColorModel());

    switch (dst.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src, dst);
        break;
    case DataBuffer.TYPE_USHORT:
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src, dst);
        break;
    }

    /* Do not clamp dst data. */
    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:40,
代码来源:OrConstOpImage.java

示例11: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs linear combination of source image with matrix
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    RasterAccessor s = new RasterAccessor(sources[0], destRect,  
                                          formatTags[0], 
                                          getSourceImage(0).getColorModel());
    RasterAccessor d = new RasterAccessor(dest, destRect,  
                                          formatTags[1], getColorModel());

    switch (d.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(s, d);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(s, d);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(s, d);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(s, d);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(s, d);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(s, d);
        break;
    }

    if (d.isDataCopy()) {
        d.clampDataArrays();
        d.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:47,
代码来源:BandCombineOpImage.java

示例12: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/** Warps a rectangle. */
protected void computeRect(PlanarImage[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    RasterAccessor d = new RasterAccessor(dest, destRect,
                           formatTags[1], getColorModel());

    switch (d.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(sources[0], d);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(sources[0], d);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(sources[0], d);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(sources[0], d);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(sources[0], d);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(sources[0], d);
        break;
    }

    if (d.isDataCopy()) {
        d.clampDataArrays();
        d.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:37,
代码来源:WarpGeneralOpImage.java

示例13: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Piecewises to the pixel values within a specified rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    if(isByteData) {
        computeRectByte(sources, dest, destRect);
    } else {
        RasterAccessor dst =
            new RasterAccessor(dest, destRect, formatTags[1],
                               getColorModel());
        RasterAccessor src =
            new RasterAccessor(sources[0], destRect, formatTags[0],
                               getSource(0).getColorModel());

        switch (dst.getDataType()) {
        case DataBuffer.TYPE_USHORT:
            computeRectUShort(src, dst);
            break;
        case DataBuffer.TYPE_SHORT:
            computeRectShort(src, dst);
            break;
        case DataBuffer.TYPE_INT:
            computeRectInt(src, dst);
            break;
        case DataBuffer.TYPE_FLOAT:
            computeRectFloat(src, dst);
            break;
        case DataBuffer.TYPE_DOUBLE:
            computeRectDouble(src, dst);
            break;
        }

        dst.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:46,
代码来源:PiecewiseOpImage.java

示例14: AWTImageOpImage

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
   * Constructs an AWTImageOpImage.
   *
   * @param layout  Image layout.
   * @param image   The AWT image.
   */
  public AWTImageOpImage(Map config,
                         ImageLayout layout,
                         Image image) {
      // We don't know the width, height, and sample model yet
      super(layout = layoutHelper(layout, image), config,
            layout.getSampleModel(null),
            layout.getMinX(null), layout.getMinY(null),
            layout.getWidth(null), layout.getHeight(null));

      // Set the format tag if and only if we will use the RasterAccessor.
      if(getTileWidth() != getWidth() || getTileHeight() != getHeight()) {
          rasterFormatTag =
              new RasterFormatTag(getSampleModel(),
                                  RasterAccessor.TAG_BYTE_UNCOPIED);
      }

      // Grab the entire image
      this.pixels = new int[width * height];
      PixelGrabber grabber = new PixelGrabber(image, 0, 0, width, height,
                                              pixels, 0, width);
      try {
          if (!grabber.grabPixels()) {
              if ((grabber.getStatus() & ImageObserver.ABORT) != 0) {
                  throw new RuntimeException(JaiI18N.getString("AWTImageOpImage2"));
} else {
                  throw new RuntimeException(grabber.getStatus() + JaiI18N.getString("AWTImageOpImage3"));
              }
          }
      } catch (InterruptedException e) {
          e.printStackTrace();
          throw new RuntimeException(JaiI18N.getString("AWTImageOpImage4"));
      }
  }
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:40,
代码来源:AWTImageOpImage.java

示例15: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Warps a rectangle.
 * 
 * Copied and adapted from WarpGeneralOpImage
 */
@Override
protected void computeRect(PlanarImage[] sources, WritableRaster dest, Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    RasterAccessor d = new RasterAccessor(dest, destRect, formatTags[1], getColorModel());

    switch (d.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(sources[0], d);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(sources[0], d);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(sources[0], d);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(sources[0], d);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(sources[0], d);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(sources[0], d);
        break;
    }

    if (d.isDataCopy()) {
        d.clampDataArrays();
        d.copyDataToRaster();
    }
}
 

开发者ID:geosolutions-it,
项目名称:soil_sealing,
代码行数:39,
代码来源:GridCoverage2DRIA.java

示例16: computeImage

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/** Compute the output image */

  public void computeImage(Raster[] sources,
			   WritableRaster dest,
			   Rectangle destRect) 
  {
    RasterFormatTag[] formatTags = getFormatTags();

    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor srcAccessor = 
      new RasterAccessor(sources[0], srcRect, formatTags[0],
			 getSourceImage(0).getColorModel());

    DirectRasterAccessor dstAccessor = new DirectRasterAccessor(dest, getColorModel());

    switch (srcAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
      byteLoop(srcAccessor,dstAccessor);
      break;
    case DataBuffer.TYPE_INT:
      intLoop(srcAccessor,dstAccessor);
      break;
    default:
      throw new RuntimeException(getClass().getName() + 
				 " does not implement computeRect" + 
				 " for short/float/double data");
    }
  }
 

开发者ID:tamirhassan,
项目名称:pdfxtk,
代码行数:30,
代码来源:BinarizeOpImage.java

示例17: computeImage

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/** Compute the output image */

  public void computeImage(Raster[] sources,
			   WritableRaster dest,
			   Rectangle destRect) 
  {
    RasterFormatTag[] formatTags = getFormatTags();

    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor srcAccessor = 
      new RasterAccessor(sources[0], srcRect, formatTags[0],
			 getSourceImage(0).getColorModel());
    RasterAccessor dstAccessor = 
      new RasterAccessor(dest, destRect, formatTags[1],
			 getColorModel());

    switch (srcAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
      byteLoop(srcAccessor,dstAccessor);
      break;
    default:
      throw new RuntimeException(getClass().getName() + 
				 " does not implement computeRect" + 
				 " for short/int/float/double data");
    }

    if (dstAccessor.isDataCopy()) {
      dstAccessor.clampDataArrays();
      dstAccessor.copyDataToRaster();
    }
  }
 

开发者ID:tamirhassan,
项目名称:pdfxtk,
代码行数:33,
代码来源:PowerOpImage.java

示例18: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/** Compute an output tile */

  public void computeRect(PlanarImage[] sources,
			  WritableRaster dest,
			  Rectangle destRect)
  {
    RasterFormatTag[] formatTags = getFormatTags();

    RasterAccessor dstAccessor = new RasterAccessor(dest, destRect, 
						    formatTags[0], 
						    getColorModel());

    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
      byteLoop(dstAccessor);
      break;
    default:
      String className = this.getClass().getName();
      throw new RuntimeException(className + 
				 " does not implement computeRect" + 
				 " for short/int/float/double data");
    }

    if (dstAccessor.isDataCopy()) {
      dstAccessor.clampDataArrays();
      dstAccessor.copyDataToRaster();
    }
  }
 

开发者ID:tamirhassan,
项目名称:pdfxtk,
代码行数:29,
代码来源:RandomizeOpImage.java

示例19: ProjectionProfileOpImage

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
public ProjectionProfileOpImage(RenderedImage source,
	       Rectangle region) {
  super(source, new ROIShape(new Rectangle(source.getMinX(), source.getMinY(), 
			     source.getWidth(), source.getHeight())),
 source.getMinX(), source.getMinY(),
 1, 1);
  
  this.region = region;
  image = source;
  
  RasterFormatTag[] formatTags = getFormatTags();
  
  srcDRA = new DirectRasterAccessor(getData(), getColorModel());
}
 

开发者ID:tamirhassan,
项目名称:pdfxtk,
代码行数:15,
代码来源:ProjectionProfileOpImage.java

示例20: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs convolution on a specified rectangle. The sources are
 * cobbled.
 *
 * @param sources an array of source Rasters, guaranteed to provide all
 *                necessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor srcAccessor = 
        new RasterAccessor(source,srcRect, 
                           formatTags[0], 
                           getSourceImage(0).getColorModel());
    RasterAccessor dstAccessor = 
        new RasterAccessor(dest,destRect, 
                           formatTags[1], getColorModel());

    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        byteLoop(srcAccessor,dstAccessor);
        break;
    case DataBuffer.TYPE_SHORT:
        shortLoop(srcAccessor,dstAccessor);
        break;
    case DataBuffer.TYPE_INT:
        intLoop(srcAccessor,dstAccessor);
        break;
    default:
        String className = this.getClass().getName();
        throw new RuntimeException(JaiI18N.getString("Convolve3x3OpImage1"));
    }
 
    // If the RasterAccessor object set up a temporary buffer for the 
    // op to write to, tell the RasterAccessor to write that data
    // to the raster no that we're done with it.
    if (dstAccessor.isDataCopy()) {
        dstAccessor.clampDataArrays();
        dstAccessor.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:50,
代码来源:Convolve3x3OpImage.java

示例21: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    // Construct RasterAccessors.
    RasterAccessor magAccessor =
        new RasterAccessor(sources[0], destRect, formatTags[0], 
                           getSource(0).getColorModel());
    RasterAccessor phsAccessor =
        new RasterAccessor(sources[1], destRect, formatTags[1], 
                           getSource(1).getColorModel());
    RasterAccessor dstAccessor =
        new RasterAccessor(dest, destRect, formatTags[2], getColorModel());

    // Branch to the method appropriate to the accessor data type.
    switch(dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(magAccessor, phsAccessor, dstAccessor,
                        destRect.height, destRect.width);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(magAccessor, phsAccessor, dstAccessor,
                         destRect.height, destRect.width);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(magAccessor, phsAccessor, dstAccessor,
                          destRect.height, destRect.width);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(magAccessor, phsAccessor, dstAccessor,
                       destRect.height, destRect.width);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(magAccessor, phsAccessor, dstAccessor,
                         destRect.height, destRect.width);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(magAccessor, phsAccessor, dstAccessor,
                          destRect.height, destRect.width);
        break;
    default:
        // NB: This statement should be unreachable.
        throw new RuntimeException(JaiI18N.getString("PolarToComplexOpImage0"));
    }

    if (dstAccessor.needsClamping()) {
        dstAccessor.clampDataArrays();
    }

    // Make sure that the output data is copied to the destination.
    dstAccessor.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:55,
代码来源:PolarToComplexOpImage.java

示例22: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs dilation on a specified rectangle. The sources are
 * cobbled.
 *
 * @param sources an array of source Rasters, guaranteed to provide all
 *                necessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);
 
 
    RasterAccessor srcAccessor =
        new RasterAccessor(source, srcRect, 
                           formatTags[0], getSourceImage(0).getColorModel());
    RasterAccessor dstAccessor =
        new RasterAccessor(dest, destRect, 
                           formatTags[1], getColorModel());
 
    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        byteLoop(srcAccessor, dstAccessor);
 break;
    case DataBuffer.TYPE_INT:
        intLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_SHORT:
        shortLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_USHORT:
        ushortLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_FLOAT:
        floatLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_DOUBLE:
        doubleLoop(srcAccessor, dstAccessor);
        break;

    default:
    }
 
    // If the RasterAccessor object set up a temporary buffer for the
    // op to write to, tell the RasterAccessor to write that data
    // to the raster no that we're done with it.
    if (dstAccessor.isDataCopy()) {
        dstAccessor.clampDataArrays();
        dstAccessor.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:58,
代码来源:DilateOpImage.java

示例23: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs gradient operation on a specified rectangle. The sources are
 * cobbled.
 *
 * @param sources an array of source Rasters, guaranteed to provide all
 *                necessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);
 
    RasterAccessor srcAccessor =
        new RasterAccessor(source,
                           srcRect, 
                           formatTags[0], getSourceImage(0).getColorModel());
    RasterAccessor dstAccessor =
        new RasterAccessor(dest,
                           destRect, 
                           formatTags[1], getColorModel());
 
    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        byteLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_INT:
        intLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_SHORT:
        shortLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_USHORT:
        ushortLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_FLOAT:
        floatLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_DOUBLE:
        doubleLoop(srcAccessor, dstAccessor);
        break;

    default:
    }
 
    // If the RasterAccessor object set up a temporary buffer for the
    // op to write to, tell the RasterAccessor to write that data
    // to the raster no that we're done with it.
    if (dstAccessor.isDataCopy()) {
        dstAccessor.clampDataArrays();
        dstAccessor.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:59,
代码来源:GradientOpImage.java

示例24: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Adds the pixel values of a rectangle with a given constant.
 * The sources are cobbled.
 *
 * @param sources   an array of sources, guarantee to provide all
 *                  necessary source data for computing the rectangle.
 * @param dest      a tile that contains the rectangle to be computed.
 * @param destRect  the rectangle within this OpImage to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor srcAccessor = 
        new RasterAccessor(source,srcRect,
                           formatTags[0], 
                           getSourceImage(0).getColorModel());

    RasterAccessor dstAccessor = 
        new RasterAccessor(dest,destRect, 
                           formatTags[1], getColorModel());

    if(dstAccessor.isBinary()) {
        byte[] srcBits = srcAccessor.getBinaryDataArray();
        byte[] dstBits = dstAccessor.getBinaryDataArray();

        System.arraycopy(srcBits, 0, dstBits, 0, dstBits.length);

        dstAccessor.copyBinaryDataToRaster();
    } else {
        switch (dstAccessor.getDataType()) {
        case DataBuffer.TYPE_BYTE:
            byteLoop(srcAccessor,dstAccessor);
            break;
        case DataBuffer.TYPE_SHORT:
        case DataBuffer.TYPE_USHORT:
            shortLoop(srcAccessor,dstAccessor);
            break;
        case DataBuffer.TYPE_INT:
            intLoop(srcAccessor,dstAccessor);
            break;
        case DataBuffer.TYPE_FLOAT:
            floatLoop(srcAccessor,dstAccessor);
            break;
        case DataBuffer.TYPE_DOUBLE:
            doubleLoop(srcAccessor,dstAccessor);
            break;
        default:
            String className = this.getClass().getName();
            throw new RuntimeException(JaiI18N.getString("Convolve3x3OpImage1"));
        }

        // If the RasterAccessor object set up a temporary buffer for the 
        // op to write to, tell the RasterAccessor to write that data
        // to the raster no that we're done with it.
        if (dstAccessor.isDataCopy()) {
            dstAccessor.clampDataArrays();
            dstAccessor.copyDataToRaster();
        }
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:67,
代码来源:CopyOpImage.java

示例25: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Nots the pixel values of the source image within a specified
 * rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    /* For ColormapOpImage, srcRect = destRect. */
    RasterAccessor src = new RasterAccessor(sources[0], destRect,  
                                            formatTags[0], 
                                            getSource(0).getColorModel());
    RasterAccessor dst = new RasterAccessor(dest, destRect,  
                                           formatTags[1], getColorModel());

    if(dst.isBinary()) {
        byte[] srcBits = src.getBinaryDataArray();
        byte[] dstBits = dst.getBinaryDataArray();

        int length = dstBits.length;
        for(int i = 0; i < length; i++) {
            dstBits[i] = (byte)(~(srcBits[i]));
        }

        dst.copyBinaryDataToRaster();

 return;
    }

    int srcLineStride = src.getScanlineStride();
    int srcPixelStride = src.getPixelStride();
    int[] srcBandOffsets = src.getBandOffsets();

    int dstNumBands = dst.getNumBands();
    int dstWidth = dst.getWidth();
    int dstHeight = dst.getHeight();
    int dstLineStride = dst.getScanlineStride();
    int dstPixelStride = dst.getPixelStride();
    int[] dstBandOffsets = dst.getBandOffsets();

    switch (dst.getDataType()) {
 
    case DataBuffer.TYPE_BYTE:
        byteLoop(dstNumBands, dstWidth, dstHeight,
                 srcLineStride, srcPixelStride,
                 srcBandOffsets, src.getByteDataArrays(),
                 dstLineStride, dstPixelStride,
                 dstBandOffsets, dst.getByteDataArrays());
        break;
 
    case DataBuffer.TYPE_USHORT:
    case DataBuffer.TYPE_SHORT:
        shortLoop(dstNumBands, dstWidth, dstHeight,
    srcLineStride, srcPixelStride,
    srcBandOffsets, src.getShortDataArrays(),
    dstLineStride, dstPixelStride,
    dstBandOffsets, dst.getShortDataArrays());
        break;
 
    case DataBuffer.TYPE_INT:
        intLoop(dstNumBands, dstWidth, dstHeight,
                srcLineStride, srcPixelStride,
                srcBandOffsets, src.getIntDataArrays(),
                dstLineStride, dstPixelStride,
                dstBandOffsets, dst.getIntDataArrays());
        break;
    }
	
    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:78,
代码来源:NotOpImage.java

示例26: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Subtracts the pixel values within a specified rectangle from a constant.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor dst = new RasterAccessor(dest, destRect,  
                                            formatTags[1], getColorModel());
    RasterAccessor src = new RasterAccessor(sources[0], srcRect,  
                                            formatTags[0], 
                                            getSource(0).getColorModel());

    switch (dst.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src, dst);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(src, dst);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src, dst);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(src, dst);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(src, dst);
        break;
    }

    if (dst.needsClamping()) {
        /* Further clamp down to underlying raster data type. */
        dst.clampDataArrays();
    }
    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:50,
代码来源:SubtractFromConstOpImage.java

示例27: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs min filtering on a specified rectangle. The sources are
 * cobbled.
 *
 * @param sources an array of source Rasters, guaranteed to provide all
 *                necessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);
 
 
    RasterAccessor srcAccessor =
        new RasterAccessor(source, srcRect,
                           formatTags[0], 
                           getSource(0).getColorModel());
    RasterAccessor dstAccessor =
        new RasterAccessor(dest, destRect,  
                           formatTags[1], getColorModel());
 
    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        byteLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_SHORT:
        shortLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_USHORT:
        ushortLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_INT:
        intLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_FLOAT:
        floatLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_DOUBLE:
        doubleLoop(srcAccessor, dstAccessor, maskSize);
        break;
    }
 
    // If the RasterAccessor object set up a temporary buffer for the
    // op to write to, tell the RasterAccessor to write that data
    // to the raster no that we're done with it.
    if (dstAccessor.isDataCopy()) {
        dstAccessor.clampDataArrays();
        dstAccessor.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:57,
代码来源:MinFilterOpImage.java

示例28: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Finds the natural logarithm of the pixels within a specified
 * rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    /* Retrieve format tags. */
    RasterFormatTag[] formatTags = getFormatTags();

    /* No need to mapSourceRect for PointOps. */
    RasterAccessor s = new RasterAccessor(sources[0],
                                          destRect,  
                                          formatTags[0], 
                                          getSourceImage(0).getColorModel());
    RasterAccessor d = new RasterAccessor(dest,
                                          destRect,  
                                          formatTags[1],
                                          getColorModel());

    switch (d.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(s, d);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(s, d);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(s, d);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(s, d);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(s, d);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(s, d);
        break;
    }

    if (d.needsClamping()) {
        d.clampDataArrays();
    }
    d.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:52,
代码来源:LogOpImage.java

示例29: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Calculate the product or quotient of the source images.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    RasterAccessor src1Accessor =
        new RasterAccessor(sources[0], destRect,  
                           formatTags[0], 
                           getSourceImage(0).getColorModel());
    RasterAccessor src2Accessor =
        new RasterAccessor(sources[1], destRect,  
                           formatTags[1], 
                           getSourceImage(1).getColorModel());
    RasterAccessor dstAccessor = 
        new RasterAccessor(dest, destRect,  
                           formatTags[2], getColorModel());

    // Branch to the method appropriate to the accessor data type.
    switch(dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src1Accessor, src2Accessor, dstAccessor);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src1Accessor, src2Accessor, dstAccessor);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(src1Accessor, src2Accessor, dstAccessor);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src1Accessor, src2Accessor, dstAccessor);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(src1Accessor, src2Accessor, dstAccessor);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(src1Accessor, src2Accessor, dstAccessor);
        break;
    default:
        // NB: This statement should be unreachable.
        throw new RuntimeException(JaiI18N.getString("ComplexArithmeticOpImage0"));
    }

    if (dstAccessor.needsClamping()) {
        dstAccessor.clampDataArrays();
    }
    // Make sure that the output data is copied to the destination.
    dstAccessor.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:58,
代码来源:ComplexArithmeticOpImage.java

示例30: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs median filtering on a specified rectangle. The sources are
 * cobbled.
 *
 * @param sources an array of source Rasters, guaranteed to provide all
 *                necessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);
 
 
    RasterAccessor srcAccessor =
        new RasterAccessor(source, srcRect,
                           formatTags[0], 
                           getSource(0).getColorModel());
    RasterAccessor dstAccessor =
        new RasterAccessor(dest, destRect,  
                           formatTags[1], getColorModel());
 
    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        byteLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_SHORT:
        shortLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_USHORT:
        ushortLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_INT:
        intLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_FLOAT:
        floatLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_DOUBLE:
        doubleLoop(srcAccessor, dstAccessor, maskSize);
        break;
    }
 
    // If the RasterAccessor object set up a temporary buffer for the
    // op to write to, tell the RasterAccessor to write that data
    // to the raster no that we're done with it.
    if (dstAccessor.isDataCopy()) {
        dstAccessor.clampDataArrays();
        dstAccessor.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:57,
代码来源:MedianFilterOpImage.java

示例31: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Divides the pixel values within a specified rectangle into a constant.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Rectangle srcRect = mapDestRect(destRect, 0);

    RasterAccessor dst = new RasterAccessor(dest, destRect, 
                                    formatTags[1], getColorModel());
    RasterAccessor src = new RasterAccessor(sources[0], srcRect, 
                                            formatTags[0], 
                                            getSourceImage(0).getColorModel());

    switch (dst.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src, dst);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(src, dst);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src, dst);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(src, dst);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(src, dst);
        break;
    }

    if (dst.needsClamping()) {
        /* Further clamp down to underlying raster data type. */
        dst.clampDataArrays();
    }
    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:50,
代码来源:DivideIntoConstOpImage.java

示例32: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Inverts the pixel values within a specified rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    /* For ColormapOpImage, srcRect = destRect. */
    RasterAccessor s = new RasterAccessor(sources[0], destRect,  
                                          formatTags[0], 
                                          getSourceImage(0).getColorModel());
    RasterAccessor d = new RasterAccessor(dest, destRect,  
                                          formatTags[1], getColorModel());

    if(d.isBinary()) {
        byte[] srcBits = s.getBinaryDataArray();
        byte[] dstBits = d.getBinaryDataArray();
        int length = dstBits.length;
        for(int i = 0; i < length; i++) {
            dstBits[i] = (byte)(~(srcBits[i]));
        }
        d.copyBinaryDataToRaster();
    } else {
        switch (d.getDataType()) {
        case DataBuffer.TYPE_BYTE:
            computeRectByte(s, d);
            break;
        case DataBuffer.TYPE_USHORT:
            computeRectUShort(s, d);
            break;
        case DataBuffer.TYPE_SHORT:
            computeRectShort(s, d);
            break;
        case DataBuffer.TYPE_INT:
            computeRectInt(s, d);
            break;
        case DataBuffer.TYPE_FLOAT:
        case DataBuffer.TYPE_DOUBLE:
            throw new RuntimeException(JaiI18N.getString("InvertOpImage0"));
        }

        d.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:52,
代码来源:InvertOpImage.java

示例33: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Adds the pixel values of the source images within a specified rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    int numSrcs = getNumSources();
    
    RasterAccessor dst = new RasterAccessor(dest, destRect, 
                           formatTags[numSrcs], getColorModel());

    RasterAccessor[] srcs = new RasterAccessor[numSrcs];
    for (int i = 0; i < numSrcs; i++) {
        Rectangle srcRect = mapDestRect(destRect, i);
        srcs[i] = new RasterAccessor(sources[i], srcRect,  
                                     formatTags[i], 
                                     getSourceImage(i).getColorModel());
    }

    switch (dst.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(srcs, dst);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(srcs, dst);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(srcs, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(srcs, dst);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(srcs, dst);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(srcs, dst);
        break;
    }

    if (dst.needsClamping()) {
        /* Further clamp down to underlying raster data type. */
        dst.clampDataArrays();
    }
    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:55,
代码来源:AddCollectionOpImage.java

示例34: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Return the minimum pixel value of the source images for a
 * specified rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    /* For PointOpImage, srcRect = destRect. */
    RasterAccessor s1 = new RasterAccessor(sources[0], destRect,  
                                           formatTags[0], 
                                           getSource(0).getColorModel());
    RasterAccessor s2 = new RasterAccessor(sources[1], destRect, 
                                           formatTags[1], 
                                           getSource(1).getColorModel());
    RasterAccessor d = new RasterAccessor(dest, destRect,  
                                          formatTags[2], getColorModel());

    switch (d.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(s1, s2, d);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(s1, s2, d);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(s1, s2, d);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(s1, s2, d);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(s1, s2, d);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(s1, s2, d);
        break;
    }

    if (d.isDataCopy()) {
        d.clampDataArrays();
        d.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:52,
代码来源:MinOpImage.java

示例35: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Computes a tile of the dithered destination image.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Set format tags
    RasterFormatTag[] formatTags = null;
    if(ImageUtil.isBinary(getSampleModel()) &&
       !ImageUtil.isBinary(getSourceImage(0).getSampleModel())) {
        // XXX Workaround for bug 4521097. This branch of the if-block
        // should be deleted once bug 4668327 is fixed.
        RenderedImage[] sourceArray =
            new RenderedImage[] {getSourceImage(0)};
        RasterFormatTag[] sourceTags =
            RasterAccessor.findCompatibleTags(sourceArray, sourceArray[0]);
        RasterFormatTag[] destTags =
            RasterAccessor.findCompatibleTags(sourceArray, this);
        formatTags = new RasterFormatTag[] {sourceTags[0], destTags[1]};
    } else {
        // Retrieve format tags.
        formatTags = getFormatTags();
    }

    RasterAccessor src = new RasterAccessor(sources[0], destRect,  
                                            formatTags[0], 
                                            getSource(0).getColorModel());
    RasterAccessor dst = new RasterAccessor(dest, destRect,  
                                            formatTags[1], getColorModel());

    switch (src.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(src, dst);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(src, dst);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(src, dst);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(src, dst);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(src, dst);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(src, dst);
        break;
    default:
        throw new RuntimeException(JaiI18N.getString("OrderedDitherOpImage1"));
    }

    dst.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:61,
代码来源:OrderedDitherOpImage.java

示例36: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs max filtering on a specified rectangle. The sources are
 * cobbled.
 *
 * @param sources an array of source Rasters, guaranteed to provide all
 *                necessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);
 
 
    RasterAccessor srcAccessor =
        new RasterAccessor(source, srcRect,
                           formatTags[0], 
                           getSourceImage(0).getColorModel());
    RasterAccessor dstAccessor =
        new RasterAccessor(dest, destRect,  
                           formatTags[1], getColorModel());
 
    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        byteLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_SHORT:
        shortLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_USHORT:
        ushortLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_INT:
        intLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_FLOAT:
        floatLoop(srcAccessor, dstAccessor, maskSize);
        break;
    case DataBuffer.TYPE_DOUBLE:
        doubleLoop(srcAccessor, dstAccessor, maskSize);
        break;
    }
 
    // If the RasterAccessor object set up a temporary buffer for the
    // op to write to, tell the RasterAccessor to write that data
    // to the raster no that we're done with it.
    if (dstAccessor.isDataCopy()) {
        dstAccessor.clampDataArrays();
        dstAccessor.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:57,
代码来源:MaxFilterOpImage.java

示例37: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Subtracts the pixel values of two source images within a specified
 * rectangle.
 *
 * @param sources   Cobbled sources, guaranteed to provide all the
 *                  source data necessary for computing the rectangle.
 * @param dest      The tile containing the rectangle to be computed.
 * @param destRect  The rectangle within the tile to be computed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    RasterAccessor s1 = new RasterAccessor(sources[0], destRect,  
                                           formatTags[0], 
                                           getSource(0).getColorModel());
    RasterAccessor s2 = new RasterAccessor(sources[1], destRect,  
                                           formatTags[1], 
                                           getSource(1).getColorModel());
    RasterAccessor d = new RasterAccessor(dest, destRect,  
                                          formatTags[2], getColorModel());
 
    if(d.isBinary()) {
        byte[] src1Bits = s1.getBinaryDataArray();
        byte[] src2Bits = s2.getBinaryDataArray();
        byte[] dstBits = d.getBinaryDataArray();

        int length = dstBits.length;
        for(int i = 0; i < length; i++) {
            // "Subtract" is equivalent to the following
            // when -1 is clamped to 0.
            dstBits[i] = (byte)(src1Bits[i] & (byte)(~(src2Bits[i])));
        }

        d.copyBinaryDataToRaster();

 return;
    }

    switch (d.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        computeRectByte(s1, s2, d);
        break;
    case DataBuffer.TYPE_USHORT:
        computeRectUShort(s1, s2, d);
        break;
    case DataBuffer.TYPE_SHORT:
        computeRectShort(s1, s2, d);
        break;
    case DataBuffer.TYPE_INT:
        computeRectInt(s1, s2, d);
        break;
    case DataBuffer.TYPE_FLOAT:
        computeRectFloat(s1, s2, d);
        break;
    case DataBuffer.TYPE_DOUBLE:
        computeRectDouble(s1, s2, d);
        break;
    }

    if (d.needsClamping()) {
        d.clampDataArrays();
    }

    d.copyDataToRaster();
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:69,
代码来源:SubtractOpImage.java

示例38: computeRect

点赞 2

import javax.media.jai.RasterFormatTag; //导入依赖的package包/类
/**
 * Performs convolution on a specified rectangle. The sources are
 * cobbled.
 *
 * @param sources an array of source Rasters, guaranteed to provide all
 *                necessary source data for computing the output.
 * @param dest a WritableRaster tile containing the area to be computed.
 * @param destRect the rectangle within dest to be processed.
 */
protected void computeRect(Raster[] sources,
                           WritableRaster dest,
                           Rectangle destRect) {
    // Retrieve format tags.
    RasterFormatTag[] formatTags = getFormatTags();

    Raster source = sources[0];
    Rectangle srcRect = mapDestRect(destRect, 0);
 
 
    RasterAccessor srcAccessor =
        new RasterAccessor(source, srcRect, formatTags[0], 
                           getSource(0).getColorModel());
    RasterAccessor dstAccessor =
        new RasterAccessor(dest, destRect, formatTags[1], 
                           this.getColorModel());
 
    switch (dstAccessor.getDataType()) {
    case DataBuffer.TYPE_BYTE:
        byteLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_INT:
        intLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_SHORT:
        shortLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_USHORT:
        ushortLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_FLOAT:
        floatLoop(srcAccessor, dstAccessor);
        break;
    case DataBuffer.TYPE_DOUBLE:
        doubleLoop(srcAccessor, dstAccessor);
        break;
 
    default:
    }
 
    // If the RasterAccessor object set up a temporary buffer for the
    // op to write to, tell the RasterAccessor to write that data
    // to the raster no that we're done with it.
    if (dstAccessor.isDataCopy()) {
        dstAccessor.clampDataArrays();
        dstAccessor.copyDataToRaster();
    }
}
 

开发者ID:RoProducts,
项目名称:rastertheque,
代码行数:58,
代码来源:SeparableConvolveOpImage.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)