javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/graphics/Image.java
branchRCL_3
changeset 60 6c158198356e
parent 19 04becd199f91
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/graphics/Image.java	Thu Jul 15 18:31:06 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/graphics/Image.java	Thu Aug 19 09:48:13 2010 +0300
@@ -284,7 +284,7 @@
         if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
         init(device, new ImageData(filename));
     }
-
+    
     /**
      * Disposes of the operating system resources associated with
      * the image. Applications must dispose of all images which
@@ -772,4 +772,47 @@
 
         return baoStream.toByteArray();
     }
+    
+    /**
+     * Invokes platform specific functionality to allocate a new image
+     * which has handle to a system image.
+     * <p>
+     * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+     * API for <code>Font</code>. It is marked public only so that it
+     * can be shared within the packages provided by SWT. It is not
+     * available on all platforms, and should never be called from
+     * application code.
+     * </p>
+     *
+     * @param device the device on which to allocate the image
+     * @param handle the native handle for the image
+     * @return a new image object containing the specified device and
+     *         system image handle
+     */
+    public static Image internal_new(Device device, int handle)
+    {
+        if (device == null) device = Device.getDevice();
+        if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+        if (handle == 0)
+        {
+            SWT.error(SWT.ERROR_NO_HANDLES, null, device.getLastError());
+        }
+        
+        Image image = new Image();
+        image.device = device;
+        image.handle = handle;
+        image.type = SWT.BITMAP;
+
+        try
+        {
+            if (device.tracking) device.new_Object(image);
+        }
+        catch (Error e)
+        {
+            OS.Image_Dispose(device.handle, handle);
+            throw e;
+        }
+        
+        return image;
+    }
 }