List of usage examples for java.awt.image DataBuffer TYPE_FLOAT
int TYPE_FLOAT
To view the source code for java.awt.image DataBuffer TYPE_FLOAT.
Click Source Link
From source file:org.mrgeo.services.mrspyramid.MrsPyramidService.java
public Raster createColorScaleSwatch(ColorScale cs, String format, int width, int height) throws Exception { double[] extrema = { 0, 0 }; WritableRaster wr = RasterUtils.createEmptyRaster(width, height, 1, DataBuffer.TYPE_FLOAT); if (width > height) { extrema[1] = width - 1;/* w w w .java 2 s . com*/ for (int w = 0; w < width; w++) { for (int h = 0; h < height; h++) { wr.setSample(w, h, 0, w); } } } else { extrema[1] = height - 1; for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { wr.setSample(w, h, 0, extrema[1] - h); } } } ColorScaleApplier applier = (ColorScaleApplier) ImageHandlerFactory.getHandler(format, ColorScaleApplier.class); return applier.applyColorScale(wr, cs, extrema, new double[] { -9999, 0 }); }