public class RGBImage extends Image
The first use case allows us to manipulate images in a custom way while still preserving alpha information where applicable.
The second use case allows us to store images in the Java heap which is useful for some constrained devices. In small devices images are often stored in a separate "heap" which runs out eventually, this allows us to place the image in the Java heap which is potentially more wasteful but might sometimes be more abundant.
Note that unless specified otherwise most methods inherited from Image will fail when invoked on this subclass often with a NullPointerException. This image can be drawn on graphics as usual
shownWarningForTooSmallBackgroundImage
Modifier | Constructor and Description |
---|---|
|
RGBImage(Image img)
Converts an image to an RGB image after which the original image can be GC'd
|
|
RGBImage(int[] rgb,
int width,
int height)
Creates an RGB image from scratch the array isn't copied and can be saved
and manipulated
|
protected |
RGBImage(RGBImage img,
Void v) |
Modifier and Type | Method and Description |
---|---|
protected void |
drawImage(Graphics g,
Object nativeGraphics,
int x,
int y)
Callback invoked internally by LWUIT to draw the image/frame onto the display.
|
Graphics |
getGraphics()
This method is unsupported in this image type
|
int |
getHeight()
Returns the height of the image
|
int[] |
getRGB()
Returns a mutable array that can be used to change the appearance of the image
arranged as AARRGGBB.
|
protected void |
getRGB(int[] rgbData,
int offset,
int scanWidth,
int x,
int y,
int width,
int height)
Obtains ARGB pixel data from the specified region of this image and
stores it in the provided array of integers.
|
int |
getWidth()
Returns the width of the image
|
boolean |
isOpaque()
Indicates if an image should be treated as opaque, this can improve support
for fast drawing of RGB images without alpha support.
|
Image |
modifyAlpha(byte alpha)
Creates a new image instance with the alpha channel of opaque/translucent
pixels within the image using the new alpha value.
|
Image |
rotate(int degrees)
Unsupported in the current version, this method will be implemented in a future release
|
void |
scale(int width,
int height)
Scale the image to the given width and height, this is a fast algorithm
that preserves translucent information
|
void |
setOpaque(boolean opaque) |
Image |
subImage(int x,
int y,
int width,
int height,
boolean processAlpha)
Extracts a subimage from the given image allowing us to breakdown a single large image
into multiple smaller images in RAM, this actually creates a standalone version
of the image for use.
|
protected void |
tileRect(Graphics g,
Object nativeGraphics,
int x,
int y,
int rect_width,
int rect_height)
Callback invoked internally by LWUIT to draw tiles over the image/frame
onto the display.
|
animate, applyMask, applyMask, createImage, createImage, createImage, createImage, createImage, createImage, createImage, createIndexed, createMask, createSVG, getImage, getRGBCached, getSVGDocument, isAlphaMutableImageSupported, isAnimation, isSVG, isSVGSupported, modifyAlpha, modifyAlphaWithTranslucency, scaled, scaledHeight, scaledSmallerRatio, scaledWidth, toRGB
public RGBImage(Image img)
img
- the image to convert to an RGB imagepublic RGBImage(int[] rgb, int width, int height)
rgb
- AARRGGBB arraywidth
- width of imageheight
- height of imagepublic Image subImage(int x, int y, int width, int height, boolean processAlpha)
Image
subImage
in class Image
x
- the x offset from the imagey
- the y offset from the imagewidth
- the width of internal imagesheight
- the height of internal imagesprocessAlpha
- whether alpha should be processed as well as part of the cuttingpublic void scale(int width, int height)
Image
public Image rotate(int degrees)
public Image modifyAlpha(byte alpha)
Image
modifyAlpha
in class Image
alpha
- New value for the entire alpha channelpublic Graphics getGraphics()
getGraphics
in class Image
public int[] getRGB()
protected void getRGB(int[] rgbData, int offset, int scanWidth, int x, int y, int width, int height)
Image
getRGB
in class Image
rgbData
- an array of integers in which the ARGB pixel data is
storedoffset
- the index into the array where the first ARGB value is
storedx
- the x-coordinate of the upper left corner of the regiony
- the y-coordinate of the upper left corner of the regionwidth
- the width of the regionheight
- the height of the regionprotected void drawImage(Graphics g, Object nativeGraphics, int x, int y)
Image
protected void tileRect(Graphics g, Object nativeGraphics, int x, int y, int rect_width, int rect_height)
Image
public void setOpaque(boolean opaque)
public boolean isOpaque()
public int getWidth()
Image