Class GifEncoder
java.lang.Object
javajs.img.ImageEncoder
javajs.img.GifEncoder
- All Implemented Interfaces:
GenericImageEncoder
GifEncoder extensively adapted for Jmol by Bob Hanson
Color quantization roughly follows the GIMP method
"dither Floyd-Steinberg (normal)" but with some twists. (For example, we
exclude the background color.)
Note that although GIMP code annotation refers to "median-cut", it is really
using MEAN-cut. That is what I use here as well.
-- commented code allows visualization of the color space using Jmol. Very
enlightening!
-- much simplified interface with ImageEncoder
-- uses simple Hashtable with Integer() to catalog colors
-- allows progressive production of animated GIF via Jmol CAPTURE command
-- uses general purpose javajs.util.OutputChannel for byte-handling options
such as posting to a server, writing to disk, and retrieving bytes.
-- allows JavaScript port
-- Bob Hanson, first try: 24 Sep 2013; final coding: 9 Nov 2014
- Author:
- Bob Hanson hansonr@stolaf.edu
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclose()protected voidprotected voidgenerate()protected voidwe allow for animated GIF by being able to re-enter the code with different parameters held in paramsprotected P3toLABnorm(int rgb) ////////////////////// CIE Lab / XYZ / sRGB conversion methods /////////protected P3Methods inherited from class ImageEncoder
createImage, putByte, putString
-
Constructor Details
-
GifEncoder
public GifEncoder()
-
-
Method Details
-
setParams
we allow for animated GIF by being able to re-enter the code with different parameters held in params- Specified by:
setParamsin classImageEncoder
-
generate
- Specified by:
generatein classImageEncoder- Throws:
IOException
-
close
protected void close()- Overrides:
closein classImageEncoder
-
toLABnorm
////////////////////// CIE Lab / XYZ / sRGB conversion methods ///////// -
toRGB
-
rgbToXyz
-
xyzToRgb
-
xyzToLab
-
labToXyz
-
flushBytes
protected void flushBytes()
-