|
|||||||||
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 is a placeholder of utility methods. It contains methods for converting standard lcdui classes to Nokia UI classes and vice versa, and method for creating Image out of ARGB pixel array, creating empty transparent or specific background colored images, creating mutable image from encoded image byte array.
Graphics
,
DirectGraphics
,
Canvas
Field Summary | |
---|---|
static int |
STYLE_LIGHT
The light style constant. |
Method Summary | |
---|---|
static javax.microedition.lcdui.Image |
createImage(byte[] imageData,
int imageOffset,
int imageLength)
Creates a mutable image which is decoded from the data stored in the specified byte array at the specified offset and length. |
static javax.microedition.lcdui.Image |
createImage(int width,
int height,
int color)
The method will return a newly created mutable Image with specified dimension with all pixels of an image of defined ARGB color. |
static DirectGraphics |
getDirectGraphics(javax.microedition.lcdui.Graphics g)
Converts standard javax.microedition.lcdui.Graphics to DirectGraphics. |
static javax.microedition.lcdui.Font |
getFont(int face,
int style,
int height)
The method returns new instance of javax.microedition.lcdui.Font with custom font height. |
static boolean |
setHeader(javax.microedition.lcdui.Displayable displayable,
java.lang.String headerText,
javax.microedition.lcdui.Image headerImage,
int headerTextColor,
int headerBgColor,
int headerDividerColor)
Sets the header bar brandable elements on a displayable. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STYLE_LIGHT
javax.microedition.lcdui.Font
style constants
Method Detail |
---|
public static DirectGraphics getDirectGraphics(javax.microedition.lcdui.Graphics g)
g
- Graphics object for which DirectGraphics should be returned
public static javax.microedition.lcdui.Image createImage(byte[] imageData, int imageOffset, int imageLength)
Note that the semantics of this method are exactly the same
as
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 decodedImage.createImage(byte[],int,int)
public static javax.microedition.lcdui.Image createImage(int width, int height, int color)
The method will return a newly created mutable Image with specified dimension with all pixels of an image of defined 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 pixels
java.lang.IllegalArgumentException
- if either width or height is
zero or lesspublic static javax.microedition.lcdui.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 Font.FACE_SYSTEM, Font.FACE_MONOSPACE, or Font.FACE_PROPORTIONALstyle
- Font.STYLE_PLAIN, DirectUtils.STYLE_LIGHT, or a combination of Font.STYLE_BOLD, Font.STYLE_ITALIC, and Font.STYLE_UNDERLINEDheight
- font height in pixels
java.lang.IllegalArgumentException
- if height is negative, if face or style are not legal valuespublic static boolean setHeader(javax.microedition.lcdui.Displayable displayable, java.lang.String headerText, javax.microedition.lcdui.Image headerImage, int headerTextColor, int headerBgColor, int headerDividerColor)
displayable
- - the Displayable to set the header elements on.headerText
- - the String that must be displayed in the
status zone. Midlet name will be displayed if headerText is set to null/empty when
headerImage is null. To show an empty text, set headerImage to a valid image and headerText
to null/empty.headerImage
- - the image to display in the status zone.
null means no image should be set in header.headerTextColor
- - the color of the title text. -1 means that text
color should be set to default.headerBgColor
- - the color of the status zone background. -1 means
that bg color should be set to default.headerDividerColor
- - the color of the header bar divider line. -1
means that divider color should be set to default.
java.lang.NullPointerException
- if displayable is null
java.lang.IllegalArgumentException
- if displayable is not a Canvas or Form.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |