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

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

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

Raster.getSamples介绍

暂无

代码示例

代码示例来源:origin: nutzam/nutz

byte[] rgb = new byte[w * h * 3];
float[] Y = raster.getSamples(0, 0, w, h, 0, (float[]) null);
float[] Cb = raster.getSamples(0, 0, w, h, 1, (float[]) null);
float[] Cr = raster.getSamples(0, 0, w, h, 2, (float[]) null);
float[] K = raster.getSamples(0, 0, w, h, 3, (float[]) null);

代码示例来源:origin: iBotPeaches/Apktool

int[] gray = null, alpha = null;
for (int y = 0; y < im.getHeight(); y++) {
  gray = srcRaster.getSamples(0, y, w, 1, 0, gray);
  alpha = srcRaster.getSamples(0, y, w, 1, 1, alpha);

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

pixels = raster.getSamples(0, y, width, 1, c, pixels);

代码示例来源:origin: org.apache.pdfbox/jbig2-imageio

@Override
protected void fetch(final int x, final int y)
{
  for (int c = 0; c < componentCount; c++)
  {
    srcRaster.getSamples(x, y, length, 1, c, data[c]);
    if (null != inputFilter)
      inputFilter.filter(x, y, c, data[c], length);
  }
}

代码示例来源:origin: com.levigo.jbig2/levigo-jbig2-imageio

@Override
protected void fetch(final int x, final int y) {
 for (int c = 0; c < componentCount; c++) {
  srcRaster.getSamples(x, y, length, 1, c, data[c]);
  if (null != inputFilter)
   inputFilter.filter(x, y, c, data[c], length);
 }
}

代码示例来源:origin: senbox-org/s1tbx

private static void outputRealImage(final RenderedImage I, final int startIdx, final int endIdx) {
  final Raster data = I.getData();
  final double[] real = data.getSamples(0, 0, I.getWidth(), I.getHeight(), 0, (double[]) null);
  for (int i = startIdx; i <= endIdx; i++) {
    System.out.print(real[i] + ",");
  }
  System.out.println();
}

代码示例来源:origin: levigo/jbig2-imageio

@Override
protected void fetch(final int x, final int y) {
 for (int c = 0; c < componentCount; c++) {
  srcRaster.getSamples(x, y, length, 1, c, data[c]);
  if (null != inputFilter)
   inputFilter.filter(x, y, c, data[c], length);
 }
}

代码示例来源:origin: senbox-org/s1tbx

private static void outputComplexImage(final PlanarImage image) {
  final int w = image.getWidth();
  final int h = image.getHeight();
  final Raster dftData = image.getData();
  final double[] real = dftData.getSamples(0, 0, w, h, 0, (double[]) null);
  final double[] imag = dftData.getSamples(0, 0, w, h, 1, (double[]) null);
  System.out.println("Real part:");
  for (double v : real) {
    System.out.print(v + ", ");
  }
  System.out.println();
  System.out.println("Imaginary part:");
  for (double v : imag) {
    System.out.print(v + ", ");
  }
  System.out.println();
}

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

private void writeObject(ObjectOutputStream oos) throws IOException {
  RenderedImage ri = this.grid.getRenderedImage();
  serializedRaster = ri.getData().getSamples(ri.getMinX(), ri.getMinY(), ri.getWidth(), ri.getHeight(), BAND, (int[])null);
  LOGGER.log(Level.FINEST, "Writing Grid, internal gridCoverage={0}", this.grid);
  oos.defaultWriteObject();
}

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

public GridImageElement(Lookup lkp) {
  gridDataObject = lkp.lookup(GridDataObject.class);
  assert gridDataObject != null;
  setLayout(new BorderLayout());
  grid = gridDataObject.getLookup().lookup(Grid.class);
  RenderedImage ri = grid.getRenderedImage();
  serializedRaster = ri.getData().getSamples(ri.getMinX(), ri.getMinY(), ri.getWidth(), ri.getHeight(), Grid.BAND, (int[]) null);
  initComponents();
}

代码示例来源:origin: bcdev/beam

ArrayDataProvider(RasterDataNode lonBand, RasterDataNode latBand, PlanarImage maskImage) {
  width = lonBand.getSceneRasterWidth();
  int height = lonBand.getSceneRasterHeight();
  MultiLevelImage lonImage = ImageManager.createMaskedGeophysicalImage(lonBand, Float.NaN);
  lonData = lonImage.getData().getSamples(0, 0, width, height, 0, (float[]) null);
  MultiLevelImage latImage = ImageManager.createMaskedGeophysicalImage(latBand, Float.NaN);
  latData = latImage.getData().getSamples(0, 0, width, height, 0, (float[]) null);
  if (maskImage != null) {
    final int[] maskValues = maskImage.getData().getSamples(0, 0, width, height, 0, (int[]) null);
    for (int i = 0; i < maskValues.length; i++) {
      if (maskValues[i] == 0) {
        lonData[i] = Float.NaN;
        latData[i] = Float.NaN;
      }
    }
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public static void copyBand(Raster         src, int srcBand,
                WritableRaster dst, int dstBand) {
    Rectangle srcR = new Rectangle(src.getMinX(),  src.getMinY(),
                    src.getWidth(), src.getHeight());
    Rectangle dstR = new Rectangle(dst.getMinX(),  dst.getMinY(),
                    dst.getWidth(), dst.getHeight());

    Rectangle cpR  = srcR.intersection(dstR);

    int [] samples = null;
    for (int y=cpR.y; y< cpR.y+cpR.height; y++) {
      samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples);
      dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples);
    }
  }
}

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

