Java Code Examples for java.awt.image.WritableRaster#setSamples()

The following examples show how to use java.awt.image.WritableRaster#setSamples() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RasterUtils.java    From geowave with Apache License 2.0 6 votes vote down vote up
public static void fillWithNoDataValues(
    final WritableRaster raster,
    final double[][] noDataValues) {
  if ((noDataValues != null) && (noDataValues.length >= raster.getNumBands())) {
    final double[] noDataFilledArray = new double[raster.getWidth() * raster.getHeight()];
    for (int b = 0; b < raster.getNumBands(); b++) {
      if ((noDataValues[b] != null) && (noDataValues[b].length > 0)) {
        // just fill every sample in this band with the first no
        // data value for that band
        Arrays.fill(noDataFilledArray, noDataValues[b][0]);
        raster.setSamples(
            raster.getMinX(),
            raster.getMinY(),
            raster.getWidth(),
            raster.getHeight(),
            b,
            noDataFilledArray);
      }
    }
  }
}
 
Example 2
Source File: LUTCompareTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 3
Source File: LUTCompareTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 4
Source File: LUTCompareTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 5
Source File: LUTCompareTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 6
Source File: LUTCompareTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 7
Source File: LUTCompareTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 8
Source File: LUTCompareTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 9
Source File: LUTCompareTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 10
Source File: LUTCompareTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 11
Source File: LUTCompareTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 12
Source File: LUTCompareTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 13
Source File: LUTCompareTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}
 
Example 14
Source File: LUTCompareTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static BufferedImage createFrame(int[] palette) {
    IndexColorModel icm = new IndexColorModel(getNumBits(palette.length),
        palette.length, palette, 0, false, -1, DataBuffer.TYPE_BYTE);
    WritableRaster wr = icm.createCompatibleWritableRaster(w, h);
    int[] samples = new int[w * h];
    Arrays.fill(samples, 0);
    wr.setSamples(0, 0, w, h, 0, samples);

    BufferedImage img = new BufferedImage(icm, wr, false, null);
    return img;
}