Hierarchy

  • GIFEncoder

Index

Properties

closeStream

closeStream: boolean = false

colorDepth

colorDepth: any

colorTab

colorTab: any

comment

comment: string = ""

delay

delay: number = 0

dispose

dispose: number = -1

exports

exports: object

Type declaration

firstFrame

firstFrame: boolean = true

height

height: any

image

image: any

indexedPixels

indexedPixels: any

out

out: any

palSize

palSize: number = 7

pixels

pixels: any

repeat

repeat: number = -1

sample

sample: number = 10

sizeSet

sizeSet: boolean = false

started

started: boolean = false

transIndex

transIndex: any

transparent

transparent: any = null

usedEntry

usedEntry: any[] = []

width

width: any

Methods

WriteShort

  • WriteShort(pValue: any): void
  • Parameters

    • pValue: any

    Returns void

addFrame

  • addFrame(im: any, is_imageData: any): boolean
  • The addFrame method takes an incoming BitmapData object to create each frames

    Parameters

    • im: any
    • is_imageData: any

    Returns boolean

analyzePixels

  • analyzePixels(): void
  • Analyzes image colors and creates color map.

    Returns void

cont

  • cont(): boolean
  • Returns boolean

download

  • download(filename: any): void
  • description:

    Downloads the encoded gif with the given name No need of any conversion from the stream data (out) to base64 Solves the issue of large file sizes when there are more frames and does not involve in creation of any temporary data in the process so no wastage of memory, and speeds up the process of downloading to just calling this function.

    parameter

    {String} filename filename used for downloading the gif

    Parameters

    • filename: any

    Returns void

findClosest

  • findClosest(c: any): number
  • Returns index of palette color closest to c

    Parameters

    • c: any

    Returns number

finish

  • finish(): boolean
  • Adds final trailer to the GIF stream, if you don't call the finish method the GIF stream will not be valid.

    Returns boolean

getImagePixels

  • getImagePixels(): void
  • Extracts image pixels into byte array "pixels

    Returns void

reset

  • reset(): void
  • Resets some members so that a new stream can be started. This method is actually called by the start method

    Returns void

setComment

  • setComment(c: any): void
  • Sets the comment for the block comment

    Parameters

    • c: any

    Returns void

setDelay

  • setDelay(ms: any): void
  • Sets the delay time between each frame, or changes it for subsequent frames (applies to last frame added) int delay time in milliseconds

    Parameters

    • ms: any

    Returns void

setDispose

  • setDispose(code: any): void
  • 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.

    Parameters

    • code: any

      int disposal code.

    Returns void

setFrameRate

  • setFrameRate(fps: any): void
    • Sets frame rate in frames per second. Equivalent to setDelay(1000/fps).

    Parameters

    • fps: any

      float frame rate (frames per second)

    Returns void

setProperties

  • setProperties(has_start: any, is_first: any): void
  • Parameters

    • has_start: any
    • is_first: any

    Returns void

setQuality

  • setQuality(quality: any): void
  • 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.

    Parameters

    • quality: any

      int greater than 0.

    Returns void

setRepeat

  • setRepeat(iter: any): void
  • 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.

    Parameters

    • iter: any

      int number of iterations.

    Returns void

setSize

  • setSize(w: any, h: any): void
  • Sets the GIF frame size. The default size is the size of the first frame added if this method is not invoked.

    Parameters

    • w: any

      int frame width.

    • h: any

      int frame width.

    Returns void

setTransparent

  • setTransparent(c: any): void
  • 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.

    Parameters

    • c: any

    Returns void

start

  • start(): boolean
  • Initiates GIF file creation on the given stream.

    Returns boolean

    false if initial write failed.

stream

  • stream(): any
  • Retrieves the GIF stream

    Returns any

writeCommentExt

  • writeCommentExt(): void
  • Writes Comment Extention

    Returns void

writeGraphicCtrlExt

  • writeGraphicCtrlExt(): void
  • Writes Graphic Control Extension

    Returns void

writeImageDesc

  • writeImageDesc(): void
  • Writes Image Descriptor

    Returns void

writeLSD

  • writeLSD(): void
  • Writes Logical Screen Descriptor

    Returns void

writeNetscapeExt

  • writeNetscapeExt(): void
  • Writes Netscape application extension to define repeat count.

    Returns void

writePalette

  • writePalette(): void
  • Writes color table

    Returns void

writePixels

  • writePixels(): void
  • Encodes and writes pixel data

    Returns void

Generated using TypeDoc