com.intel.ui
Class Image
- java.lang.Object
-
- com.intel.ui.Widget
-
- com.intel.ui.Image
-
public abstract class Image extends Widget
This abstract class represents a leafWidget
which is a Bitmap image with a given format to be drawn.
-
-
Field Summary
Fields Modifier and Type Field and Description static byte
FORMAT_RGB_24BPP
Standard RGB color format: bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red.static byte
FORMAT_RGB_32BPP
XRGB color format: bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved.
-
Method Summary
Methods Modifier and Type Method and Description void
addImageBlock(byte[] block, int offset, int length)
This method will allow the caller to add a chunk of the big image (received from host or remote server) into the internal system buffer.static Image
create(short id, XYPair size, XYPair relLocation, byte format)
Factory method for creating a concrete instance initialized with the specified parameters.static Image
create(short id, XYPair size, XYPair relLocation, byte format, byte[] imageData)
Factory method for creating a concrete instance initialized with the specified parameters.int
getColor()
This method is not supported for this widget type and will throwUiNotSupportedException
.byte
getFormat()
Returns the format of the imagebyte[]
getImage()
Returns the image buffer.void
releaseImage()
This method releases the internal system buffer that is used to store a large image object created by callingImage.create(short, XYPair, XYPair, byte)
method.-
Methods inherited from class com.intel.ui.Widget
getId, getRelativeLocation, getSize
-
-
-
-
Field Detail
-
FORMAT_RGB_32BPP
public static final byte FORMAT_RGB_32BPP
XRGB color format: bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved.- See Also:
- Constant Field Values
-
FORMAT_RGB_24BPP
public static final byte FORMAT_RGB_24BPP
Standard RGB color format: bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static final Image create(short id, XYPair size, XYPair relLocation, byte format, byte[] imageData) throws UiException
Factory method for creating a concrete instance initialized with the specified parameters.- Parameters:
id
- An ID representing thisWidget
for quick reference by the calling application. The ID does not have to be unique and is not used internally by the package.size
- The size of theWidget
relLocation
- The relative location from the parentWidget
format
- TheImage
formatimageData
- A buffer representing theImage
in the specified format. Data is not duplicated.- Returns:
Image
instance- Throws:
UiIllegalParameterException
- in one of the following cases:- Image size is negative.
- Image location is negative.
- Image size exceeds upper bound
Widget.MAX_WIDTH
and/orWidget.MAX_HEIGHT
. - Image location exceeds upper bound
Widget.MAX_WIDTH
and/orWidget.MAX_HEIGHT
. - The provided image format is not supported.
-
imageData
size does not match the dimensions provided insize
parameter.
UiException
-
create
public static final Image create(short id, XYPair size, XYPair relLocation, byte format) throws UiException
Factory method for creating a concrete instance initialized with the specified parameters. An instance created by this method represents anImage
object for large images. A large image is a single object in the system, therefore, this method cannot be called more than once without the image being released in between. In addition, it can also fail, if a large image object is already in use by another application. This method does not receive a buffer with image data as parameter. In order to provide the image data, the data should be split into smaller chunks and each chunk should be updated using theImage.addImageBlock()
method.- Note:
- Once the large image object is added to the dialog and the dialog is rendered, the image data is released and no specific release operation is needed.
- Once the large image object is added to the dialog, it will always be at the bottom layer of the dialog, regardless of the sequence in which the widgets were added to the dialog. This means that all other dialog's widgets are drawn on top of this image.
- Parameters:
id
- An ID representing thisWidget
size
- The size of theWidget
relLocation
- The relative location from the parentWidget
format
- TheImage
format- Returns:
Image
instance- Throws:
OutOfResourcesException
- if the image size is too big and no system resources are available to maintain this image.UiIllegalUseException
- if a large image object is already allocated in the system (by this or other application).UiIllegalParameterException
- in one of the following cases:- Image size is negative.
- Image location is negative.
- Image Size exceeds upper bound
Widget.MAX_WIDTH
and/orWidget.MAX_HEIGHT
. - Image Location exceeds upper bound
Widget.MAX_WIDTH
and/orWidget.MAX_HEIGHT
. - The provided image format is not supported.
UiException
-
releaseImage
public void releaseImage() throws UiException
This method releases the internal system buffer that is used to store a large image object created by callingImage.create(short, XYPair, XYPair, byte)
method. After using this method, thisImage
instance becomes invalid.- Throws:
UiIllegalUseException
- in one of the following cases:- The internal system buffer has already been released (by calling this method, or rendering the dialog that contains this image).
- This instance was not created by calling the
Image.create(short, XYPair, XYPair, byte)
method.
UiException
-
addImageBlock
public void addImageBlock(byte[] block, int offset, int length)
This method will allow the caller to add a chunk of the big image (received from host or remote server) into the internal system buffer. The chunk can be of any size, and will be copied subsequently after the previous provided chunk. The current offset in the internal buffer is maintained by the system.- Parameters:
block
- Image chunk to append to the internal bufferoffset
- Offset inside the block data arraylength
- Length of the block data- Throws:
UiIllegalUseException
- if this image instance was not created by calling theImage.create(short, XYPair, XYPair, byte)
method, or the internal buffer used to store the image data has already been released.UiIllegalParameterException
- in one of the following cases:- Block size is negative.
- Offset is not valid.
- Length is not valid.
-
getFormat
public byte getFormat()
Returns the format of the image- Returns:
- Returns the format of the image
-
getImage
public byte[] getImage()
Returns the image buffer.- Returns:
- Returns the image buffer. Data is not duplicated.
- Throws:
UiIllegalUseException
- if this instance was created by calling theImage.create(short, XYPair, XYPair, byte)
method.
-
getColor
public int getColor()
This method is not supported for this widget type and will throwUiNotSupportedException
.- Overrides:
getColor
in classWidget
- Returns:
- Returns the RGB color of the widget (bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved).
- Throws:
UiNotSupportedException
- always.
-
-