/** * Creates a new TiledImage object with a single band of constant value. * The data type of the image corresponds to the class of {@code value}. * * @param width image width in pixels * * @param height image height in pixels * * @param value the constant value to fill the image * * @return a new TiledImage object */ public static TiledImage createConstantImage(int width, int height, Number value) { return createConstantImage(width, height, new Number[] {value}); }
/** * Create a set of colours using a simple colour ramp algorithm in the HSB colour space. * * @param numColours number of colours required * * @return an array of colours sampled from the HSB space. */ public static Color[] createRampColours(int numColours) { return createRampColours(numColours, 0.8f, 0.8f); }
private static void fillRaster(WritableRaster wr, int w, int h, int dataType, Object typedValues) { switch (dataType) { case DataBuffer.TYPE_DOUBLE: { double[] values = (double[]) typedValues; fillRasterDouble(wr, w, h, values); } break; case DataBuffer.TYPE_FLOAT: { float[] values = (float[]) typedValues; fillRasterFloat(wr, w, h, values); } break; case DataBuffer.TYPE_BYTE: case DataBuffer.TYPE_SHORT: case DataBuffer.TYPE_INT: { int[] values = (int[]) typedValues; fillRasterInt(wr, w, h, values); } break; } }
TiledImage img = createConstantImage(width, height, val); fillImageAsDouble(img, array, width, height); fillImageAsFloat(img, array, width, height); fillImageAsInt(img, array, width, height); fillImageAsShort(img, array, width, height); fillImageAsByte(img, array, width, height);
tileW = tile0.getWidth(); tileH = tile0.getHeight(); fillRaster(tile0, tileW, tileH, dataType, typedValues); } else { child.setDataElements(0, 0, tile0);
/** * Creates a new TiledImage object with a single band of constant value. * The data type of the image corresponds to the class of {@code value}. * * @param minx minimum image X ordinate * * @param miny minimum image Y ordinate * * @param width image width in pixels * * @param height image height in pixels * * @param value the constant value to fill the image * * @return a new TiledImage object */ public static TiledImage createConstantImage(int minx, int miny, int width, int height, Number value) { return createConstantImage(minx, miny, width, height, new Number[] {value}); }
/** * Create a set of colours using a simple colour ramp algorithm in the HSB colour space. * * @param numColours number of colours required * * @param saturation the saturation of all colours (between 0 and 1) * * @param brightness the brightness of all colours (between 0 and 1) * * @return an array of colours sampled from the HSB space between the start and end hues */ public static Color[] createRampColours(int numColours, float saturation, float brightness) { return createRampColours(numColours, 0.0f, 1.0f, saturation, brightness); }
/** * Creates a new TiledImage object with one or more bands of constant value. * The number of bands in the output image corresponds to the length of * the input values array and the data type of the image corresponds to the * {@code Number} class used. * * @param width image width in pixels * * @param height image height in pixels * * @param values array of values (must contain at least one element) * * @return a new TiledImage object */ public static TiledImage createConstantImage(int width, int height, Number[] values) { return createConstantImage(0, 0, width, height, values); }
/** * Creates a new TiledImage object with one or more bands of constant value. * The number of bands in the output image corresponds to the length of * the input values array and the data type of the image corresponds to the * {@code Number} class used. * * @param minx minimum image X ordinate * * @param miny minimum image Y ordinate * * @param width image width in pixels * * @param height image height in pixels * * @param values array of values (must contain at least one element) * * @return a new TiledImage object */ public static TiledImage createConstantImage(int minx, int miny, int width, int height, Number[] values) { Dimension tileSize = JAI.getDefaultTileSize(); return createConstantImage(minx, miny, width, height, tileSize.width, tileSize.height, values); } /**
lookupImg = createConstantImage(dataImg.getWidth(), dataImg.getHeight(), Integer.valueOf(0));