javauis/lcdui_qt/src/com/nokia/mj/impl/nokialcdui/LCDUIInvoker.java
changeset 78 71ad690e91f5
parent 35 85266cc22c7f
equal deleted inserted replaced
72:1f0034e370aa 78:71ad690e91f5
    15 *
    15 *
    16 */
    16 */
    17 package com.nokia.mj.impl.nokialcdui;
    17 package com.nokia.mj.impl.nokialcdui;
    18 
    18 
    19 import javax.microedition.lcdui.*;
    19 import javax.microedition.lcdui.*;
    20 
       
    21 import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
    20 import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
    22 
       
    23 import com.nokia.mid.ui.DirectGraphics;
    21 import com.nokia.mid.ui.DirectGraphics;
       
    22 import org.eclipse.swt.graphics.Rectangle;
    24 
    23 
    25 /**
    24 /**
    26  * Abstract class providing the interface to internal LCDUI resources.
    25  * Abstract class providing the interface to internal LCDUI resources.
    27  */
    26  */
    28 public abstract class LCDUIInvoker
    27 public abstract class LCDUIInvoker
    93         return invokerInstance.doGetEswtImage(img);
    92         return invokerInstance.doGetEswtImage(img);
    94     }
    93     }
    95 
    94 
    96     /**
    95     /**
    97      * Returns the WindowSurface where g will be drawing.
    96      * Returns the WindowSurface where g will be drawing.
       
    97      * 
       
    98      * startExternalRendering ensures that the WindowSurface instance is created, thus
       
    99      * it must be called before WindowSurface is queried with this method.
       
   100      * 
    98      * @param g The graphics object
   101      * @param g The graphics object
    99      * @return WindowSurface where g will be drawing.
   102      * @return WindowSurface where g will be drawing or null if the instance hasn't been initialized
   100      */
   103      */
   101     public static org.eclipse.swt.internal.qt.graphics.WindowSurface getWindowSurface(Graphics g)
   104     public static org.eclipse.swt.internal.qt.graphics.WindowSurface getWindowSurface(Graphics g)
   102     {
   105     {
   103         return invokerInstance.doGetWindowSurface(g);
   106         return invokerInstance.doGetWindowSurface(g);
   104     }
   107     }
   211         invokerInstance.doFlushGraphics(canvas, x, y, width, height);
   214         invokerInstance.doFlushGraphics(canvas, x, y, width, height);
   212     }
   215     }
   213 
   216 
   214     /**
   217     /**
   215      * Synchronizes any pending buffered draw commands to the target of the 
   218      * Synchronizes any pending buffered draw commands to the target of the 
   216      * graphics object.
   219      * graphics object. Does not open surface session for external renderer's like m2g or m3g.
   217      *
   220      *
   218      * Must be called from UI-thread.
   221      * Must not be called from UI-thread!
   219      *
   222      *
   220      * @param graphics The object to synchronize
   223      * @param graphics The object to synchronize
   221      */
   224      */
   222     public static void sync(Object graphics)
   225     public static void sync(Object graphics)
   223     {
   226     {
   227     /**
   230     /**
   228      * Begins an external renderer session to given Graphics. An external renderer
   231      * Begins an external renderer session to given Graphics. An external renderer
   229      * could be, for example,  M3G renderer. The opened rendering session must be
   232      * could be, for example,  M3G renderer. The opened rendering session must be
   230      * ended by calling the endExternalRendering().
   233      * ended by calling the endExternalRendering().
   231      *
   234      *
   232      * This function must be called from UI-thread only.
   235      * This method must not be called from UI-thread!
   233      *
   236      *
   234      * @param g Graphics where the rendering session starts.
   237      * @param g Graphics where the rendering session starts.
   235      */
   238 	 * @return The clip of the given graphics instance converted to window surface coordinates
   236     public static void startExternalRendering(Graphics g)
   239      */
   237     {
   240     public static Rectangle startExternalRendering(Graphics g)
   238         invokerInstance.doStartExternalRendering(g);
   241     {
       
   242         return invokerInstance.doStartExternalRendering(g);
   239     }
   243     }
   240     
   244     
   241     /**
   245     /**
   242      * Ends the external rendering session on given Graphics that was started
   246      * Ends the external rendering session on given Graphics that was started
   243      * by calling startExternalRendering().
   247      * by calling startExternalRendering().
   244      *
   248      *
   245      * This function must be called from UI-thread only.
   249      * This method must not be called from UI-thread!
   246      *
   250      *
   247      * @param g The Graphics instance.
   251      * @param g The Graphics instance.
   248      */
   252      */
   249     public static void endExternalRendering(Graphics g)
   253     public static void endExternalRendering(Graphics g)
   250     {
   254     {
   317     protected abstract void doFlushGraphics(Object canvas,
   321     protected abstract void doFlushGraphics(Object canvas,
   318                                             int x, int y, int width, int height);
   322                                             int x, int y, int width, int height);
   319 
   323 
   320     protected abstract void doSync(Object graphics);
   324     protected abstract void doSync(Object graphics);
   321     
   325     
   322     protected abstract void doStartExternalRendering(Graphics g);
   326     protected abstract Rectangle doStartExternalRendering(Graphics g);
   323     
   327     
   324     protected abstract void doEndExternalRendering(Graphics g);
   328     protected abstract void doEndExternalRendering(Graphics g);
   325     
   329     
   326     protected abstract String doGetDynamicProperty(String key);
   330     protected abstract String doGetDynamicProperty(String key);
   327 
   331