net.rim.device.api.system
Class GIFEncodedImage

java.lang.Object
  extended by net.rim.device.api.system.EncodedImage
      extended by net.rim.device.api.system.GIFEncodedImage

public final class GIFEncodedImage
extends EncodedImage

Represents an image encoded in the GIF format.

To create a GIFEncodedImage instance, use EncodedImage.createEncodedImage(byte[],int,int), which accepts a java byte array containing the encoding of an image.

An image encoding can be obtained by either of the following methods:

First, when an image is added to a project in the IDE, the image resource becomes available to the developer.

Second, the image encoding can be obtained manually by converting the binary image file to a java byte array. This is accomplished using the following procedure:

  1. Using a binary file converter, such as xxd, convert the image to a C-style byte array.
  2. Open the target file and search for the string "0x".
  3. Replace the string with the following "(byte)0x".
  4. Adjust the array declaration at the top of the file to conform to Java standards.
  5. Remove the following string from the bottom of the file "unsigned int input_file_name_len = XXXX".

If done correctly, the file will contain a valid java byte array containing the image encoding.

Since:
BlackBerry API 4.2.0

Field Summary
static int TRANSITION_COMBINE
          Represents the frame transition, combine.
static int TRANSITION_DEFAULT
          Represents the default transition.
static int TRANSITION_REPLACE
          Represents the frame transition, replace.
static int TRANSITION_RESTORE_TO_PREVIOUS
          Represents the frame transition, restore to previous.
 
Fields inherited from class net.rim.device.api.system.EncodedImage
DECODE_ALPHA, DECODE_NATIVE, DECODE_NO_DITHER, DECODE_READONLY, IMAGE_TYPE_BMP, IMAGE_TYPE_GIF, IMAGE_TYPE_ICO, IMAGE_TYPE_JPEG, IMAGE_TYPE_PNG, IMAGE_TYPE_TIFF, IMAGE_TYPE_WBMP
 
Method Summary
 int getAlphaType(int frameIndex)
          Retrieves alpha-channel type of a frame by index.
 int getBackgroundColor()
          Retrieves an image's background color.
 int getBitmapType(int frameIndex)
          Retrieves bitmap type of a frame by index.
 int getFrameDelay(int frameIndex)
          Retrieves the frame delay for a frame by index.
 int getFrameLeft(int frameIndex)
          Retrieves left edge of frame by index.
 int getFrameNumColors(int frameIndex)
          Retrieves the number of unique colors in a frame by index.
 int getFrameTop(int frameIndex)
          Retrieves top edge of frame by index.
 int getFrameTransition(int frameIndex)
          Retrieves the frame transition time by index.
 int getIterations()
          Retrieves the number of iterations specified for an animation.
 String getMIMEType()
          Return the commonly known MIME type associate for this encoded image object.
 int getScaledFrameLeft(int frameIndex)
          Retrieves left edge of scaled frame by index.
 int getScaledFrameTop(int frameIndex)
          Retrieves top edge of scaled frame by index.
 boolean isBackgroundTransparent()
          Determines if this image has a transparent background.
 
Methods inherited from class net.rim.device.api.system.EncodedImage
createEncodedImage, createEncodedImage, getBitmap, getBitmap, getData, getDecodeMode, getEncodedImageResource, getEncodedImageResource, getFrameCount, getFrameHeight, getFrameMonochrome, getFrameTransparency, getFrameWidth, getHeight, getImageHeight, getImageType, getImageWidth, getLength, getMetaData, getOffset, getScale, getScaleX32, getScaleY32, getScaledFrameHeight, getScaledFrameWidth, getScaledHeight, getScaledHeight, getScaledWidth, getScaledWidth, getSupportedMIMETypes, getWidth, hasTransparency, isAnimated, isMIMETypeSupported, isMonochrome, scaleImage32, setDecodeMode, setScale
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

TRANSITION_DEFAULT

public static final int TRANSITION_DEFAULT
Represents the default transition.

See Also:
Constant Field Values
Since:
BlackBerry API 4.2.0

TRANSITION_COMBINE

public static final int TRANSITION_COMBINE
Represents the frame transition, combine.

See Also:
Constant Field Values
Since:
BlackBerry API 4.2.0

TRANSITION_REPLACE

public static final int TRANSITION_REPLACE
Represents the frame transition, replace.

