class GifEncoder extends AnyRef
Class AnimatedGifEncoder - Encodes a GIF file consisting of one or more frames.
Example:
AnimatedGifEncoder e = new AnimatedGifEncoder();
e.start(outputFileName);
e.setDelay(1000); // 1 frame per sec
e.addFrame(image1);
e.addFrame(image2);
e.finish();
No copyright asserted on the source code of this class. May be used for any purpose, however, refer to the Unisys LZW patent for restrictions on use of the associated LZWEncoder class. Please forward any corrections to kweiner@fmsware.com.
- Version
1.03 November 2003
- Alphabetic
- By Inheritance
- GifEncoder
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new GifEncoder()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addFrame(im: BufferedImage): Boolean
Adds next GIF frame.
Adds next GIF frame. The frame is not written immediately, but is actually deferred until the next frame is received so that timing data can be inserted. Invoking
finish()flushes all frames. IfsetSizewas not invoked, the size of the first image is used for all subsequent frames.- im
BufferedImage containing frame to write.
- returns
true if successful.
- def analyzePixels(): Unit
Analyzes image colors and creates color map.
Analyzes image colors and creates color map.
- Attributes
- protected[effect]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clearPalette(): Unit
Clears the color palette so it will be learned from each frame's pixel
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def findClosest(c: Color): Int
Returns index of palette color closest to c
Returns index of palette color closest to c
- Attributes
- protected[effect]
- def finish(): Boolean
Flushes any pending data and closes output file.
Flushes any pending data and closes output file. If writing to an OutputStream, the stream is not closed.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getImagePixels(): Unit
Extracts image pixels into byte array "pixels"
Extracts image pixels into byte array "pixels"
- Attributes
- protected[effect]
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def setDelay(ms: Int): Unit
Sets the delay time between each frame, or changes it for subsequent frames (applies to last frame added).
Sets the delay time between each frame, or changes it for subsequent frames (applies to last frame added).
- ms
int delay time in milliseconds
- def setDispose(code: Int): Unit
Sets the GIF frame disposal code for the last added frame and any subsequent frames.
Sets the GIF frame disposal code for the last added frame and any subsequent frames. Default is 0 if no transparent color has been set, otherwise 2.
- code
int disposal code.
- def setFrameRate(fps: Float): Unit
Sets frame rate in frames per second.
Sets frame rate in frames per second. Equivalent to
setDelay(1000/fps).- fps
float frame rate (frames per second)
- def setQuality(quality: Int): Unit
Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by the GIF specification).
Sets quality of color quantization (conversion of images to the maximum 256 colors allowed by the GIF specification). Lower values (minimum = 1) produce better colors, but slow processing significantly. 10 is the default, and produces good color mapping at reasonable speeds. Values greater than 20 do not yield significant improvements in speed.
- quality
int greater than 0.
- def setRepeat(iter: Int): Unit
Sets the number of times the set of GIF frames should be played.
Sets the number of times the set of GIF frames should be played. Default is 1; 0 means play indefinitely. Must be invoked before the first image is added.
- iter
int number of iterations.
- def setSize(w: Int, h: Int): Unit
Sets the GIF frame size.
Sets the GIF frame size. The default size is the size of the first frame added if this method is not invoked.
- w
int frame width.
- h
int frame width.
- def setTransparent(c: Color): Unit
Sets the transparent color for the last added frame and any subsequent frames.
Sets the transparent color for the last added frame and any subsequent frames. Since all colors are subject to modification in the quantization process, the color in the final palette for each frame closest to the given color becomes the transparent color for that frame. May be set to null to indicate no transparent color.
- c
Color to be treated as transparent on display.
- def start(file: String): Boolean
Initiates writing of a GIF file with the specified name.
Initiates writing of a GIF file with the specified name.
- file
String containing output file name.
- returns
false if open or initial write failed.
- def start(os: OutputStream): Boolean
Initiates GIF file creation on the given stream.
Initiates GIF file creation on the given stream. The stream is not closed automatically.
- os
OutputStream on which GIF images are written.
- returns
false if initial write failed.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def writeGraphicCtrlExt(): Unit
Writes Graphic Control Extension
Writes Graphic Control Extension
- Attributes
- protected[effect]
- def writeImageDesc(): Unit
Writes Image Descriptor
Writes Image Descriptor
- Attributes
- protected[effect]
- def writeLSD(): Unit
Writes Logical Screen Descriptor
Writes Logical Screen Descriptor
- Attributes
- protected[effect]
- def writeNetscapeExt(): Unit
Writes Netscape application extension to define repeat count.
Writes Netscape application extension to define repeat count.
- Attributes
- protected[effect]
- def writePalette(): Unit
Writes color table
Writes color table
- Attributes
- protected[effect]
- def writePixels(): Unit
Encodes and writes pixel data
Encodes and writes pixel data
- Attributes
- protected[effect]
- def writeShort(value: Int): Unit
Write 16-bit value to output stream, LSB first
Write 16-bit value to output stream, LSB first
- Attributes
- protected[effect]
- def writeString(s: String): Unit
Writes string to output stream
Writes string to output stream
- Attributes
- protected[effect]
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated