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

x33g5p2x  于2022-01-28 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(186)

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

Raster.getMinX介绍

暂无

代码示例

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

ps.println("Band " + band + ":");
for (int j = raster.getMinY(); j < (raster.getMinY() + raster.getHeight()); j++) {
  for (int i = raster.getMinX(); i < (raster.getMinX() + raster.getWidth()); i++) {
    if (raster.getTransferType() == DataBuffer.TYPE_DOUBLE)
      ps.print(raster.getSampleDouble(i, j, band));
      ps.print(raster.getSampleFloat(i, j, band));
    else ps.print(raster.getSample(i, j, band));
    if (i < (raster.getMinX() + raster.getWidth() - 1)) {
      ps.print(" ");

代码示例来源:origin: haraldk/TwelveMonkeys

private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) {
  if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1)
      && xSub == 1
      && bands == null /* TODO: Compare bands with that of raster */) {
    return raster;
  }
  return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands);
}

代码示例来源:origin: haraldk/TwelveMonkeys

private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) {
  if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1)
      && xSub == 1
      && bands == null /* TODO: Compare bands with that of raster */) {
    return raster;
  }
  return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands);
}

代码示例来源:origin: haraldk/TwelveMonkeys

private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) {
  if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1)
      && xSub == 1
      && bands == null /* TODO: Compare bands with that of raster */) {
    return raster;
  }
  return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands);
}

代码示例来源:origin: haraldk/TwelveMonkeys

private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) {
  if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1)
      && xSub == 1
      && bands == null /* TODO: Compare bands with that of raster */) {
    return raster;
  }
  return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands);
}

代码示例来源:origin: haraldk/TwelveMonkeys

private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) {
  if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1)
      && xSub == 1
      && bands == null /* TODO: Compare bands with that of raster */) {
    return raster;
  }
  return raster.createChild(rect.x / xSub, 0, rect.width / xSub, 1, 0, 0, bands);
}

代码示例来源:origin: haraldk/TwelveMonkeys

private Raster clipRowToRect(final Raster raster, final Rectangle rect, final int[] bands, final int xSub) {
  if (rect.contains(raster.getMinX(), 0, raster.getWidth(), 1)
      && xSub == 1
      && bands == null /* TODO: Compare bands with that of raster */) {
    return raster;
  }
  return raster.createChild((rect.x + xSub - 1) / xSub, 0, (rect.width + xSub - 1) / xSub, 1, 0, 0, bands);
}

代码示例来源:origin: haraldk/TwelveMonkeys

public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
    int width = min(src.getWidth(), dstIn.getWidth());
    // We always work in RGB, using DataBuffer.TYPE_INT transfer type.
    int[] srcData = null;
    int[] dstData = null;
    int[] resData = new int[width - src.getMinX()];
    for (int y = src.getMinY(); y < src.getHeight(); y++) {
      srcData = (int[]) src.getDataElements(src.getMinX(), y, width, 1, srcData);
      dstData = (int[]) dstIn.getDataElements(src.getMinX(), y, width, 1, dstData);
      for (int x = src.getMinX(); x < width; x++) {
        // TODO: Decide how to handle alpha (if at all)
        resData[x] = 0xff000000 | ((~srcData[x] ^ dstData[x])) & 0xffffff;
      }
      dstOut.setDataElements(src.getMinX(), y, width, 1, resData);
    }
  }
};

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

/**
 * Constructs multi-dimensional grid envelope defined by a {@link Raster}. The two first
 * dimensions are set to the [{@linkplain Raster#getMinX x} .. x+{@linkplain Raster#getWidth
 * width}-1] and [{@linkplain Raster#getMinY y} .. y+{@linkplain Raster#getHeight height}-1]
 * inclusive ranges respectively. Extra dimensions (if any) are set to the [0..0] inclusive
 * range.
 *
 * <p>Notice that this method ensure interoperability between {@link Raster} dimensions in
 * Java2D style and {@link GridEnvelope} dimensions in ISO 19123 style providing that the user
 * remember to add 1 to the {@link GridEnvelope#getHigh(int)} values.
 *
 * @param raster The raster for which to construct a grid envelope.
 * @param dimension Number of dimensions for this grid envelope. Must be equals or greater than
 *     2.
 */
public GeneralGridEnvelope(final Raster raster, final int dimension) {
  this(raster.getMinX(), raster.getMinY(), raster.getWidth(), raster.getHeight(), dimension);
}

代码示例来源:origin: haraldk/TwelveMonkeys

