|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.lcdui.Image
public class Image
Provides support for in memory images. The format of the bitmap is in standard leJOS format (so aligned for use on NXT LCD display). There is one bit per pixel. The pixels are packed into bytes with each byte spanning 8 scan lines. The least significant bit of each byte is the pixel for the top most scan line, the most significant bit is the 8th scan line. Values of 1 represent black. 0 white. This class implements a sub set of the standard lcdui Image class. Only mutable images are supported and the ARGB methods are not available.
Constructor Summary | |
---|---|
Image(int width,
int height,
byte[] data)
Create an image using an already existing byte array. |
Method Summary | |
---|---|
static Image |
createImage(Image image,
int x,
int y,
int w,
int h,
int transform)
Creates a new image based upon the transformed region of another image |
static Image |
createImage(InputStream s)
Read image from file. |
static Image |
createImage(int width,
int height)
Create ablank image of the requested size. |
byte[] |
getData()
Return the byte array used to hold the image data. |
Graphics |
getGraphics()
Returns a graphics object that can be used to draw to the image. |
int |
getHeight()
return the height of the image. |
int |
getWidth()
Return the width of the image. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Image(int width, int height, byte[] data)
width
- width of the imageheight
- height of the imagedata
- The byte array to be used for image store/Method Detail |
---|
public static Image createImage(int width, int height)
width
- height
-
public static Image createImage(InputStream s) throws IOException
1st byte - 4th byte | 5th byte - 8th byte | 9th byte | 10th byte .... |
---|---|---|---|
image-width (int) | image-height (int) | 0x00 (image data delimit) |
byte image data.... |
For example:
After a file with contentwidth (int) | height (int) | delimit | byte data | ||
---|---|---|---|---|---|
00 00 00 03 | 00 00 00 05 | 00 | 00 | 02 | 1f |
new Image(3, 5, new byte[] {(byte)0x00, (byte)0x02, (byte)0x1f})
s
- The input stream for the image file.
IOException
- if an input or output error occurs or file format is not correct.Image
,
Image(int, int, byte[])
public static Image createImage(Image image, int x, int y, int w, int h, int transform)
image
- Source imagex
- x co-ordinate of the source regiony
- y co-ordinate of the source regionw
- width of the source regionh
- height of the source regiontransform
- Transform to be applied
#see game.Sprite
public int getWidth()
public int getHeight()
public byte[] getData()
public Graphics getGraphics()
Graphics
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |