gpt4 book ai didi

java.awt.image.WritableRenderedImage.getWritableTile()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 02:29:05 28 4
gpt4 key购买 nike

本文整理了Java中java.awt.image.WritableRenderedImage.getWritableTile()方法的一些代码示例,展示了WritableRenderedImage.getWritableTile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WritableRenderedImage.getWritableTile()方法的具体详情如下:
包路径:java.awt.image.WritableRenderedImage
类名称:WritableRenderedImage
方法名:getWritableTile

WritableRenderedImage.getWritableTile介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

/**
 * Sets every samples in the given image to the given value. This method is typically used for
 * clearing an image content.
 *
 * @param image The image to fill.
 * @param value The value to to given to every samples.
 */
public static void fill(final WritableRenderedImage image, final Number value) {
  int y = image.getMinTileY();
  for (int ny = image.getNumYTiles(); --ny >= 0; ) {
    int x = image.getMinTileX();
    for (int nx = image.getNumXTiles(); --nx >= 0; ) {
      final WritableRaster raster = image.getWritableTile(x, y);
      try {
        fill(raster.getDataBuffer(), value);
      } finally {
        image.releaseWritableTile(x, y);
      }
    }
  }
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Update current writable raster from tiles array coordinates.
 */
@Override
protected void updateCurrentRaster(int tileX, int tileY) {
  super.updateCurrentRaster(tileX, tileY);
  if (currentWritableDataArray != null) writableRenderedImage.releaseWritableTile(prectX, prectY);
  currentWritableDataArray = ((DataBufferByte) writableRenderedImage.getWritableTile(tileX, tileY).getDataBuffer()).getData();
  this.prectX = tileX;
  this.prectY = tileY;
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * {@inheritDoc }.
 */
@Override
protected void updateCurrentRaster(int tileX, int tileY) {
  super.updateCurrentRaster(tileX, tileY);
  if (currentWritableRaster != null) writableRenderedImage.releaseWritableTile(prectX, prectY);
  this.currentWritableRaster    = writableRenderedImage.getWritableTile(tileX, tileY);
  this.currentWritableRaster    = writableRenderedImage.getWritableTile(tileX, tileY);
  this.currentWritableDataArray = ((DataBufferFloat) currentWritableRaster.getDataBuffer()).getData();
  this.prectX = tileX;
  this.prectY = tileY;
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * {@inheritDoc }.
 */
@Override
protected void updateCurrentRaster(int tileX, int tileY) {
  super.updateCurrentRaster(tileX, tileY);
  if (currentWritableRaster != null) writableRenderedImage.releaseWritableTile(prectX, prectY);
  this.currentWritableRaster    = writableRenderedImage.getWritableTile(tileX, tileY);
  this.currentWritableDataArray = ((DataBufferByte) currentWritableRaster.getDataBuffer()).getData();
  this.prectX = tileX;
  this.prectY = tileY;
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Update current writable raster from tiles array coordinates.
 */
@Override
protected void updateCurrentRaster(int tileX, int tileY) {
  super.updateCurrentRaster(tileX, tileY);
  if (currentWritableRaster != null) writableRenderedImage.releaseWritableTile(prectX, prectY);
  currentWritableRaster = writableRenderedImage.getWritableTile(tileX, tileY);
  this.prectX = tileX;
  this.prectY = tileY;
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * {@inheritDoc }.
 */
@Override
protected void updateCurrentRaster(int tileX, int tileY) {
  super.updateCurrentRaster(tileX, tileY);
  if (currentWritableRaster != null) writableRenderedImage.releaseWritableTile(prectX, prectY);
  this.currentWritableRaster = writableRenderedImage.getWritableTile(tileX, tileY);
  prectX = tileX;
  prectY = tileY;
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Update current writable raster from tiles array coordinates.
 */
@Override
protected void updateCurrentRaster(int tileX, int tileY) {
  super.updateCurrentRaster(tileX, tileY);
  if (currentWritableDataArray != null) writableRenderedImage.releaseWritableTile(prectX, prectY);
  currentWritableDataArray = ((DataBufferFloat) writableRenderedImage.getWritableTile(tileX, tileY).getDataBuffer()).getData();
  this.prectX = tileX;
  this.prectY = tileY;
}

代码示例来源:origin: eu.agrosense.client/grid-api

public void setRasterValue(Coordinate coordinate, int value) {
    checkState();

    if (!boundingBox.contains(coordinate.x, coordinate.y)) {
      throw new IllegalArgumentException("Can only add raster values for coordinates (" + coordinate + ") within the bounding box (" + boundingBox + ")");
    }

    Point p = this.gridCellSize.getCell(boundingBox, coordinate);
//        LOGGER.log(Level.FINEST, "raster value set to {0} on cell {1}", new Object[]{value, p});

    WritableRenderedImage raster = getRenderedImage();
    WritableRaster tile = raster.getWritableTile(p.x, p.y);
    try {
      tile.setSample(p.x, p.y, 0, value);
    } catch (ArrayIndexOutOfBoundsException e) {
      LOGGER.log(Level.WARNING, "ArrayIndexOutOfBoundsException for p.x={0} and p.y={1}", new Object[]{p.x, p.y});
    }
    raster.releaseWritableTile(p.x, p.y);

  }

代码示例来源:origin: apache/sis

/**
 * Fetches from the image a tile for the current {@link #tileX} and {@link #tileY} coordinates.
 * All fields prefixed by {@code current} are updated by this method. This method also updates
 * the {@link #y} field, but caller is responsible for updating the {@link #x} field.
 */
private void fetchTile() {
  currentRaster = null;
  if (destination != null) {
    destRaster = destination.getWritableTile(tileX, tileY);
    if (destination == image) {
      currentRaster = destRaster;
    }
  }
  if (currentRaster == null) {
    currentRaster = image.getTile(tileX, tileY);
  }
  final int minX = currentRaster.getMinX();
  final int minY = currentRaster.getMinY();
  currentLowerX  = Math.max(lowerX, minX);
  y              = Math.max(lowerY, minY);
  currentUpperX  = Math.min(upperX, minX + tileWidth);
  currentUpperY  = Math.min(upperY, minY + tileHeight);
  if (currentRaster.getNumBands() != numBands) {
    throw new RasterFormatException(Resources.format(Resources.Keys.IncompatibleTile_2, tileX, tileY));
  }
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Sets every samples in the given image to the given value. This method is typically used
 * for clearing an image content.
 *
 * @param image The image to fill.
 * @param value The value to be given to every samples.
 */
public static void fill(final WritableRenderedImage image, final Number value) {
  int y = image.getMinTileY();
  for (int ny = image.getNumYTiles(); --ny >= 0; y++) {
    int x = image.getMinTileX();
    for (int nx = image.getNumXTiles(); --nx >= 0; x++) {
      final WritableRaster raster = image.getWritableTile(x, y);
      try {
        fill(raster.getDataBuffer(), value);
      } finally {
        image.releaseWritableTile(x, y);
      }
    }
  }
}

代码示例来源:origin: org.geotools/gt-coverage

/**
 * Sets every samples in the given image to the given value. This method is typically used
 * for clearing an image content.
 *
 * @param image The image to fill.
 * @param value The value to to given to every samples.
 */
public static void fill(final WritableRenderedImage image, final Number value) {
  int y = image.getMinTileY();
  for (int ny = image.getNumYTiles(); --ny >= 0;) {
    int x = image.getMinTileX();
    for (int nx = image.getNumXTiles(); --nx >= 0;) {
      final WritableRaster raster = image.getWritableTile(x, y);
      try {
        fill(raster.getDataBuffer(), value);
      } finally {
        image.releaseWritableTile(x, y);
      }
    }
  }
}

代码示例来源:origin: Geomatys/geotoolkit

final Raster top    = (tileY != minTileY) ? image.getTile(tileX, tileY-1) : null;
final Raster bottom = (tileY != maxTileY) ? image.getTile(tileX, tileY+1) : null;
final WritableRaster raster = image.getWritableTile(tileX, tileY);
try {
  fill(raster, top, bottom, bounds, x, y, oldSamples, newSamples, stack);

代码示例来源:origin: Geomatys/geotoolkit

if (fillValue.length != numBands)
    throw new IllegalArgumentException("fillValue table length and numbands are different : "+fillValue.length+" numbands = "+this.numBands);
assert(numBands == imageDest.getWritableTile(imageDest.getMinTileX(), imageDest.getMinTileY()).getNumBands())
    : "destination image numbands different from source image numbands";
this.destIterator              = PixelIteratorFactory.createDefaultWriteableIterator(this.imageDest, this.imageDest, resampleArea);

代码示例来源:origin: Geomatys/geotoolkit

if (fillValue.length != numBands)
    throw new IllegalArgumentException("fillValue table length and numbands are different : "+fillValue.length+" numbands = "+this.numBands);
assert(numBands == imageDest.getWritableTile(imageDest.getMinTileX(), imageDest.getMinTileY()).getNumBands())
    : "destination image numbands different from source image numbands";
this.destIterator              = PixelIteratorFactory.createDefaultWriteableIterator(this.imageDest, this.imageDest, resampleArea);

代码示例来源:origin: Geomatys/geotoolkit

public ResampleTest() {
  final ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
  final ColorModel cm = new ComponentColorModel(cs, new int[]{Double.SIZE}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_DOUBLE);
  final ImageTypeSpecifier imgTypeSpec = new ImageTypeSpecifier(cm, cm.createCompatibleSampleModel(1, 1));
  sourceImg = imgTypeSpec.createBufferedImage(3, 3);
  final WritableRaster raster = sourceImg.getWritableTile(0, 0);
  raster.setSample(0, 0, 0, 1);
  raster.setSample(1, 0, 0, 1);
  raster.setSample(2, 0, 0, 1);
  raster.setSample(0, 1, 0, 1);
  raster.setSample(1, 1, 0, 2);
  raster.setSample(2, 1, 0, 1);
  raster.setSample(0, 2, 0, 1);
  raster.setSample(1, 2, 0, 1);
  raster.setSample(2, 2, 0, 1);
}

代码示例来源:origin: Geomatys/geotoolkit

final ImageTypeSpecifier imgTypeSpec = new ImageTypeSpecifier(cm, cm.createCompatibleSampleModel(1, 1));
sourceImg = imgTypeSpec.createBufferedImage(4, 4);
final WritableRaster raster = sourceImg.getWritableTile(0, 0);

代码示例来源:origin: Geomatys/geotoolkit

final ImageTypeSpecifier imgTypeSpec = new ImageTypeSpecifier(cm, cm.createCompatibleSampleModel(1, 1));
sourceImg = imgTypeSpec.createBufferedImage(4, 4);
final WritableRaster raster = sourceImg.getWritableTile(0, 0);

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com