Android Programming Press on the image to return to the main documentation page.

GifDecoder

The GifDecoder library provides a GifDecoder object that provides the facility to
extract the individual frames and associated delay information from an animated GIF file.

No copyright is asserted on the source or object code of this library. It may be used for
any purpose, however, refer to the Unisys LZW patent for any additional restrictions.

The decoder was originally written as a component of a bigger application by Kevin Weiner of
FM Software using an LZW decoder adapted from John Cristy's ImageMagick. Performance greatly
improved, some bugs squashed, adapted for use with Basic4ppc and further translated into Java
for use in Basic4android applications by Andrew Graham.

List of types:

GifDecoder

GifDecoder

Processing larger animated GIFs with many frames can be a slow process on a device.
Also such files may occupy a large amount of memory as each individual frame is saved for
display as a bitmap when the GIF is loaded. Invoking Load will dispose of any existing frame
bitmaps. If it is required to keep any of those bitmaps they should be copied, not assigned,
into another bitmap.
This is an 'Activity Object', it cannot be declared under Sub Process_Globals.

Events:

None

Members:


  Delay (frame As Int) As Int

  DisposeFrames

  Frame (frame As Int) As android.graphics.Bitmap

  FrameCount As Int [read only]

  FrameHeight As Int [read only]

  FrameWidth As Int [read only]

  Load (dir As String, gifname As String)

  LoopCount As Int [read only]

  SaveFrame (frame As Int, dir As String, filename As String, format As String, quality As Int)

  Version As Double [read only]

Members description:

Delay (frame As Int) As Int
Returns the delay time, in milliseconds, for the frame number specified.
This time is the period for which the frame should be displayed before advancing
to the next frame.
DisposeFrames
Disposes of all the frame bitmaps of any presently loaded GIF file.
This may be necessary for memory management purposes on a device.
Frame (frame As Int) As android.graphics.Bitmap
Returns a Bitmap containing the specified frame.
FrameCount As Int [read only]
Returns the number of frames in the last GIF loaded.
FrameHeight As Int [read only]
Returns the height of each frame in the last GIF loaded.
FrameWidth As Int [read only]
Returns the width of each frame in the last GIF loaded.
Load (dir As String, gifname As String)
Loads the GIF from the pathname specified and decodes the individual frames.
LoopCount As Int [read only]
Returns the iteration count, if one was specified, in the last GIF loaded otherwise
it returns 1. The iteration count specifies how many times the animation should be displayed.
A count of 0 means repeat indefinitely.
SaveFrame (frame As Int, dir As String, filename As String, format As String, quality As Int)
Saves a frame to to the file and path specified in the format specified.
Note that a file extension is not automatically added and must be specified
as part of the filename. The file formats are "J" for jpg and "P" for png.
Anything else is saved as jpg. Quality is 0 to 100 and is only relevant for jpgs
0 meaning compress for small size, 100 meaning compress for max quality.
PNG which is lossless, will ignore the quality setting.
Version As Double [read only]
Returns the version number of the library.
Top