javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java
changeset 61 bf7ee68962da
parent 47 f40128debb5d
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java	Wed Aug 18 09:43:15 2010 +0300
@@ -669,6 +669,21 @@
         int imageHandle = OS.image_create(imageData);
         return new Image(imageHandle);
     }
+    
+    /**
+     * Constructs new image with given native QPixmap handle.
+     * @param pixmapHandle Handle of native QPixmap.
+     * @return Instance of loaded image.
+     */
+    public static Image createImageFromPixmap(int pixmapHandle) {
+        // input validation
+        if(pixmapHandle <= 0) {
+            throw new IllegalArgumentException("Invalid pixmap handle");
+        }
+        // Construct an ge in native side and store the handle
+        int handle = OS.image_create(pixmapHandle);
+        return new Image(handle);
+    }
 
     /**
      * Obtains a shallow copy of this Image to be placed in the command buffer.