javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/JavaCommandBuffer.java
changeset 78 71ad690e91f5
parent 26 dc7c549001d5
equal deleted inserted replaced
72:1f0034e370aa 78:71ad690e91f5
     1 /*******************************************************************************
     1 /*******************************************************************************
     2  * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved. This program and the accompanying materials
     3  * All rights reserved. This program and the accompanying materials
     4  * are made available under the terms of the Eclipse Public License v1.0
     4  * are made available under the terms of the Eclipse Public License v1.0
     5  * which accompanies this distribution, and is available at
     5  * which accompanies this distribution, and is available at
     6  * http://www.eclipse.org/legal/epl-v10.html
     6  * http://www.eclipse.org/legal/epl-v10.html
     7  *
     7  *
     8  * Contributors:
     8  * Contributors:
     9  *     Nokia Corporation - initial implementation
     9  *     Nokia Corporation - initial implementation
    10  *******************************************************************************/
    10  *******************************************************************************/
       
    11 
    11 package org.eclipse.swt.internal.qt.graphics;
    12 package org.eclipse.swt.internal.qt.graphics;
    12 
    13 
    13 import java.util.Vector;
    14 import java.util.Vector;
    14 import java.util.Enumeration;
    15 import java.util.Enumeration;
       
    16 
    15 
    17 
    16 /**
    18 /**
    17  * This class implements a command buffer that can be bound by GraphicsContext
    19  * This class implements a command buffer that can be bound by GraphicsContext
    18  * to collect the drawing operations. Contents of the command buffer can be replayed to
    20  * to collect the drawing operations. Contents of the command buffer can be replayed to
    19  * GraphicsContext target with GraphicsContext.render() method.
    21  * GraphicsContext target with GraphicsContext.render() method.
    24  * supported see the methods of this class. In principal GraphicsContext supports all draw and set operations,
    26  * supported see the methods of this class. In principal GraphicsContext supports all draw and set operations,
    25  * when JavaCommandBuffer is set as rendering target.
    27  * when JavaCommandBuffer is set as rendering target.
    26  */
    28  */
    27 public final class JavaCommandBuffer {
    29 public final class JavaCommandBuffer {
    28 
    30 
    29 	// All collected drawing operations and their parameters
    31     // All collected drawing operations and their parameters
    30 	private int[] intParams;
    32     private int[] intParams;
    31 	private int intCount;
    33     private int intCount;
    32 	private StringBuffer strParams;
    34     private StringBuffer strParams;
    33 
    35 
    34 	// Holder for images
    36     // Container for images
    35 	private Vector images;
    37     private Vector images;
    36 
    38 
    37 	// holder for rgbData
    39     // Container for rgbData
    38 	private Vector rgbData;
    40     private Vector rgbData;
    39 
    41 
    40 	// This flag is indicates if this buffer is bound by some GraphicsContext
    42     // This flag is indicates if this buffer is bound by some GraphicsContext
    41 	private boolean bound;
    43     private boolean bound;
    42 
    44 
    43     // This flag indicates if this buffer is empty or not
    45     // This flag indicates if this buffer is empty or not
    44 	private boolean containsData;
    46     private boolean containsData;
    45 	
    47 
    46 	// This flag indicates if this buffer has any draw commands in it
    48     // This flag indicates if this buffer has any draw commands in it
    47 	private boolean containsPrimitiveData;
    49     private boolean containsPrimitiveData;
    48 
    50 
    49     // Memory management configuration constants
    51     // Memory management configuration constants
    50 	private static final int INT_BUF_GRANULARITY     	 = 10;
    52     private static final int INT_BUF_GRANULARITY         = 2560; // 10kB
    51 	private static final int INT_BUF_INITIAL_SIZE    	 = 250;
    53     private static final int INT_BUF_INITIAL_SIZE        = 256; // 1kB
    52 	private static final int IMAGE_BUF_INITIAL_SIZE 	 = 3;
    54     private static final int IMAGE_BUF_INITIAL_SIZE      = 256; // 1kB
    53 	private static final int IMAGE_BUF_GRANULARITY  	 = 2;
    55     private static final int IMAGE_BUF_GRANULARITY       = 256; // 1kB
    54 	private static final int STRING_BUFFER_INITIAL_SIZE = 10;
    56     private static final int STRING_BUFFER_INITIAL_SIZE  = 256; // 1kB
    55 
    57 
    56 	// Prefixes for different categories of op codes, stored in MSB
    58     // Prefixes for different categories of op codes, stored in MSB
    57 	final static int DRAW_PREFIX = 0;
    59     final static int DRAW_PREFIX = 0;
    58 	final static int FILL_PREFIX = 1;
    60     final static int FILL_PREFIX = 1;
    59 	final static int SET_PREFIX = 2;
    61     final static int SET_PREFIX = 2;
    60 	final static int MISC_PREFIX = 3;
    62     final static int MISC_PREFIX = 3;
    61 
    63 
    62 	// Unique operation codes for all the gc operations that can be buffered.
    64     // Unique operation codes for all the gc operations that can be buffered.
    63 	static final int OP_DRAWARC            = ((DRAW_PREFIX << 24) | 1);
    65     static final int OP_DRAWARC            = ((DRAW_PREFIX << 24) | 1);
    64 	static final int OP_DRAWFOCUS          = ((DRAW_PREFIX << 24) | 2);
    66     static final int OP_DRAWFOCUS          = ((DRAW_PREFIX << 24) | 2);
    65 	static final int OP_DRAWIMAGE1         = ((DRAW_PREFIX << 24) | 3);
    67     static final int OP_DRAWIMAGE1         = ((DRAW_PREFIX << 24) | 3);
    66 	static final int OP_DRAWIMAGE2         = ((DRAW_PREFIX << 24) | 4);
    68     static final int OP_DRAWIMAGE2         = ((DRAW_PREFIX << 24) | 4);
    67 	static final int OP_DRAWLINE           = ((DRAW_PREFIX << 24) | 5);
    69     static final int OP_DRAWLINE           = ((DRAW_PREFIX << 24) | 5);
    68 	static final int OP_DRAWELLIPSE        = ((DRAW_PREFIX << 24) | 6);
    70     static final int OP_DRAWELLIPSE        = ((DRAW_PREFIX << 24) | 6);
    69 	static final int OP_DRAWPOINT          = ((DRAW_PREFIX << 24) | 7);
    71     static final int OP_DRAWPOINT          = ((DRAW_PREFIX << 24) | 7);
    70 	static final int OP_DRAWPOLYGON        = ((DRAW_PREFIX << 24) | 8);
    72     static final int OP_DRAWPOLYGON        = ((DRAW_PREFIX << 24) | 8);
    71 	static final int OP_DRAWPOLYLINE       = ((DRAW_PREFIX << 24) | 9);
    73     static final int OP_DRAWPOLYLINE       = ((DRAW_PREFIX << 24) | 9);
    72 	static final int OP_DRAWRECT           = ((DRAW_PREFIX << 24) | 10);
    74     static final int OP_DRAWRECT           = ((DRAW_PREFIX << 24) | 10);
    73 	static final int OP_DRAWRGB_INT        = ((DRAW_PREFIX << 24) | 11);
    75     static final int OP_DRAWRGB_INT        = ((DRAW_PREFIX << 24) | 11);
    74 	static final int OP_DRAWRGB_BYTE       = ((DRAW_PREFIX << 24) | 12);
    76     static final int OP_DRAWRGB_BYTE       = ((DRAW_PREFIX << 24) | 12);
    75 	static final int OP_DRAWRGB_SHORT      = ((DRAW_PREFIX << 24) | 13);
    77     static final int OP_DRAWRGB_SHORT      = ((DRAW_PREFIX << 24) | 13);
    76 	static final int OP_DRAWROUNDRECT      = ((DRAW_PREFIX << 24) | 14);
    78     static final int OP_DRAWROUNDRECT      = ((DRAW_PREFIX << 24) | 14);
    77 	static final int OP_DRAWSTRING         = ((DRAW_PREFIX << 24) | 15);
    79     static final int OP_DRAWSTRING         = ((DRAW_PREFIX << 24) | 15);
    78 	static final int OP_FILLARC            = ((FILL_PREFIX << 24) | 16);
    80     static final int OP_FILLARC            = ((FILL_PREFIX << 24) | 16);
    79 	static final int OP_FILLGRADIENTRECT   = ((FILL_PREFIX << 24) | 17);
    81     static final int OP_FILLGRADIENTRECT   = ((FILL_PREFIX << 24) | 17);
    80 	static final int OP_FILLELLIPSE        = ((FILL_PREFIX << 24) | 18);
    82     static final int OP_FILLELLIPSE        = ((FILL_PREFIX << 24) | 18);
    81 	static final int OP_FILLPOLYGON        = ((FILL_PREFIX << 24) | 19);
    83     static final int OP_FILLPOLYGON        = ((FILL_PREFIX << 24) | 19);
    82 	static final int OP_FILLRECT           = ((FILL_PREFIX << 24) | 20);
    84     static final int OP_FILLRECT           = ((FILL_PREFIX << 24) | 20);
    83 	static final int OP_FILLROUNDRECT      = ((FILL_PREFIX << 24) | 21);
    85     static final int OP_FILLROUNDRECT      = ((FILL_PREFIX << 24) | 21);
    84 	static final int OP_SETBACKGROUNDALPHA = ((SET_PREFIX << 24) | 22);
    86     static final int OP_SETBACKGROUNDALPHA = ((SET_PREFIX << 24) | 22);
    85 	static final int OP_SETBACKGROUNDCOLOR = ((SET_PREFIX << 24) | 23);
    87     static final int OP_SETBACKGROUNDCOLOR = ((SET_PREFIX << 24) | 23);
    86 	static final int OP_SETBLENDINGMODE    = ((SET_PREFIX << 24) | 24);
    88     static final int OP_SETBLENDINGMODE    = ((SET_PREFIX << 24) | 24);
    87 	static final int OP_SETCLIP            = ((SET_PREFIX << 24) | 25);
    89     static final int OP_SETCLIP            = ((SET_PREFIX << 24) | 25);
    88 	static final int OP_CANCELCLIPPING     = ((SET_PREFIX << 24) | 26);
    90     static final int OP_CANCELCLIPPING     = ((SET_PREFIX << 24) | 26);
    89 	static final int OP_SETFONT            = ((SET_PREFIX << 24) | 27);
    91     static final int OP_SETFONT            = ((SET_PREFIX << 24) | 27);
    90 	static final int OP_SETFOREGROUNDALPHA = ((SET_PREFIX << 24) | 28);
    92     static final int OP_SETFOREGROUNDALPHA = ((SET_PREFIX << 24) | 28);
    91 	static final int OP_SETFOREGROUNDCOLOR = ((SET_PREFIX << 24) | 29);
    93     static final int OP_SETFOREGROUNDCOLOR = ((SET_PREFIX << 24) | 29);
    92 	static final int OP_SETSTROKESTYLE     = ((SET_PREFIX << 24) | 30);
    94     static final int OP_SETSTROKESTYLE     = ((SET_PREFIX << 24) | 30);
    93 	static final int OP_SETSTROKEWIDTH     = ((SET_PREFIX << 24) | 31);
    95     static final int OP_SETSTROKEWIDTH     = ((SET_PREFIX << 24) | 31);
    94 	static final int OP_TRANSLATE          = ((MISC_PREFIX << 24) | 32);
    96     static final int OP_TRANSLATE          = ((MISC_PREFIX << 24) | 32);
    95 	static final int OP_SCALE              = ((MISC_PREFIX << 24) | 33);
    97     static final int OP_SCALE              = ((MISC_PREFIX << 24) | 33);
    96 	static final int OP_RESETTRANSFORM     = ((MISC_PREFIX << 24) | 34);
    98     static final int OP_RESETTRANSFORM     = ((MISC_PREFIX << 24) | 34);
    97 	static final int OP_COPYAREA1          = ((MISC_PREFIX << 24) | 35);
    99     static final int OP_COPYAREA1          = ((MISC_PREFIX << 24) | 35);
    98 	static final int OP_COPYAREA2          = ((MISC_PREFIX << 24) | 36);
   100     static final int OP_COPYAREA2          = ((MISC_PREFIX << 24) | 36);
    99 
   101 
   100 	/**
   102     /**
   101 	 * Constructs empty command buffer with defined buffer sizes.
   103      * Constructs empty command buffer with defined buffer sizes.
   102 	 */
   104      */
   103 	public JavaCommandBuffer() {
   105     public JavaCommandBuffer() {
   104 		intParams = new int[INT_BUF_INITIAL_SIZE];
   106         intParams = new int[INT_BUF_INITIAL_SIZE];
   105 		strParams = new StringBuffer(STRING_BUFFER_INITIAL_SIZE);
   107         strParams = new StringBuffer(STRING_BUFFER_INITIAL_SIZE);
   106 		images = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
   108         images = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
   107 		rgbData = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
   109         rgbData = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);
   108 	}
   110     }
   109 
   111 
   110 	/**
   112     /**
   111 	 * Resets the buffer, i.e. removes all recorded commands and related data. The integer array containing
   113      * Resets the buffer, i.e. removes all recorded commands and related data. The integer array containing
   112 	 * the actual operation codes is not deleted, only the index pointer is rested, thus the memory consumption of that is not freed.
   114      * the actual operation codes is not deleted, only the index pointer is rested, thus the memory consumption of that is not freed.
   113 	 * CommandBuffer can be reseted only if it is not bound by any GraphicsContext
   115      * CommandBuffer can be reseted only if it is not bound by any GraphicsContext
   114 	 * @throws IllegalStateException if this CommandBuffer is bound while calling reset
   116      * @throws IllegalStateException if this CommandBuffer is bound while calling reset
   115 	 */
   117      */
   116 	public void reset() {
   118     public void reset() {
   117 		if(bound) {
   119         if(bound) {
   118 			throw new IllegalStateException("CommandBuffer is still bound by gc");
   120             throw new IllegalStateException("CommandBuffer is still bound by gc");
   119 		}
   121         }
   120 		intCount = 0;
   122         intCount = 0;
   121 		strParams.setLength(0);
   123         strParams.setLength(0);
   122 
   124 
   123 		Enumeration allImages = images.elements();
   125         Enumeration allImages = images.elements();
   124 		while(allImages.hasMoreElements()) {
   126         while(allImages.hasMoreElements()) {
   125 			Image image = (Image)allImages.nextElement();
   127             Image image = (Image)allImages.nextElement();
   126 			if(!image.isDisposed()) {
   128             if(image != null) {
   127 				image.dispose();
   129                 image.freeCommandBufferCopy();
   128 			}
   130             }
   129 		}
   131         }
   130 		images.removeAllElements();
   132         images.removeAllElements();
   131 		rgbData.removeAllElements();
   133         rgbData.removeAllElements();
   132 		containsData = false;
   134         containsData = false;
   133 		containsPrimitiveData = false;
   135         containsPrimitiveData = false;
   134 	}
   136     }
   135 
   137 
   136 	/**
   138     /**
   137 	 * Checks that does this buffer contain any commands
   139      * Checks that does this buffer contain any commands
   138 	 * @return true if any command has been written to buffer otherwise false
   140      * @return true if any command has been written to buffer otherwise false
   139 	 */
   141      */
   140 	public boolean containsData() {
   142     public boolean containsData() {
   141 		return containsData;
   143         return containsData;
   142 	}
   144     }
   143 	
   145 
   144 	/**
   146     /**
   145 	 * Checks that does this buffer contain any draw commands, i.e. any setters etc. 
   147      * Checks that does this buffer contain any draw commands, i.e. any setters etc.
   146 	 * that does to cause any pixels to be rendered are ignored 
   148      * that does to cause any pixels to be rendered are ignored
   147 	 * @return true if any draw command has been written to buffer otherwise false
   149      * @return true if any draw command has been written to buffer otherwise false
   148 	 */
   150      */
   149 	public boolean containsDrawnPrimitives() {
   151     public boolean containsDrawnPrimitives() {
   150 		return containsPrimitiveData;
   152         return containsPrimitiveData;
   151 	}
   153     }
   152 	
   154 
   153 	/**
   155     /**
   154 	 * Binds this buffer
   156      * Binds this buffer
   155 	 */
   157      */
   156 	void bind() {
   158     void bind() {
   157 		bound = true;
   159         bound = true;
   158 	}
   160     }
   159 
   161 
   160 	/**
   162     /**
   161 	 * Provides the binding status of this buffer
   163      * Provides the binding status of this buffer
   162 	 * @return true if this buffer has been already bound otherwise false
   164      * @return true if this buffer has been already bound otherwise false
   163 	 */
   165      */
   164 	boolean isBound() {
   166     boolean isBound() {
   165 		return bound;
   167         return bound;
   166 	}
   168     }
   167 
   169 
   168 	/**
   170     /**
   169 	 * Releases this buffer, i.e. it can be bound by some other GraphicsContext
   171      * Releases this buffer, i.e. it can be bound by some other GraphicsContext
   170 	 */
   172      */
   171 	void release() {
   173     void release() {
   172 		bound = false;
   174         bound = false;
   173 	}
   175     }
   174 
   176 
   175 	/**
   177     private void ensureIntArraySpace(final int items) {
   176 	 * Writes an integer to given array.
   178         if( intParams.length < intCount + items) {
   177 	 * @param item The item to be added to the array
   179             int[] dst = new int[intParams.length + Math.max(INT_BUF_GRANULARITY, items)];
   178 	 * @param array The array where to append given item
   180             System.arraycopy(intParams, 0, dst, 0, intParams.length);
   179 	 * @param elementsUsed The size of slots used in given array
   181             intParams = dst;
   180 	 * @param granularity The granularity used if the array needs to be enlarged
   182         }
   181 	 * @return Array containing the added item
   183         containsData = true;
   182 	 */
   184     }
   183 	private int[] writeToArray(int item, int[] array, int elementsUsed, int granularity) {
   185 
   184 		if( array.length < elementsUsed + 1) {
   186     private void reportNotSupported() {
   185 			int[] src = array;
   187         throw new RuntimeException("Intenal: Operation not supported with JavaCommandBuffer");
   186 			int[] dst = new int[array.length + granularity];
   188     }
   187 			System.arraycopy(src, 0, dst, 0, src.length);
   189 
   188 			array = dst;
   190 //    private void printBufferInfo() {
   189 		}
   191 //        System.out.println("CommandBuffer Info: " +this);
   190 		array[elementsUsed] = item;
   192 //        System.out.println("intParamCount: " + intCount);
   191 		return array;
   193 //        System.out.println("intBuffer Size: " + intParams.length);
   192 	}
   194 //        System.out.println("StringBuffer Size: " + strParams.length());
   193 
   195 //    }
   194 	private void writeInt(int param) {
   196 
   195 		intParams = writeToArray(param, intParams, intCount++, INT_BUF_GRANULARITY);
   197     private void raisePrimitiveFlag() {
   196 		containsData = true;
   198         containsPrimitiveData = true;
   197 	}
   199     }
   198 
   200 
   199 	private void writeImage(Image image) {
   201     int[] intParams() {
   200 		images.addElement(image);
   202         return intParams;
   201 	}
   203     }
   202 
   204 
   203 	private void writeStr(String string) {
   205     int intParamCount() {
   204     	strParams.append(string);
       
   205 	}
       
   206 
       
   207 	private void writeRgb(int[] rgb) {
       
   208 		rgbData.addElement(rgb);
       
   209 	}
       
   210 	private void writeRgb(byte[] rgb) {
       
   211 		rgbData.addElement(rgb);
       
   212 	}
       
   213 
       
   214 	private void writeRgb(short[] rgb) {
       
   215 		rgbData.addElement(rgb);
       
   216 	}
       
   217 
       
   218 	private void reportNotSupported() {
       
   219 		throw new RuntimeException("Intenal: Operation not supported with JavaCommandBuffer");
       
   220 	}
       
   221 
       
   222 	private void printBufferInfo() {
       
   223 		System.out.println("CommandBuffer Info: " +this);
       
   224 		System.out.println("intParamCount: " + intCount);
       
   225 		System.out.println("intBuffer Size: " + intParams.length);
       
   226 		System.out.println("StringBuffer Size: " + strParams.length());
       
   227 	}
       
   228 
       
   229 	private void raisePrimitiveFlag() {
       
   230 		containsPrimitiveData = true;
       
   231 	}
       
   232 	
       
   233 	int[] intParams() {
       
   234 		return intParams;
       
   235 	}
       
   236 
       
   237 	int intParamCount() {
       
   238         return intCount;
   206         return intCount;
   239 	}
   207     }
   240 
   208 
   241 	Vector rgbParams() {
   209     Vector rgbParams() {
   242 		return rgbData;
   210         return rgbData;
   243 	}
   211     }
   244 
   212 
   245 	Vector images() {
   213     Vector images() {
   246 		return images;
   214         return images;
   247 	}
   215     }
   248 
   216 
   249 	String strParams() {
   217     String strParams() {
   250 		return strParams.toString();
   218         return strParams.toString();
   251 	}
   219     }
   252 
   220 
   253 	void drawArc (int x, int y, int width, int height, int startAngle, int arcAngle) {
   221     void drawArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {
   254 		writeInt(OP_DRAWARC);
   222         ensureIntArraySpace(7);
   255 		writeInt(x);
   223         intParams[intCount++] = OP_DRAWARC;
   256 		writeInt(y);
   224         intParams[intCount++] = x;
   257 		writeInt(width);
   225         intParams[intCount++] = y;
   258 		writeInt(height);
   226         intParams[intCount++] = width;
   259 		writeInt(startAngle);
   227         intParams[intCount++] = height;
   260 		writeInt(arcAngle);
   228         intParams[intCount++] = startAngle;
   261 		raisePrimitiveFlag();
   229         intParams[intCount++] = arcAngle;
   262 	}
   230         raisePrimitiveFlag();
   263 
   231     }
   264 	void drawFocus (int x, int y, int width, int height) {
   232 
   265 		writeInt(OP_DRAWFOCUS);
   233     void drawFocus (final int x, final int y, final int width, final int height) {
   266 		writeInt(x);
   234         ensureIntArraySpace(5);
   267 		writeInt(y);
   235         intParams[intCount++] = OP_DRAWFOCUS;
   268 		writeInt(width);
   236         intParams[intCount++] = x;
   269 		writeInt(height);
   237         intParams[intCount++] = y;
   270 		raisePrimitiveFlag();
   238         intParams[intCount++] = width;
   271 	}
   239         intParams[intCount++] = height;
   272 
   240         raisePrimitiveFlag();
   273 	// must be called from UI thread as images cannot be creates outside that
   241     }
   274 	void drawImage(Image image, int x, int y) {
   242 
   275 		writeInt(OP_DRAWIMAGE1);
   243     // Must be called from UI thread as images cannot be creates outside that
   276 		writeInt(x);
   244     void drawImage(final Image image, final int x, final int y) {
   277 		writeInt(y);
   245         ensureIntArraySpace(3);
   278 		// creating copy of image here uses implicit data sharing,
   246         intParams[intCount++] = OP_DRAWIMAGE1;
   279 		// thus only a shallow copy is made
   247         intParams[intCount++] = x;
   280 		writeImage(new Image(image));
   248         intParams[intCount++] = y;
   281 		raisePrimitiveFlag();
   249         // creating copy of image here uses implicit data sharing,
   282 	}
   250         // thus only a shallow copy is made
   283 
   251         images.addElement(image.getCommandBufferCopy());
   284 	// must be called from UI thread as images cannot be creates outside that
   252         raisePrimitiveFlag();
   285 	void drawImage(Image image, int tx, int ty, int tw, int th,int sx, int sy, int sw, int sh, int manipulation) {
   253     }
   286 		writeInt(OP_DRAWIMAGE2);
   254 
   287 		writeInt(tx);
   255     // must be called from UI thread as images cannot be creates outside that
   288 		writeInt(ty);
   256     void drawImage(final Image image, final int tx, final int ty, final int tw, final int th, final int sx, final int sy, final int sw, final int sh, final int manipulation) {
   289 		writeInt(tw);
   257         ensureIntArraySpace(10);
   290 		writeInt(th);
   258         intParams[intCount++] = OP_DRAWIMAGE2;
   291 		writeInt(sx);
   259         intParams[intCount++] = tx;
   292 		writeInt(sy);
   260         intParams[intCount++] = ty;
   293 		writeInt(sw);
   261         intParams[intCount++] = tw;
   294 		writeInt(sh);
   262         intParams[intCount++] = th;
   295 		writeInt(manipulation);
   263         intParams[intCount++] = sx;
   296 		// creating copy of image here uses implicit data sharing,
   264         intParams[intCount++] = sy;
   297 		// thus only a shallow copy is made
   265         intParams[intCount++] = sw;
   298 		writeImage(new Image(image));
   266         intParams[intCount++] = sh;
   299 		raisePrimitiveFlag();
   267         intParams[intCount++] = manipulation;
   300 	}
   268         // creating copy of image here uses implicit data sharing,
   301 
   269         // thus only a shallow copy is made
   302 	void drawLine (int x1, int y1, int x2, int y2) {
   270         images.addElement(image.getCommandBufferCopy());
   303 		writeInt(OP_DRAWLINE);
   271         raisePrimitiveFlag();
   304 		writeInt(x1);
   272     }
   305 		writeInt(y1);
   273 
   306 		writeInt(x2);
   274     void drawLine (final int x1, final int y1, final int x2, final int y2) {
   307 		writeInt(y2);
   275         ensureIntArraySpace(5);
   308 		raisePrimitiveFlag();
   276         intParams[intCount++] = OP_DRAWLINE;
   309 	}
   277         intParams[intCount++] = x1;
   310 
   278         intParams[intCount++] = y1;
   311 	void drawEllipse (int x, int y, int width, int height) {
   279         intParams[intCount++] = x2;
   312 		writeInt(OP_DRAWELLIPSE);
   280         intParams[intCount++] = y2;
   313 		writeInt(x);
   281         raisePrimitiveFlag();
   314 		writeInt(y);
   282     }
   315 		writeInt(width);
   283 
   316 		writeInt(height);
   284     void drawEllipse (final int x, final int y, final int width, final int height) {
   317 		raisePrimitiveFlag();
   285         ensureIntArraySpace(5);
   318 	}
   286         intParams[intCount++] = OP_DRAWELLIPSE;
   319 
   287         intParams[intCount++] = x;
   320 	void drawPoint (int x, int y) {
   288         intParams[intCount++] = y;
   321 		writeInt(OP_DRAWPOINT);
   289         intParams[intCount++] = width;
   322 		writeInt(x);
   290         intParams[intCount++] = height;
   323 		writeInt(y);
   291         raisePrimitiveFlag();
   324 		raisePrimitiveFlag();
   292     }
   325 	}
   293 
   326 
   294     void drawPoint (final int x, final int y) {
   327 	void drawPolygon(int[] pointArray) {
   295         ensureIntArraySpace(3);
   328 		writeInt(OP_DRAWPOLYGON);
   296         intParams[intCount++] = OP_DRAWPOINT;
   329 		writeInt(pointArray.length);
   297         intParams[intCount++] = x;
   330 		for(int i = 0; i < pointArray.length; ++i) {
   298         intParams[intCount++] = y;
   331 			writeInt(pointArray[i]);
   299         raisePrimitiveFlag();
   332 		}
   300     }
   333 		raisePrimitiveFlag();
   301 
   334 	}
   302     void drawPolygon(final int[] pointArray) {
   335 
   303         ensureIntArraySpace(2 + pointArray.length);
   336 	void drawPolyline(int[] pointArray) {
   304         intParams[intCount++] = OP_DRAWPOLYGON;
   337 		writeInt(OP_DRAWPOLYLINE);
   305         intParams[intCount++] = pointArray.length;
   338 		writeInt(pointArray.length);
   306         for(int i = 0; i < pointArray.length; ++i) {
   339 		for(int i = 0; i < pointArray.length; ++i) {
   307             intParams[intCount++] = pointArray[i];
   340 			writeInt(pointArray[i]);
   308         }
   341 		}
   309         raisePrimitiveFlag();
   342 		raisePrimitiveFlag();
   310     }
   343 	}
   311 
   344 
   312     void drawPolyline(final int[] pointArray) {
   345 	void drawRect (int x, int y, int width, int height) {
   313         ensureIntArraySpace(2 + pointArray.length);
   346 		writeInt(OP_DRAWRECT);
   314         intParams[intCount++] = OP_DRAWPOLYLINE;
   347 		writeInt(x);
   315         intParams[intCount++] = pointArray.length;
   348 		writeInt(y);
   316         for(int i = 0; i < pointArray.length; ++i) {
   349 		writeInt(width);
   317             intParams[intCount++] = pointArray[i];
   350 		writeInt(height);
   318         }
   351 		raisePrimitiveFlag();
   319         raisePrimitiveFlag();
   352 	}
   320     }
   353 
   321 
   354 	void drawRGB(int[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha, int manipulation) {
   322     void drawRect (final int x, final int y, final int width, final int height) {
   355 		writeInt(OP_DRAWRGB_INT);
   323         ensureIntArraySpace(5);
   356 		writeInt(offset);
   324         intParams[intCount++] = OP_DRAWRECT;
   357 		writeInt(scanlength);
   325         intParams[intCount++] = x;
   358 		writeInt(x);
   326         intParams[intCount++] = y;
   359 		writeInt(y);
   327         intParams[intCount++] = width;
   360 		writeInt(width);
   328         intParams[intCount++] = height;
   361 		writeInt(height);
   329         raisePrimitiveFlag();
   362 		writeInt(processAlpha? 1 : 0);
   330     }
   363 		writeInt(manipulation);
   331 
   364 		writeRgb(rgbData);
   332     void drawRGB(final int[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation) {
   365 		raisePrimitiveFlag();
   333         ensureIntArraySpace(9);
   366 	}
   334         intParams[intCount++] = OP_DRAWRGB_INT;
   367 
   335         intParams[intCount++] = offset;
   368 	void drawRGB(byte[] rgbData, byte[] transparencyMask,int offset, int scanlength, int x, int y, int width, int height, int manipulation, int format) {
   336         intParams[intCount++] = scanlength;
   369 		writeInt(OP_DRAWRGB_BYTE);
   337         intParams[intCount++] = x;
   370 		writeInt(offset);
   338         intParams[intCount++] = y;
   371 		writeInt(scanlength);
   339         intParams[intCount++] = width;
   372 		writeInt(x);
   340         intParams[intCount++] = height;
   373 		writeInt(y);
   341         intParams[intCount++] = processAlpha? 1 : 0;
   374 		writeInt(width);
   342         intParams[intCount++] = manipulation;
   375 		writeInt(height);
   343         rgbData.addElement(rgb);
   376 		writeInt(manipulation);
   344         raisePrimitiveFlag();
   377 		writeInt(format);
   345     }
   378 		writeRgb(rgbData);
   346 
   379 		writeRgb(transparencyMask);
   347     void drawRGB(final byte[] rgb, final byte[] transparencyMask, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final int manipulation, final int format) {
   380 		raisePrimitiveFlag();
   348         ensureIntArraySpace(9);
   381 	}
   349         intParams[intCount++] = OP_DRAWRGB_BYTE;
   382 
   350         intParams[intCount++] = offset;
   383 	void drawRGB(short[] rgbData, int offset, int scanlength, int x, int y, int width, int height, boolean processAlpha, int manipulation, int format) {
   351         intParams[intCount++] = scanlength;
   384 		writeInt(OP_DRAWRGB_SHORT);
   352         intParams[intCount++] = x;
   385 		writeInt(offset);
   353         intParams[intCount++] = y;
   386 		writeInt(scanlength);
   354         intParams[intCount++] = width;
   387 		writeInt(x);
   355         intParams[intCount++] = height;
   388 		writeInt(y);
   356         intParams[intCount++] = manipulation;
   389 		writeInt(width);
   357         intParams[intCount++] = format;
   390 		writeInt(height);
   358         rgbData.addElement(rgb);
   391 		writeInt(processAlpha? 1 : 0);
   359         rgbData.addElement(transparencyMask);
   392 		writeInt(manipulation);
   360         raisePrimitiveFlag();
   393 		writeInt(format);
   361     }
   394 		writeRgb(rgbData);
   362 
   395 		raisePrimitiveFlag();
   363     void drawRGB(final short[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation, final int format) {
   396 	}
   364         ensureIntArraySpace(10);
   397 
   365         intParams[intCount++] = OP_DRAWRGB_SHORT;
   398 	void drawRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight) {
   366         intParams[intCount++] = offset;
   399 		writeInt(OP_DRAWROUNDRECT);
   367         intParams[intCount++] = scanlength;
   400 		writeInt(x);
   368         intParams[intCount++] = x;
   401 		writeInt(y);
   369         intParams[intCount++] = y;
   402 		writeInt(width);
   370         intParams[intCount++] = width;
   403 		writeInt(height);
   371         intParams[intCount++] = height;
   404 		writeInt(arcWidth);
   372         intParams[intCount++] = processAlpha? 1 : 0;
   405 		writeInt(arcHeight);
   373         intParams[intCount++] = manipulation;
   406 		raisePrimitiveFlag();
   374         intParams[intCount++] = format;
   407 	}
   375         rgbData.addElement(rgb);
   408 
   376         raisePrimitiveFlag();
   409 	void drawString(String string, int x, int y, int width, int height, int alignments, int flags, boolean isTransparent) {
   377     }
   410 		writeInt(OP_DRAWSTRING);
   378 
   411 		writeStr(string);
   379     void drawRoundRect (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {
   412 		writeInt(string.length());
   380         ensureIntArraySpace(7);
   413 		writeInt(x);
   381         intParams[intCount++] = OP_DRAWROUNDRECT;
   414 		writeInt(y);
   382         intParams[intCount++] = x;
   415 		writeInt(width);
   383         intParams[intCount++] = y;
   416 		writeInt(height);
   384         intParams[intCount++] = width;
   417 		writeInt(alignments);
   385         intParams[intCount++] = height;
   418 		writeInt(flags);
   386         intParams[intCount++] = arcWidth;
   419 		writeInt(isTransparent? 1 : 0);
   387         intParams[intCount++] = arcHeight;
   420 		raisePrimitiveFlag();
   388         raisePrimitiveFlag();
   421 	}
   389     }
   422 
   390 
   423 	void fillArc (int x, int y, int width, int height, int startAngle, int arcAngle) {
   391     void drawString(final String string, final int x, final int y, final int width, final int height, final int alignments, final int flags, final boolean isTransparent) {
   424 		writeInt(OP_FILLARC);
   392         ensureIntArraySpace(9);
   425 		writeInt(x);
   393         intParams[intCount++] = OP_DRAWSTRING;
   426 		writeInt(y);
   394         intParams[intCount++] = string.length();
   427 		writeInt(width);
   395         intParams[intCount++] = x;
   428 		writeInt(height);
   396         intParams[intCount++] = y;
   429 		writeInt(startAngle);
   397         intParams[intCount++] = width;
   430 		writeInt(arcAngle);
   398         intParams[intCount++] = height;
   431 		raisePrimitiveFlag();
   399         intParams[intCount++] = alignments;
   432 	}
   400         intParams[intCount++] = flags;
   433 
   401         intParams[intCount++] = isTransparent? 1 : 0;
   434 	void fillGradientRect(int x, int y, int width, int height, boolean vertical, boolean swapColors) {
   402         strParams.append(string);
   435 		writeInt(OP_FILLGRADIENTRECT);
   403         raisePrimitiveFlag();
   436 		writeInt(x);
   404     }
   437 		writeInt(y);
   405 
   438 		writeInt(width);
   406     void fillArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {
   439 		writeInt(height);
   407         ensureIntArraySpace(7);
   440 		writeInt(vertical ? 1 : 0);
   408         intParams[intCount++] = OP_FILLARC;
   441 		writeInt(swapColors ? 1 : 0);
   409         intParams[intCount++] = x;
   442 		raisePrimitiveFlag();
   410         intParams[intCount++] = y;
   443 	}
   411         intParams[intCount++] = width;
   444 
   412         intParams[intCount++] = height;
   445 	void fillEllipse (int x, int y, int width, int height) {
   413         intParams[intCount++] = startAngle;
   446 		writeInt(OP_FILLELLIPSE);
   414         intParams[intCount++] = arcAngle;
   447 		writeInt(x);
   415         raisePrimitiveFlag();
   448 		writeInt(y);
   416     }
   449 		writeInt(width);
   417 
   450 		writeInt(height);
   418     void fillGradientRect(final int x, final int y, final int width, final int height, final boolean vertical, final boolean swapColors) {
   451 		raisePrimitiveFlag();
   419         ensureIntArraySpace(7);
   452 	}
   420         intParams[intCount++] = OP_FILLGRADIENTRECT;
   453 
   421         intParams[intCount++] = x;
   454 	void fillPolygon (int[] pointArray) {
   422         intParams[intCount++] = y;
   455 		writeInt(OP_FILLPOLYGON);
   423         intParams[intCount++] = width;
   456 		writeInt(pointArray.length);
   424         intParams[intCount++] = height;
   457 		for(int i = 0; i < pointArray.length; ++i) {
   425         intParams[intCount++] = vertical ? 1 : 0;
   458 			writeInt(pointArray[i]);
   426         intParams[intCount++] = swapColors ? 1 : 0;
   459 		}
   427         raisePrimitiveFlag();
   460 		raisePrimitiveFlag();
   428     }
   461 	}
   429 
   462 
   430     void fillEllipse (final int x, final int y, final int width, final int height) {
   463 	void fillRect (int x, int y, int width, int height) {
   431         ensureIntArraySpace(5);
   464 		writeInt(OP_FILLRECT);
   432         intParams[intCount++] = OP_FILLELLIPSE;
   465 		writeInt(x);
   433         intParams[intCount++] = x;
   466 		writeInt(y);
   434         intParams[intCount++] = y;
   467 		writeInt(width);
   435         intParams[intCount++] = width;
   468 		writeInt(height);
   436         intParams[intCount++] = height;
   469 		raisePrimitiveFlag();
   437         raisePrimitiveFlag();
   470 	}
   438     }
   471 
   439 
   472 	void fillRoundRectangle (int x, int y, int width, int height, int arcWidth, int arcHeight) {
   440     void fillPolygon (final int[] pointArray) {
   473 		writeInt(OP_FILLROUNDRECT);
   441         ensureIntArraySpace(2 + pointArray.length);
   474 		writeInt(x);
   442         intParams[intCount++] = OP_FILLPOLYGON;
   475 		writeInt(y);
   443         intParams[intCount++] = pointArray.length;
   476 		writeInt(width);
   444         for(int i = 0; i < pointArray.length; ++i) {
   477 		writeInt(height);
   445             intParams[intCount++] = pointArray[i];
   478 		writeInt(arcWidth);
   446         }
   479 		writeInt(arcHeight);
   447         raisePrimitiveFlag();
   480 		raisePrimitiveFlag();
   448     }
   481 	}
   449 
   482 
   450     void fillRect (final int x, final int y, final int width, final int height) {
   483 	public void setBackgroundAlpha(int alpha) {
   451         ensureIntArraySpace(5);
   484 		writeInt(OP_SETBACKGROUNDALPHA);
   452         intParams[intCount++] = OP_FILLRECT;
   485 		writeInt(alpha);
   453         intParams[intCount++] = x;
   486 	}
   454         intParams[intCount++] = y;
   487 
   455         intParams[intCount++] = width;
   488 	void setBackgroundColor(int argb, boolean updateAlpha) {
   456         intParams[intCount++] = height;
   489 		writeInt(OP_SETBACKGROUNDCOLOR);
   457         raisePrimitiveFlag();
   490 		writeInt(argb);
   458     }
   491 		writeInt(updateAlpha? 1 : 0);
   459 
   492 	}
   460     void fillRoundRectangle (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {
   493 
   461         ensureIntArraySpace(7);
   494 	void setBlendingMode(int mode) {
   462         intParams[intCount++] = OP_FILLROUNDRECT;
   495 		writeInt(OP_SETBLENDINGMODE);
   463         intParams[intCount++] = x;
   496 		writeInt(mode);
   464         intParams[intCount++] = y;
   497 	}
   465         intParams[intCount++] = width;
   498 
   466         intParams[intCount++] = height;
   499 	void setClip(int x, int y, int width, int height, boolean intersects) {
   467         intParams[intCount++] = arcWidth;
   500 		writeInt(OP_SETCLIP);
   468         intParams[intCount++] = arcHeight;
   501 		writeInt(x);
   469         raisePrimitiveFlag();
   502 		writeInt(y);
   470     }
   503 		writeInt(width);
   471 
   504 		writeInt(height);
   472     public void setBackgroundAlpha(final int alpha) {
   505 		writeInt(intersects? 1 : 0 );
   473         ensureIntArraySpace(2);
   506 	}
   474         intParams[intCount++] = OP_SETBACKGROUNDALPHA;
   507 
   475         intParams[intCount++] = alpha;
   508 	void cancelClipping () {
   476     }
   509 		writeInt(OP_CANCELCLIPPING);
   477 
   510 	}
   478     void setBackgroundColor(final int argb, final boolean updateAlpha) {
   511 
   479         ensureIntArraySpace(3);
   512 	void setFont(int fontHandle) {
   480         intParams[intCount++] = OP_SETBACKGROUNDCOLOR;
   513 		writeInt(OP_SETFONT);
   481         intParams[intCount++] = argb;
   514 		writeInt(fontHandle);
   482         intParams[intCount++] = updateAlpha? 1 : 0;
   515 	}
   483     }
   516 
   484 
   517 	void setForegroundAlpha(int alpha) {
   485     void setBlendingMode(final int mode) {
   518 		writeInt(OP_SETFOREGROUNDALPHA);
   486         ensureIntArraySpace(2);
   519 		writeInt(alpha);
   487         intParams[intCount++] = OP_SETBLENDINGMODE;
   520 	}
   488         intParams[intCount++] = mode;
   521 
   489     }
   522 	void setForegroundColor(int argb, boolean updateAlpha) {
   490 
   523 		writeInt(OP_SETFOREGROUNDCOLOR);
   491     void setClip(final int x, final int y, final int width, final int height, final boolean intersects) {
   524 		writeInt(argb);
   492         ensureIntArraySpace(6);
   525 		writeInt(updateAlpha? 1 : 0);
   493         intParams[intCount++] = OP_SETCLIP;
   526 	}
   494         intParams[intCount++] = x;
   527 
   495         intParams[intCount++] = y;
   528 	void setStrokeStyle(int style) {
   496         intParams[intCount++] = width;
   529 		writeInt(OP_SETSTROKESTYLE);
   497         intParams[intCount++] = height;
   530 		writeInt(style);
   498         intParams[intCount++] = intersects? 1 : 0;
   531 	}
   499     }
   532 
   500 
   533 	void setStrokeWidth(int width) {
   501     void cancelClipping () {
   534 		writeInt(OP_SETSTROKEWIDTH);
   502         ensureIntArraySpace(1);
   535 		writeInt(width);
   503         intParams[intCount++] = OP_CANCELCLIPPING;
   536 	}
   504     }
   537 
   505 
   538 	void translate(int x, int y) {
   506     void setFont(final int fontHandle) {
   539 		writeInt(OP_TRANSLATE);
   507         ensureIntArraySpace(2);
   540 		writeInt(x);
   508         intParams[intCount++] = OP_SETFONT;
   541 		writeInt(y);
   509         intParams[intCount++] = fontHandle;
   542 	}
   510     }
   543 
   511 
   544 	void scale(int x, int y) {
   512     void setForegroundAlpha(final int alpha) {
   545 		writeInt(OP_SCALE);
   513         ensureIntArraySpace(2);
   546 		writeInt(x);
   514         intParams[intCount++] = OP_SETFOREGROUNDALPHA;
   547 		writeInt(y);
   515         intParams[intCount++] = alpha;
   548 	}
   516     }
   549 
   517 
   550 	void resetTransform() {
   518     void setForegroundColor(final int argb, final boolean updateAlpha) {
   551 		writeInt(OP_RESETTRANSFORM);
   519         ensureIntArraySpace(3);
   552 	}
   520         intParams[intCount++] = OP_SETFOREGROUNDCOLOR;
   553 
   521         intParams[intCount++] = argb;
   554 	void copyArea(Image image, int x, int y) {
   522         intParams[intCount++] = updateAlpha? 1 : 0;
   555 		writeInt(OP_COPYAREA1);
   523     }
   556         writeInt(x);
   524 
   557         writeInt(y);
   525     void setStrokeStyle(final int style) {
       
   526         ensureIntArraySpace(2);
       
   527         intParams[intCount++] = OP_SETSTROKESTYLE;
       
   528         intParams[intCount++] = style;
       
   529     }
       
   530 
       
   531     void setStrokeWidth(final int width) {
       
   532         ensureIntArraySpace(2);
       
   533         intParams[intCount++] = OP_SETSTROKEWIDTH;
       
   534         intParams[intCount++] = width;
       
   535     }
       
   536 
       
   537     void translate(final int x, final int y) {
       
   538         ensureIntArraySpace(3);
       
   539         intParams[intCount++] = OP_TRANSLATE;
       
   540         intParams[intCount++] = x;
       
   541         intParams[intCount++] = y;
       
   542     }
       
   543 
       
   544     void scale(final int x, final int y) {
       
   545         ensureIntArraySpace(3);
       
   546         intParams[intCount++] = OP_SCALE;
       
   547         intParams[intCount++] = x;
       
   548         intParams[intCount++] = y;
       
   549     }
       
   550 
       
   551     void resetTransform() {
       
   552         ensureIntArraySpace(1);
       
   553         intParams[intCount++] = OP_RESETTRANSFORM;
       
   554     }
       
   555 
       
   556     void copyArea(final Image image, final int x, final int y) {
       
   557         ensureIntArraySpace(3);
       
   558         intParams[intCount++] = OP_COPYAREA1;
       
   559         intParams[intCount++] = x;
       
   560         intParams[intCount++] = y;
   558         // TODO does this need flushing on the image
   561         // TODO does this need flushing on the image
   559         images.addElement(new Image(image));
   562         images.addElement(new Image(image));
   560         raisePrimitiveFlag();
   563         raisePrimitiveFlag();
   561     }
   564     }
   562 
   565 
   563 	void copyArea(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) {
   566     void copyArea(final int srcX, final int srcY, final int width, final int height, final int destX, final int destY, final boolean paint) {
   564         writeInt(OP_COPYAREA2);
   567         ensureIntArraySpace(8);
   565         writeInt(srcX);
   568         intParams[intCount++] = OP_COPYAREA2;
   566         writeInt(srcY);
   569         intParams[intCount++] = srcX;
   567         writeInt(width);
   570         intParams[intCount++] = srcY;
   568         writeInt(height);
   571         intParams[intCount++] = width;
   569         writeInt(destX);
   572         intParams[intCount++] = height;
   570         writeInt(destY);
   573         intParams[intCount++] = destX;
   571         writeInt(paint? 1 : 0);
   574         intParams[intCount++] = destY;
   572         raisePrimitiveFlag();
   575         intParams[intCount++] = paint? 1 : 0;
   573     }
   576         raisePrimitiveFlag();
   574 
   577     }
   575 	// Unsupported operations
   578 
   576 	int getAdvancedCharacterWidth(char ch, boolean isAdvanced) {
   579     // Unsupported operations
   577 		reportNotSupported();
   580     int getAdvancedCharacterWidth(final char ch, final boolean isAdvanced) {
   578 		return 0;
   581         reportNotSupported();
   579 	}
   582         return 0;
   580 
   583     }
   581 	void getFontMetricsData(int[] data, int fontHandle) {
   584 
   582 		reportNotSupported();
   585     void getFontMetricsData(final int[] data, final int fontHandle) {
   583 	}
   586         reportNotSupported();
   584 
   587     }
   585 	int getBackgroundAlpha() {
   588 
   586 		reportNotSupported();
   589     int getBackgroundAlpha() {
   587 		return 0;
   590         reportNotSupported();
   588 	}
   591         return 0;
   589 
   592     }
   590 	int getBackgroundColor() {
   593 
   591 		reportNotSupported();
   594     int getBackgroundColor() {
   592 		return 0;
   595         reportNotSupported();
   593 	}
   596         return 0;
   594 
   597     }
   595 	int getBlendingMode() {
   598 
   596 		reportNotSupported();
   599     int getBlendingMode() {
   597 		return 0;
   600         reportNotSupported();
   598 	}
   601         return 0;
   599 
   602     }
   600 	void getClip(int[] clip) {
   603 
   601 		reportNotSupported();
   604     void getClip(final int[] clip) {
   602 	}
   605         reportNotSupported();
   603 
   606     }
   604 	int getForegroundAlpha() {
   607 
   605 		reportNotSupported();
   608     int getForegroundAlpha() {
   606 		return 0;
   609         reportNotSupported();
   607 	}
   610         return 0;
   608 
   611     }
   609 	int getForegroundColor() {
   612 
   610 		reportNotSupported();
   613     int getForegroundColor() {
   611 		return 0;
   614         reportNotSupported();
   612 	}
   615         return 0;
   613 
   616     }
   614 	void getTextBoundingBox(int[] boundingBox, String string, int alignments, int flags, int rectX, int rectY, int rectWidth, int rectHeight) {
   617 
   615 		reportNotSupported();
   618     void getTextBoundingBox(final int[] boundingBox, final String string, final int alignments, final int flags, final int rectX, final int rectY, final int rectWidth, final int rectHeight) {
   616 	}
   619         reportNotSupported();
   617 
   620     }
   618 	int getStrokeWidth() {
   621 
   619 		reportNotSupported();
   622     int getStrokeWidth() {
   620 		return 0;
   623         reportNotSupported();
   621 	}
   624         return 0;
   622 
   625     }
   623 	int getStrokeStyle() {
   626 
   624 		reportNotSupported();
   627     int getStrokeStyle() {
   625 		return 0;
   628         reportNotSupported();
   626 	}
   629         return 0;
   627 
   630     }
   628 	int getTranslateX() {
   631 
   629 		reportNotSupported();
   632     int getTranslateX() {
   630 		return 0;
   633         reportNotSupported();
   631 	}
   634         return 0;
   632 
   635     }
   633 	int getTranslateY() {
   636 
   634 		reportNotSupported();
   637     int getTranslateY() {
   635 		return 0;
   638         reportNotSupported();
   636 	}
   639         return 0;
   637 
   640     }
   638 	boolean hasClipping() {
   641 
   639 		reportNotSupported();
   642     boolean hasClipping() {
   640 		return false;
   643         reportNotSupported();
   641 	}
   644         return false;
   642 
   645     }
   643 	void saveSettings() {
   646 
   644 		reportNotSupported();
   647     void saveSettings() {
   645 	}
   648         reportNotSupported();
   646 
   649     }
   647 	void restoreSettings() {
   650 
   648 		reportNotSupported();
   651     void restoreSettings() {
   649 	}
   652         reportNotSupported();
   650 
   653     }
   651 
       
   652 
       
   653 }
   654 }