See Also:
Constant Field Values
Since:
BlackBerry API 4.2.0

TRANSITION_RESTORE_TO_PREVIOUS

public static final int TRANSITION_RESTORE_TO_PREVIOUS
Represents the frame transition, restore to previous.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0


Method Detail

getBackgroundColor

public int getBackgroundColor()
Retrieves an image's background color.

Returns:
Background color value (hexadecimal).
Since:
BlackBerry API 4.2.0

getIterations

public int getIterations()
Retrieves the number of iterations specified for an animation.

Returns:
The count of times to repeat the animation. 0 means to repeat forever. A value of n means to play the animation n times.
Since:
BlackBerry API 4.2.0

getFrameLeft

public int getFrameLeft(int frameIndex)
Retrieves left edge of frame by index.

Parameters:
frameIndex - Index of frame for which to retrieve the left edge.
Returns:
Offset from left edge of GIF's frame boundary for the frame at your provided index.
Since:
BlackBerry API 4.2.0

getFrameTop

public int getFrameTop(int frameIndex)
Retrieves top edge of frame by index.

Parameters:
frameIndex - Index of frame for which to retrieve the top edge.
Returns:
Offset from top edge of GIF's frame boundary for the frame at your provided index.
Since:
BlackBerry API 4.2.0

getScaledFrameLeft

public int getScaledFrameLeft(int frameIndex)
Retrieves left edge of scaled frame by index.

Use this method to retrieve the left edge of a frame, if this image is scaled.

Parameters:
frameIndex - Index of frame for which to retrieve the left edge.
Returns:
Offset from left edge of scaled GIF's frame boundary for the frame at your provided index.
Since:
BlackBerry API 4.2.0

getScaledFrameTop

public int getScaledFrameTop(int frameIndex)
Retrieves top edge of scaled frame by index.

Use this method to retrieve the top edge of a frame, if this image is scaled.

Parameters:
frameIndex - Index of frame for which to retrieve the top edge.
Returns:
Offset from left edge of scaled GIF's frame boundary for the frame at your provided index.
Since:
BlackBerry API 4.2.0

getFrameDelay

public int getFrameDelay(int frameIndex)
Retrieves the frame delay for a frame by index.

Use this method to retrieve the delay (that is, "onscreen display time") for a frame by index in 100ths of a second.

Parameters:
frameIndex - Index of frame for which to retrieve the delay.
Returns:
Frame delay 100ths of a second for the frame at your provided index.
Since:
BlackBerry API 4.2.0

getFrameTransition

public int getFrameTransition(int frameIndex)
Retrieves the frame transition time by index.

Use this method to retrieve the transition time (the time to elapse after displaying this frame, before moving to the next frame).

Parameters:
frameIndex - Index of frame for which to retrieve the transition time.
Returns:
Frame transition time for the frame at your provided index.
Since:
BlackBerry API 4.2.0

getFrameNumColors

public int getFrameNumColors(int frameIndex)
Retrieves the number of unique colors in a frame by index.

Parameters:
frameIndex - Index of frame for which to retrieve the number of unique contained colors.
Returns:
Number of unique colors contained in the frame at your provided index.
Since:
BlackBerry API 4.2.0

isBackgroundTransparent

public boolean isBackgroundTransparent()
Determines if this image has a transparent background.

Returns:
True if this image has a transparent background; otherwise, false.
Since:
BlackBerry API 4.2.0

getBitmapType

public int getBitmapType(int frameIndex)
Retrieves bitmap type of a frame by index.

Specified by:
getBitmapType in class EncodedImage
Parameters:
frameIndex - Index of frame to examine.
Returns:
Value indicating type of bitmap contained in frame.
See Also:
Bitmap
Since:
BlackBerry API 4.2.0

getAlphaType

public int getAlphaType(int frameIndex)
Retrieves alpha-channel type of a frame by index.

Specified by:
getAlphaType in class EncodedImage
Parameters:
frameIndex - Index of frame to examine.
Returns:
Value indicating type of alpha-channel contained in frame.
See Also:
Bitmap
Since:
BlackBerry API 4.2.0

getMIMEType

public String getMIMEType()
Return the commonly known MIME type associate for this encoded image object.

Specified by:
getMIMEType in class EncodedImage
Returns:
A String representing the MIME type generally associated with this object.
Since:
BlackBerry API 4.2.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.