public interface GifDecoder
Modifier and Type | Interface and Description |
---|---|
static interface |
GifDecoder.BitmapProvider
|
static interface |
GifDecoder.GifDecodeStatus
Android Lint annotation for status codes that can be used with a GIF decoder.
|
Modifier and Type | Field and Description |
---|---|
static int |
STATUS_FORMAT_ERROR
File read status: Error decoding file (may be partially decoded).
|
static int |
STATUS_OK
File read status: No errors.
|
static int |
STATUS_OPEN_ERROR
File read status: Unable to open source.
|
static int |
STATUS_PARTIAL_DECODE
Unable to fully decode the current frame.
|
static int |
TOTAL_ITERATION_COUNT_FOREVER
The total iteration count which means repeat forever.
|
Modifier and Type | Method and Description |
---|---|
void |
advance()
Move the animation frame counter forward.
|
void |
clear() |
int |
getByteSize()
Returns an estimated byte size for this decoder based on the data provided to
setData(GifHeader, byte[]) , as well as internal buffers. |
int |
getCurrentFrameIndex()
Gets the current index of the animation frame, or -1 if animation hasn't not yet started.
|
ByteBuffer |
getData() |
int |
getDelay(int n)
Gets display duration for specified frame.
|
int |
getFrameCount()
Gets the number of frames read from file.
|
int |
getHeight() |
int |
getLoopCount()
Deprecated.
Use
getNetscapeLoopCount() instead.
This method cannot distinguish whether the loop count is 1 or doesn't exist. |
int |
getNetscapeLoopCount()
Gets the "Netscape" loop count, if any.
|
int |
getNextDelay()
Gets display duration for the upcoming frame in ms.
|
Bitmap |
getNextFrame()
Get the next frame in the animation sequence.
|
int |
getStatus()
Returns the current status of the decoder.
|
int |
getTotalIterationCount()
Gets the total count
which represents how many times the animation sequence should be displayed.
|
int |
getWidth() |
int |
read(byte[] data)
Reads GIF image from byte array.
|
int |
read(InputStream is,
int contentLength)
Reads GIF image from stream.
|
void |
resetFrameIndex()
Resets the frame pointer to before the 0th frame, as if we'd never used this decoder to
decode any frames.
|
void |
setData(GifHeader header,
byte[] data) |
void |
setData(GifHeader header,
ByteBuffer buffer) |
void |
setData(GifHeader header,
ByteBuffer buffer,
int sampleSize) |
static final int STATUS_OK
static final int STATUS_FORMAT_ERROR
static final int STATUS_OPEN_ERROR
static final int STATUS_PARTIAL_DECODE
static final int TOTAL_ITERATION_COUNT_FOREVER
int getWidth()
int getHeight()
ByteBuffer getData()
int getStatus()
Status will update per frame to allow the caller to tell whether or not the current frame was decoded successfully and/or completely. Format and open failures persist across frames.
void advance()
int getDelay(int n)
n
- int index of frame.int getNextDelay()
int getFrameCount()
int getCurrentFrameIndex()
void resetFrameIndex()
@Deprecated int getLoopCount()
getNetscapeLoopCount()
instead.
This method cannot distinguish whether the loop count is 1 or doesn't exist.int getNetscapeLoopCount()
GifHeader.NETSCAPE_LOOP_COUNT_FOREVER
) means repeat indefinitely.
It must not be a negative value.
getTotalIterationCount()
to know how many times the animation sequence should be displayed.GifHeader.NETSCAPE_LOOP_COUNT_DOES_NOT_EXIST
).int getTotalIterationCount()
TOTAL_ITERATION_COUNT_FOREVER
) means repeat indefinitely.
It must not be a negative value.
The total count is calculated as follows by using getNetscapeLoopCount()
.
This behavior is the same as most web browsers.
getNetscapeLoopCount() |
The total count |
---|---|
GifHeader.NETSCAPE_LOOP_COUNT_FOREVER |
TOTAL_ITERATION_COUNT_FOREVER |
GifHeader.NETSCAPE_LOOP_COUNT_DOES_NOT_EXIST |
1 |
n (n > 0) |
n + 1 |
int getByteSize()
setData(GifHeader, byte[])
, as well as internal buffers.Bitmap getNextFrame()
int read(InputStream is, int contentLength)
is
- containing GIF file.void clear()
void setData(GifHeader header, byte[] data)
void setData(GifHeader header, ByteBuffer buffer)
void setData(GifHeader header, ByteBuffer buffer, int sampleSize)
int read(byte[] data)
data
- containing GIF file.