|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.lwuit.Image
public class Image
Abstracts the underlying platform images allowing us to treat them as a uniform
object.
In the DTV version of LWUIT, an image always wraps an instance of
java.awt.Image
. As a consequence, additional functionality has
been added in order to expose the wrapped java.awt.Image
instance
where necessary.
The access to the wrapped object is encouraged only if this is really necessary
in order to handle a specific LWUIT vs. AWT integration issue. It should not
be used for ordinary tasks.
Constructor Summary | |
---|---|
Image(Image image)
Creates a new instance of Image out of the
java.awt.Image to be wrapped. |
Method Summary | |
---|---|
static Image |
createImage(byte[] bytes,
int offset,
int len)
Creates an image from a given byte array data. |
static Image |
createImage(Image image)
Creates an image from the java.awt.Image to be wrapped. |
static Image |
createImage(InputStream stream)
Creates an image from an InputStream. |
static Image |
createImage(int[] rgb,
int width,
int height)
Creates an image from an RGB image. |
static Image |
createImage(int width,
int height)
Creates a buffered Image. |
static Image |
createImage(String path)
Creates an image from the given path. |
Image |
getAWTImage()
Obtains the java.awt.Image wrapped by this Image . |
Graphics |
getGraphics()
If this is a mutable image a graphics object allowing us to draw on it is returned. |
int |
getHeight()
Returns the height of the image. |
int[] |
getRGB()
Returns the content of this image as a newly created ARGB array. |
int |
getWidth()
Returns the width of the image. |
boolean |
isAnimation()
Returns true if this is an animated image. |
boolean |
isOpaque()
Indicates whether this image is opaque or not. |
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 |
modifyAlpha(byte alpha,
Color removeColor)
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)
Returns an instance of this image rotated by the given number of degrees. |
Image |
scaled(int width,
int height)
Returns a scaled version of this image using the given width and height, this is a fast algorithm that preserves translucent information. |
Image |
scaledHeight(int height)
Scales the image to the given height while updating the width based on the aspect ratio of the height. |
Image |
scaledSmallerRatio(int width,
int height)
Scales the image while maintaining the aspect ratio to the smaller size image. |
Image |
scaledWidth(int width)
Scales the image to the given width while updating the height based on the aspect ratio of the width. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Image(Image image)
Image
out of the
java.awt.Image
to be wrapped.
image
- thejava.awt.Image
to be wrappedMethod Detail |
---|
public Image subImage(int x, int y, int width, int height, boolean processAlpha)
x
- x coordinate of upper left cornery
- y coordinate of upper left cornerwidth
- the width of internal imagesheight
- the height of internal imagesprocessAlpha
- alphaComposite value
IOException
public Image rotate(int degrees)
E.g. rotating an image to 45, 90 and 135 degrees is inefficient. Use rotate to 45, 90 and then rotate the 45 to another 90 degrees to achieve the same effect with less memory.
degrees
- A degree in right angle must be larger than 0 and up to 359 degrees
public Image modifyAlpha(byte alpha)
alpha
- New value for the entire alpha channel
public Image modifyAlpha(byte alpha, Color removeColor)
alpha
- New value for the entire alpha channelremoveColor
- pixels matching this color are made transparent (alpha channel ignored)
public static Image createImage(String path) throws IOException
path
- path where to find image information
IOException
public static Image createImage(InputStream stream) throws IOException
stream
- a given InputStream
IOException
public static Image createImage(int[] rgb, int width, int height)
rgb
- the RGB image array datawidth
- the image widthheight
- the image height
public static Image createImage(int width, int height)
width
- the image widthheight
- the image height
public static Image createImage(byte[] bytes, int offset, int len)
bytes
- the array of image data in a supported image formatoffset
- the offset of the start of the data in the arraylen
- the length of the data in the array
public static Image createImage(Image image)
java.awt.Image
to be wrapped.
image
- the java.awt.Image
to be wrapped
Image
public Graphics getGraphics()
public int getWidth()
public int getHeight()
public int[] getRGB()
public Image scaledWidth(int width)
width
- the given new image width
public Image scaledHeight(int height)
height
- the given new image height
public Image scaledSmallerRatio(int width, int height)
width
- the given new image widthheight
- the given new image height
public Image scaled(int width, int height)
width
- width for the scalingheight
- height of the scaled image
public Image getAWTImage()
java.awt.Image
wrapped by this Image
.
java.awt.Image
public boolean isAnimation()
public boolean isOpaque()
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |