public class GifEncoder extends ImageEncoder
Modifier and Type | Class and Description |
---|---|
private class |
GifEncoder.AdaptiveColorCollection |
private class |
GifEncoder.ColorItem |
protected class |
GifEncoder.ColorVector |
Modifier and Type | Field and Description |
---|---|
private boolean |
addHeader |
private boolean |
addImage |
private boolean |
addTrailer |
private static int |
BITS |
private int |
bitsPerPixel |
protected int[] |
blue |
private byte[] |
buf |
private int |
bufPt |
private int |
byteCount |
private int |
clearCode |
private boolean |
clearFlag |
private int[] |
codetab |
private Map<Integer,GifEncoder.AdaptiveColorCollection> |
colorMap |
private int |
countDown |
private int |
curAccum |
private int |
curBits |
private int |
curpt |
private int |
curx |
private int |
cury |
private int |
delayTime100ths |
private static int |
EOF |
private int |
EOFCode |
private int |
freeEnt |
protected int[] |
green |
private int |
hsize |
private static int |
HSIZE |
private int[] |
htab |
private int |
initCodeSize |
private static int[] |
INTERLACE_PARAMS |
private boolean |
interlaced |
private boolean |
looping |
private int[] |
masks |
private int |
maxbits |
private int |
maxcode |
private int |
maxmaxcode |
private int |
nBits |
private Map<String,Object> |
params |
private int |
pass |
protected int[] |
red |
protected int |
transparentIndex |
Constructor and Description |
---|
GifEncoder() |
Modifier and Type | Method and Description |
---|---|
private void |
byteOut(byte c) |
private void |
clearBlock() |
private void |
clearHash(int hsize) |
protected void |
close() |
private void |
compress() |
private void |
createColorTable()
generates a 256-color or fewer color table consisting of a
set of red, green, blue arrays and a hash table pointing to a color index;
adapts to situations where more than 256 colors are present.
|
private Map<Integer,GifEncoder.AdaptiveColorCollection> |
finalizeColorMap(javajs.util.List<GifEncoder.ColorItem> colors,
Map<Integer,GifEncoder.AdaptiveColorCollection> colors256)
Create final color table red green blue arrays and generate final
colorHash.
|
protected void |
flushBytes() |
protected void |
generate() |
private Map<Integer,GifEncoder.AdaptiveColorCollection> |
getBest256(GifEncoder.ColorVector colorVector)
reduce GIF color collection to 256 or fewer by grouping shadings;
create an initial color hash that is only to the final colors.
|
private GifEncoder.ColorVector |
getColors()
Generate a list of all unique colors in the image.
|
private static int |
MAXCODE(int nBits) |
private int |
nextPixel() |
private void |
output(int code) |
private void |
putWord(int w) |
protected void |
setParams(Map<String,Object> params)
we allow for animated GIF by being able to re-enter
the code with different parameters held in params
|
private void |
updateY(int yNext,
int yNew)
Group 1 : Every 8th.
|
private void |
writeGraphicControlExtension() |
private void |
writeHeader()
includes logical screen descriptor
|
private void |
writeImage() |
private void |
writeNetscapeLoopExtension() |
private void |
writeTrailer() |
createImage, encodeImage, putByte, putString
private Map<Integer,GifEncoder.AdaptiveColorCollection> colorMap
protected int[] red
protected int[] green
protected int[] blue
private boolean interlaced
private boolean addHeader
private boolean addImage
private boolean addTrailer
private int delayTime100ths
private boolean looping
private int byteCount
private int bitsPerPixel
protected int transparentIndex
private int initCodeSize
private int curpt
private static final int EOF
private static final int[] INTERLACE_PARAMS
private static final int BITS
private static final int HSIZE
private int nBits
private int maxbits
private int maxcode
private int maxmaxcode
private int[] htab
private int[] codetab
private int hsize
private int freeEnt
private boolean clearFlag
private int clearCode
private int EOFCode
private int countDown
private int pass
private int curx
private int cury
private int curAccum
private int curBits
private int[] masks
private int bufPt
private final byte[] buf
protected void setParams(Map<String,Object> params)
setParams
in class ImageEncoder
protected void generate() throws IOException
generate
in class ImageEncoder
IOException
protected void close()
close
in class ImageEncoder
private void writeHeader() throws IOException
IOException
private void createColorTable()
private GifEncoder.ColorVector getColors()
private Map<Integer,GifEncoder.AdaptiveColorCollection> getBest256(GifEncoder.ColorVector colorVector)
colorVector
- private Map<Integer,GifEncoder.AdaptiveColorCollection> finalizeColorMap(javajs.util.List<GifEncoder.ColorItem> colors, Map<Integer,GifEncoder.AdaptiveColorCollection> colors256)
colors
- colors256
- private void writeGraphicControlExtension()
private void writeNetscapeLoopExtension()
private void writeImage()
private void writeTrailer()
private int nextPixel()
private void updateY(int yNext, int yNew)
yNext
- yNew
- private void putWord(int w)
private static final int MAXCODE(int nBits)
private void compress()
private void output(int code)
private void clearBlock()
private void clearHash(int hsize)
private void byteOut(byte c)
protected void flushBytes()