SHOW Colour SHOW Framework

net.rim.device.api.system
Class JPEGEncodedImage

java.lang.Object
  |
  +--net.rim.device.api.system.EncodedImage
        |
        +--net.rim.device.api.system.JPEGEncodedImage

public final class JPEGEncodedImage
extends EncodedImage

Represents an image encoded in the JPEG format.

To create a JPEGEncodedImage instance, use the EncodedImage.createEncodedImage(byte[],int,int) method. The createEncodedImage method 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.

Category:
Colour: This call is only applicable on colour devices.

Since:
JDE 3.7.0
See Also:
EncodedImage

Field Summary
 Category: Colour static int FILETYPE_EXIF
          Constant indicating the EXIF file type.
 Category: Colour static int FILETYPE_JFIF
          Constant indicating the JFIF file type.
 Category: Colour static int FILETYPE_SPIFF
          Constant indicating the SPIFF file type.
 Category: Colour static int FILETYPE_UNKNOWN
          Constant indicating an unknown file type.
 Category: Colour static int FRAMETYPE_BASELINE
          Constant indicating the baseline jpeg mode.
 Category: Colour static int FRAMETYPE_PROGRESSIVE
          Constant indicating the progressive jpg mode.
 Category: Colour static int FRAMETYPE_SEQUENTIAL
          Constnat indicating the sequential jpeg mode .
 
Fields inherited from class net.rim.device.api.system.EncodedImage
DECODE_ALPHA, DECODE_NATIVE, DECODE_NO_DITHER, DECODE_READONLY, IMAGE_TYPE_BMP, IMAGE_TYPE_JPEG, IMAGE_TYPE_PNG, IMAGE_TYPE_TIFF, IMAGE_TYPE_WBMP
 
Method Summary
 Category: Colour  int getAlphaType(int frameIndex)
          Returns the Alpha type.
 Category: Colour  int getBitmapType(int frameIndex)
          Returns the default bitmap type of the given frame.
 Category: Colour  int getFileType()
          Returns an integer representing the file type.
 Category: Colour  int getFrameType()
          Returns an integer representing the frame type.
 Category: Colour  boolean isColor()
          Returns a boolean indicating whether or not the jpeg is color.
 Category: Colour static boolean isJPEGSupported()
           
 
Methods inherited from class net.rim.device.api.system.EncodedImage
createEncodedImage, createEncodedImage, getBitmap, getBitmap, getData, getDecodeMode, getFrameCount, getFrameHeight, getFrameMonochrome, getFrameTransparency, getFrameWidth, getHeight, getImageType, getLength, getOffset, getScale, getScaledFrameHeight, getScaledFrameWidth, getScaledHeight, getScaledWidth, getSupportedMIMETypes, getWidth, hasTransparency, isMonochrome, setDecodeMode, setScale
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILETYPE_UNKNOWN

public static final int FILETYPE_UNKNOWN
Constant indicating an unknown file type.
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.

FILETYPE_JFIF

public static final int FILETYPE_JFIF
Constant indicating the JFIF file type.
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.

FILETYPE_EXIF

public static final int FILETYPE_EXIF
Constant indicating the EXIF file type.
Since:
JDE 4.0.0
Category:
Colour: This call is only applicable on colour devices.

FILETYPE_SPIFF

public static final int FILETYPE_SPIFF
Constant indicating the SPIFF file type.
Since:
JDE 4.0.0
Category:
Colour: This call is only applicable on colour devices.

FRAMETYPE_BASELINE

public static final int FRAMETYPE_BASELINE
Constant indicating the baseline jpeg mode.
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.

FRAMETYPE_SEQUENTIAL

public static final int FRAMETYPE_SEQUENTIAL
Constnat indicating the sequential jpeg mode .
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.

FRAMETYPE_PROGRESSIVE

public static final int FRAMETYPE_PROGRESSIVE
Constant indicating the progressive jpg mode.
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.
Method Detail

isColor

public boolean isColor()
Returns a boolean indicating whether or not the jpeg is color.

Returns:
true if the jpeg is color, false otherwise.
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.

getFileType

public int getFileType()
Returns an integer representing the file type.

One of FILETYPE_UNKNOWN, FILETYPE_JFIF.

Returns:
An integer representing the file type.
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.

getFrameType

public int getFrameType()
Returns an integer representing the frame type.

One of FRAMETYPE_BASELINE, FRAMETYPE_SEQUENTIAL, FRAMETYPE_PROGRESSIVE.

Returns:
An integer representing the file type.
Since:
JDE 3.7.0
Category:
Colour: This call is only applicable on colour devices.

getBitmapType

public int getBitmapType(int frameIndex)
Returns the default bitmap type of the given frame.

Overrides:
getBitmapType in class EncodedImage
Parameters:
frameIndex - The index of the frame for which to return the type.
Returns:
An integer representing the type.
Since:
JDE 4.0.2
Category:
Colour: This call is only applicable on colour devices.

getAlphaType

public int getAlphaType(int frameIndex)
Returns the Alpha type.

Note that since JPGs never have alpha channels, this method will always return 0.

Overrides:
getAlphaType in class EncodedImage
Parameters:
frameIndex - The index of the frame.
Returns:
Returns 0, since JPGs don't have alpha channel support.
Since:
JDE 4.0.2
Category:
Colour: This call is only applicable on colour devices.

isJPEGSupported

public static final boolean isJPEGSupported()
Since:
JDE 4.0.2
Category:
Colour: This call is only applicable on colour devices.


Copyright 1999-2004 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.