public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
    int width = min(src.getWidth(), dstIn.getWidth());
    // We always work in RGB, using DataBuffer.TYPE_INT transfer type.
    int[] srcData = null;
    int[] dstData = null;
    int[] resData = new int[width - src.getMinX()];
    for (int y = src.getMinY(); y < src.getHeight(); y++) {
      srcData = (int[]) src.getDataElements(src.getMinX(), y, width, 1, srcData);
      dstData = (int[]) dstIn.getDataElements(src.getMinX(), y, width, 1, dstData);
      for (int x = src.getMinX(); x < width; x++) {
        int sAlpha = (srcData[x] >>> 24) & 0xFF;
        int sRed = sAlpha * ((srcData[x] >> 16) & 0xFF) / 0xFF;
        int sGreen = sAlpha * ((srcData[x] >> 8) & 0xFF) / 0xFF;
        int sBlue = sAlpha * ((srcData[x]) & 0xFF) / 0xFF;
        int dAlpha = (dstData[x] >>> 24) & 0xFF;
        int dRed = dAlpha * ((dstData[x] >> 16) & 0xFF) / 0xFF;
        int dGreen = dAlpha * ((dstData[x] >> 8) & 0xFF) / 0xFF;
        int dBlue = dAlpha * ((dstData[x]) & 0xFF) / 0xFF;
        resData[x] = (max(sAlpha, dAlpha) << 24)
               | (max(sRed, dRed) << 16)
               | (max(sGreen, dGreen) << 8)
               | (max(sBlue, dBlue));
      }
      dstOut.setDataElements(src.getMinX(), y, width, 1, resData);
    }
  }
};

代码示例来源:origin: haraldk/TwelveMonkeys

public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
    int width = min(src.getWidth(), dstIn.getWidth());
    // We always work in RGB, using DataBuffer.TYPE_INT transfer type.
    int[] srcData = null;
    int[] dstData = null;
    int[] resData = new int[width - src.getMinX()];
    for (int y = src.getMinY(); y < src.getHeight(); y++) {
      srcData = (int[]) src.getDataElements(src.getMinX(), y, width, 1, srcData);
      dstData = (int[]) dstIn.getDataElements(src.getMinX(), y, width, 1, dstData);
      for (int x = src.getMinX(); x < width; x++) {
        int sAlpha = (srcData[x] >>> 24) & 0xFF;
        int sRed = sAlpha * ((srcData[x] >> 16) & 0xFF) / 0xFF;
        int sGreen = sAlpha * ((srcData[x] >> 8) & 0xFF) / 0xFF;
        int sBlue = sAlpha * ((srcData[x]) & 0xFF) / 0xFF;
        int dAlpha = (dstData[x] >>> 24) & 0xFF;
        int dRed = dAlpha * ((dstData[x] >> 16) & 0xFF) / 0xFF;
        int dGreen = dAlpha * ((dstData[x] >> 8) & 0xFF) / 0xFF;
        int dBlue = dAlpha * ((dstData[x]) & 0xFF) / 0xFF;
        resData[x] = (min(sAlpha, dAlpha) << 24)
               | (min(sRed, dRed) << 16)
               | (min(sGreen, dGreen) << 8)
               | (min(sBlue, dBlue));
      }
      dstOut.setDataElements(src.getMinX(), y, width, 1, resData);
    }
  }
};

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

public WritableRaster createCompatibleDestRaster(Raster src) {
  return icm.createCompatibleWritableRaster(src.getWidth(), src.getHeight())
      .createWritableTranslatedChild(src.getMinX(), src.getMinY());
}

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

int minx = r.getMinX();
int miny = r.getMinY();
int maxx = minx + r.getWidth();

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

int minx = r.getMinX();
int miny = r.getMinY();
int maxx = minx + r.getWidth();

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

final int srcMinX = src.getMinX();
final int srcMinY = src.getMinY();
final int srcMaxX = srcMinX + w;
final int srcMaxY = srcMinY + h;
final int dstMinX = src.getMinX();
final int dstMinY = src.getMinY();
final int numBands = src.getSampleModel().getNumBands();

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

srcTile.getMinX(),
srcTile.getMinY(),
srcTile.getWidth(),

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

srcTile.getMinX(),
srcTile.getMinY(),
srcTile.getWidth(),

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

final boolean sourceHasAlpha = sourceColorModel.hasAlpha();
final int alphaBand = sourceHasAlpha ? numBands - 1 : -1;
final int minx = sourceRaster.getMinX();
final int maxx = minx + w;
final int miny = sourceRaster.getMinY();

代码示例来源:origin: haraldk/TwelveMonkeys

Raster srcChannel = clippedRow.createChild(clippedRow.getMinX(), 0, clippedRow.getWidth(), 1, 0, 0, new int[] {c});

代码示例来源:origin: haraldk/TwelveMonkeys

for (int c = 0; c < header.getChannels(); c++) {
  WritableRaster destChannel = destRaster.createWritableChild(destRaster.getMinX(), destRaster.getMinY(), destRaster.getWidth(), destRaster.getHeight(), 0, 0, new int[] {c});
  Raster srcChannel = clippedRow.createChild(clippedRow.getMinX(), 0, clippedRow.getWidth(), 1, 0, 0, new int[] {c});

相关文章