Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.nokia.mid.ui
Class DirectUtils  view DirectUtils download DirectUtils.java

java.lang.Object
  extended bycom.nokia.mid.ui.DirectUtils

public class DirectUtils
extends java.lang.Object

This class is a placeholder for utility methods. It contains 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.


Constructor Summary
DirectUtils()
           
 
Method Summary
static javax.microedition.lcdui.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 javax.microedition.lcdui.Image createImage(int width, int height, int argb)
          The method will return 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(javax.microedition.lcdui.Graphics g)
          Converts standard javax.microedition.lcdui.Graphics to DirectGraphics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectUtils

public DirectUtils()
Method Detail

getDirectGraphics

public static DirectGraphics getDirectGraphics(javax.microedition.lcdui.Graphics g)
Converts standard javax.microedition.lcdui.Graphics to DirectGraphics. The returned object refers to the same graphics context. This means that calling draw operations or changing the state, for example, drawing color etc., via the original Graphics reference affect the DirectGraphics object, and vice versa. 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.


createImage

public static javax.microedition.lcdui.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. The data must be in a self-identifying image file format supported by the implementation, e.g., PNG. Note that the semantics of this method are exactly the same as Image.createImage(byte[],int,int) except that the returned image is mutable.


createImage

public static javax.microedition.lcdui.Image createImage(int width,
                                                         int height,
                                                         int argb)
The method will return 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.