public static void copyBand(Raster         src, int srcBand,
                WritableRaster dst, int dstBand) {
    Rectangle srcR = new Rectangle(src.getMinX(),  src.getMinY(),
                    src.getWidth(), src.getHeight());
    Rectangle dstR = new Rectangle(dst.getMinX(),  dst.getMinY(),
                    dst.getWidth(), dst.getHeight());

    Rectangle cpR  = srcR.intersection(dstR);

    int [] samples = null;
    for (int y=cpR.y; y< cpR.y+cpR.height; y++) {
      samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples);
      dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples);
    }
  }
}

代码示例来源:origin: org.apache.xmlgraphics/xmlgraphics-commons

public static void copyBand(Raster         src, int srcBand,
                WritableRaster dst, int dstBand) {
    Rectangle srcR = new Rectangle(src.getMinX(),  src.getMinY(),
                    src.getWidth(), src.getHeight());
    Rectangle dstR = new Rectangle(dst.getMinX(),  dst.getMinY(),
                    dst.getWidth(), dst.getHeight());

    Rectangle cpR  = srcR.intersection(dstR);

    int [] samples = null;
    for (int y = cpR.y; y < cpR.y + cpR.height; y++) {
      samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples);
      dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples);
    }
  }
}

代码示例来源:origin: org.apache.xmlgraphics/batik-awt-util

public static void copyBand(Raster         src, int srcBand,
                WritableRaster dst, int dstBand) {
    Rectangle srcR = new Rectangle(src.getMinX(),  src.getMinY(),
                    src.getWidth(), src.getHeight());
    Rectangle dstR = new Rectangle(dst.getMinX(),  dst.getMinY(),
                    dst.getWidth(), dst.getHeight());

    Rectangle cpR  = srcR.intersection(dstR);

    int [] samples = null;
    for (int y=cpR.y; y< cpR.y+cpR.height; y++) {
      samples = src.getSamples(cpR.x, y, cpR.width, 1, srcBand, samples);
      dst.setSamples(cpR.x, y, cpR.width, 1, dstBand, samples);
    }
  }
}

代码示例来源:origin: org.apache.xmlgraphics/batik-awt-util

public static void copyBand(Raster         src, Rectangle sR, int sBand,
              WritableRaster dst, Rectangle dR, int dBand) {
  int dy = dR.y -sR.y;
  int dx = dR.x -sR.x;
  sR = sR.intersection(src.getBounds());
  dR = dR.intersection(dst.getBounds());
  int width, height;
  if (dR.width  < sR.width)  width  = dR.width;
  else                       width  = sR.width;
  if (dR.height < sR.height) height = dR.height;
  else                       height = sR.height;
  int x = sR.x+dx;
  int [] samples = null;
  for (int y=sR.y; y< sR.y+height; y++) {
    samples = src.getSamples(sR.x, y, width, 1, sBand, samples);
    dst.setSamples(x, y+dy, width, 1, dBand, samples);
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public static void copyBand(Raster         src, Rectangle sR, int sBand,
              WritableRaster dst, Rectangle dR, int dBand) {
  int dy = dR.y -sR.y;
  int dx = dR.x -sR.x;
  sR = sR.intersection(src.getBounds());
  dR = dR.intersection(dst.getBounds());
  int width, height;
  if (dR.width  < sR.width)  width  = dR.width;
  else                       width  = sR.width;
  if (dR.height < sR.height) height = dR.height;
  else                       height = sR.height;
  int x = sR.x+dx;
  int [] samples = null;
  for (int y=sR.y; y< sR.y+height; y++) {
    samples = src.getSamples(sR.x, y, width, 1, sBand, samples);
    dst.setSamples(x, y+dy, width, 1, dBand, samples);
  }
}

代码示例来源:origin: org.icepdf.os/icepdf-core

public static void copyBand(Raster src, Rectangle sR, int sBand,
              WritableRaster dst, Rectangle dR, int dBand) {
  int dy = dR.y - sR.y;
  int dx = dR.x - sR.x;
  sR = sR.intersection(src.getBounds());
  dR = dR.intersection(dst.getBounds());
  int width, height;
  if (dR.width < sR.width) width = dR.width;
  else width = sR.width;
  if (dR.height < sR.height) height = dR.height;
  else height = sR.height;
  int x = sR.x + dx;
  int[] samples = null;
  for (int y = sR.y; y < sR.y + height; y++) {
    samples = src.getSamples(sR.x, y, width, 1, sBand, samples);
    dst.setSamples(x, y + dy, width, 1, dBand, samples);
  }
}

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

public static void copyBand(Raster         src, Rectangle sR, int sBand,
              WritableRaster dst, Rectangle dR, int dBand) {
  int dy = dR.y -sR.y;
  int dx = dR.x -sR.x;
  sR = sR.intersection(src.getBounds());
  dR = dR.intersection(dst.getBounds());
  int width, height;
  if (dR.width  < sR.width)  width  = dR.width;
  else                       width  = sR.width;
  if (dR.height < sR.height) height = dR.height;
  else                       height = sR.height;
  int x = sR.x+dx;
  int [] samples = null;
  for (int y=sR.y; y< sR.y+height; y++) {
    samples = src.getSamples(sR.x, y, width, 1, sBand, samples);
    dst.setSamples(x, y+dy, width, 1, dBand, samples);
  }
}

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

public static void copyBand(Raster src, Rectangle sR, int sBand, WritableRaster dst, Rectangle dR, int dBand) {
  int dy = dR.y - sR.y;
  int dx = dR.x - sR.x;
  sR = sR.intersection(src.getBounds());
  dR = dR.intersection(dst.getBounds());
  int width, height;
  if (dR.width < sR.width)
    width = dR.width;
  else
    width = sR.width;
  if (dR.height < sR.height)
    height = dR.height;
  else
    height = sR.height;
  int x = sR.x + dx;
  int[] samples = null;
  for (int y = sR.y; y < sR.y + height; y++) {
    samples = src.getSamples(sR.x, y, width, 1, sBand, samples);
    dst.setSamples(x, y + dy, width, 1, dBand, samples);
  }
}

相关文章