/** * Performs a single-input/single-output dither operation, applying basic * Floyd-Steinberg error-diffusion to the image. * * @param pSource * @param pDest * * @return the destination raster, or a new raster, if {@code pDest} was * {@code null}. */ public final WritableRaster filter(final Raster pSource, WritableRaster pDest) { return filter(pSource, pDest, getICM(pSource)); }
/** * Performs a single-input/single-output dither operation, applying basic * Floyd-Steinberg error-diffusion to the image. * * @param pSource the source image * @param pDest the destiantion image * * @return the destination image, or a new image, if {@code pDest} was * {@code null}. */ public final BufferedImage filter(BufferedImage pSource, BufferedImage pDest) { // Create destination image, if none provided if (pDest == null) { pDest = createCompatibleDestImage(pSource, getICM(pSource)); } else if (!(pDest.getColorModel() instanceof IndexColorModel)) { throw new ImageFilterException("Only IndexColorModel allowed."); } // Filter rasters filter(pSource.getRaster(), pDest.getRaster(), (IndexColorModel) pDest.getColorModel()); return pDest; }
/** * Used to define a cube of the color space. The cube can be split * approximately in half to generate two cubes. */ private static class Cube { int[] min = {0, 0, 0}; int[] max = {255, 255, 255}; boolean done = false; List<Counter>[] colors = null; int count = 0; static final int RED = 0; static final int GRN = 1; static final int BLU = 2; /** * Define a new cube. * * @param colors contains the 3D color histogram to be subdivided * @param count the total number of pixels in the 3D histogram. */ public Cube(List<Counter>[] colors, int count) { this.colors = colors; this.count = count; } /** * If this returns true then the cube can not be subdivided any * further * * @return true if cube can not be subdivided any further
/** * Performs a single-input/single-output dither operation, applying basic * Floyd-Steinberg error-diffusion to the image. * * @param pSource * @param pDest * * @return the destination raster, or a new raster, if {@code pDest} was * {@code null}. */ public final WritableRaster filter(final Raster pSource, WritableRaster pDest) { return filter(pSource, pDest, getICM(pSource)); }
/** * Performs a single-input/single-output dither operation, applying basic * Floyd-Steinberg error-diffusion to the image. * * @param pSource * @param pDest * * @return the destination raster, or a new raster, if {@code pDest} was * {@code null}. */ public final WritableRaster filter(final Raster pSource, WritableRaster pDest) { return filter(pSource, pDest, getICM(pSource)); }
/** * Performs a single-input/single-output dither operation, applying basic * Floyd-Steinberg error-diffusion to the image. * * @param pSource the source image * @param pDest the destiantion image * * @return the destination image, or a new image, if {@code pDest} was * {@code null}. */ public final BufferedImage filter(BufferedImage pSource, BufferedImage pDest) { // Create destination image, if none provided if (pDest == null) { pDest = createCompatibleDestImage(pSource, getICM(pSource)); } else if (!(pDest.getColorModel() instanceof IndexColorModel)) { throw new ImageFilterException("Only IndexColorModel allowed."); } // Filter rasters filter(pSource.getRaster(), pDest.getRaster(), (IndexColorModel) pDest.getColorModel()); return pDest; }
/** * Performs a single-input/single-output dither operation, applying basic * Floyd-Steinberg error-diffusion to the image. * * @param pSource the source image * @param pDest the destiantion image * * @return the destination image, or a new image, if {@code pDest} was * {@code null}. */ public final BufferedImage filter(BufferedImage pSource, BufferedImage pDest) { // Create destination image, if none provided if (pDest == null) { pDest = createCompatibleDestImage(pSource, getICM(pSource)); } else if (!(pDest.getColorModel() instanceof IndexColorModel)) { throw new ImageFilterException("Only IndexColorModel allowed."); } // Filter rasters filter(pSource.getRaster(), pDest.getRaster(), (IndexColorModel) pDest.getColorModel()); return pDest; }
/** * Used to define a cube of the color space. The cube can be split * approximately in half to generate two cubes. */ private static class Cube { int[] min = {0, 0, 0}; int[] max = {255, 255, 255}; boolean done = false; List<Counter>[] colors = null; int count = 0; static final int RED = 0; static final int GRN = 1; static final int BLU = 2; /** * Define a new cube. * * @param colors contains the 3D color histogram to be subdivided * @param count the total number of pixels in the 3D histogram. */ public Cube(List<Counter>[] colors, int count) { this.colors = colors; this.count = count; } /** * If this returns true then the cube can not be subdivided any * further * * @return true if cube can not be subdivided any further
/** * Used to define a cube of the colorspace. The cube can be split * approximagely in half to generate two cubes. */ private static class Cube { int[] min = {0, 0, 0}, max = {255, 255, 255}; boolean done = false; List[] colors = null; int count = 0; static final int RED = 0; static final int GRN = 1; static final int BLU = 2; /** * Define a new cube. * * @param colors contains the 3D color histogram to be subdivided * @param count the total number of pixels in the 3D histogram. */ public Cube(List[] colors, int count) { this.colors = colors; this.count = count; } /** * If this returns true then the cube can not be subdivided any * further * * @return true if cube can not be subdivided any further */