|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nokia.mid.ui.DirectUtils
public class DirectUtils
This class contains utility methods for converting standard lcdui classes to Nokia UI classes and vice versa, and a method for creating images that are empty with pixels either transparent or colored, and creating mutable images from encoded image byte arrays. There is also a method for getting a Font with requested size.
javax.microedition.lcdui.Graphics
,
DirectGraphics
,
javax.microedition.lcdui.Canvas
,
FullCanvas
Method Summary | |
---|---|
static Image |
createImage(byte[] imageData,
int imageOffset,
int imageLength)
Creates a mutable image that is decoded from the data stored in the specified byte array at the specified offset and length. |
static Image |
createImage(int width,
int height,
int ARGBcolor)
The method returns a newly created mutable Image with the specified dimension and all the pixels of the image defined by the specified ARGB color. |
static DirectGraphics |
getDirectGraphics(Graphics g)
Converts standard javax.microedition.lcdui.Graphics to DirectGraphics. |
static Font |
getFont(int face,
int style,
int height)
The method returns new instance of javax.microedition.lcdui.Font
with custom font height. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static DirectGraphics getDirectGraphics(Graphics g)
Note that even though the graphics context that the DirectGraphics and Graphics refer to is the same, the object reference returned from this method may or may not be equal compared to the Graphics reference passed to this method. This means that purely casting Graphics object (g) passed in paint method of lcdui Canvas to DirectGraphics may not work ok. The safest way is to always do the conversion with this method.
g
- Graphics object for which DirectGraphics should be returned
public static Image createImage(byte[] imageData, int imageOffset, int imageLength)
Note that the semantics of this method are exactly the same
as
javax.microedition.lcdui.Image#createImage(byte[],int,int)
except that the returned image is mutable.
imageData
- the array of image data in a supported image formatimageOffset
- the offset of the start of the data in the arrayimageLength
- the length of the data in the array
java.lang.ArrayIndexOutOfBoundsException
- if imageOffset and
imageLength specify an invalid range
java.lang.NullPointerException
- if imageData is null
java.lang.IllegalArgumentException
- if imageData is incorrectly
formatted or otherwise cannot be decodedjavax.microedition.lcdui.Image#createImage(byte[],int,int)
public static Image createImage(int width, int height, int ARGBcolor)
The method returns a newly created mutable Image with the specified dimension and all the pixels of the image defined by the specified ARGB color. The color can contain alpha channel transparency information.
width
- the width of the new image, in pixelsheight
- the height of the new image, in pixelsARGBcolor
- the initial color for image
java.lang.IllegalArgumentException
- if either width or height is
zero or lesspublic static Font getFont(int face, int style, int height)
The method returns new instance of javax.microedition.lcdui.Font
with custom font height. System provides a font that matches
the requested attributes as closely as possible.
Font created in this way can be used only for Graphics instance (Canvas, CustomItem, Image). This font is not supported for high-level UI components (ChoiceGroup, StringItem and List). If font with custom height is set to some high-level component, it's replaced by default font.
Actual font height could be affected by system limitations, there may be a maximum height defined by the system.
face
- one of FACE_SYSTEM, FACE_MONOSPACE, or FACE_PROPORTIONALstyle
- STYLE_PLAIN, or a combination of STYLE_BOLD, STYLE_ITALIC,
and STYLE_UNDERLINEDheight
- font height in pixels
java.lang.IllegalArgumentException
- if height is negative, if face or style
are not legal values
|
forum.nokia.com/java | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |