Package de.gsi.chart.utils
Class PaletteQuantizerNeuQuant
- java.lang.Object
-
- de.gsi.chart.utils.PaletteQuantizerNeuQuant
-
- All Implemented Interfaces:
PaletteQuantizer
public class PaletteQuantizerNeuQuant extends java.lang.Object implements PaletteQuantizer
NeuQuant Neural-Net Quantisation Algorithm Copyright (c) 1994 Anthony Dekker NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See "Kohonen neural networks for optimal colour quantization" in "Network: Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of the algorithm. Any party obtaining a copy of these files from the author, directly or indirectly, is granted, free of charge, a full and unrestricted irrevocable, world-wide, paid up, royalty-free, non-exclusive right and license to deal in this software and documentation files (the "Software"), including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons who receive copies from any such party to do so, with the only requirement being that this copyright notice remain intact.- Author:
- Anthony Dekker - original author, Hernan J Gonzalez - modified for PngReader - no special colours - sequential read, rstein adapted to a modern Java and chart-fx usage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePaletteQuantizerNeuQuant.PixelGetter
-
Field Summary
Fields Modifier and Type Field Description protected int[][]colormap
-
Constructor Summary
Constructors Constructor Description PaletteQuantizerNeuQuant(int w, int h, PaletteQuantizerNeuQuant.PixelGetter pixelGetter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]convert(int r, int g, int b)int[]convert(int r, int g, int b, int a)int[]getColor(int i)intgetColorCount()intgetTransparentIndex()protected intindexSearch(int b, int g, int r)protected voidinitGuard()computes neural network if it hasn't been already donebooleanisParReserveAlphaColor()intlookup(int r, int g, int b)intlookup(int r, int g, int b, int a)voidrun()voidsetParAlphabiasshift(int parAlphabiasshift)voidsetParBeta(double parBeta)voidsetParGamma(double parGamma)voidsetParMaxPixelsToSample(int parMaxPixelsToSample)voidsetParNcolors(int parNcolors)voidsetParNcycles(int parNcycles)voidsetParRadiusbiasshift(int parRadiusbiasshift)voidsetParRadiusdec(int parRadiusdec)voidsetParReserveAlphaColor(boolean parReserveAlphaColor)voidsetParTransparencyThreshold(int parTransparencyThreshold)protected voidsetUpArrays()
-
-
-
Constructor Detail
-
PaletteQuantizerNeuQuant
public PaletteQuantizerNeuQuant(int w, int h, PaletteQuantizerNeuQuant.PixelGetter pixelGetter)
-
-
Method Detail
-
convert
public int[] convert(int r, int g, int b)
-
convert
public int[] convert(int r, int g, int b, int a)
-
getColor
public int[] getColor(int i)
- Specified by:
getColorin interfacePaletteQuantizer
-
getColorCount
public int getColorCount()
- Specified by:
getColorCountin interfacePaletteQuantizer
-
getTransparentIndex
public int getTransparentIndex()
- Specified by:
getTransparentIndexin interfacePaletteQuantizer
-
isParReserveAlphaColor
public boolean isParReserveAlphaColor()
-
lookup
public int lookup(int r, int g, int b)- Specified by:
lookupin interfacePaletteQuantizer
-
lookup
public int lookup(int r, int g, int b, int a)- Specified by:
lookupin interfacePaletteQuantizer
-
run
public void run()
-
setParAlphabiasshift
public void setParAlphabiasshift(int parAlphabiasshift)
-
setParBeta
public void setParBeta(double parBeta)
-
setParGamma
public void setParGamma(double parGamma)
-
setParMaxPixelsToSample
public void setParMaxPixelsToSample(int parMaxPixelsToSample)
-
setParNcolors
public void setParNcolors(int parNcolors)
-
setParNcycles
public void setParNcycles(int parNcycles)
-
setParRadiusbiasshift
public void setParRadiusbiasshift(int parRadiusbiasshift)
-
setParRadiusdec
public void setParRadiusdec(int parRadiusdec)
-
setParReserveAlphaColor
public void setParReserveAlphaColor(boolean parReserveAlphaColor)
-
setParTransparencyThreshold
public void setParTransparencyThreshold(int parTransparencyThreshold)
-
initGuard
protected void initGuard()
computes neural network if it hasn't been already done
-
indexSearch
protected int indexSearch(int b, int g, int r)
-
setUpArrays
protected void setUpArrays()
-
-