Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Sternberg2011-01-22 15:54:02 +0000
committerRalf Sternberg2011-01-22 15:54:02 +0000
commit9e5d4b544867d7e498f5b3edf8a234bf991a4fab (patch)
tree75de269dd31395052a8ec37c2aff7b843c103b71 /bundles
parent143bd20970305031549541b6840313275916b091 (diff)
downloadorg.eclipse.rap-9e5d4b544867d7e498f5b3edf8a234bf991a4fab.tar.gz
org.eclipse.rap-9e5d4b544867d7e498f5b3edf8a234bf991a4fab.tar.xz
org.eclipse.rap-9e5d4b544867d7e498f5b3edf8a234bf991a4fab.zip
Applied patch for bug 334511: [Image] Image(Device,int,int) constructor is missing
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334511
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/graphics/Image.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/graphics/Image.java
index e936ef5637..d42d470343 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/graphics/Image.java
@@ -247,6 +247,48 @@ public final class Image extends Resource {
}
/**
+ * Constructs an empty instance of this class with the
+ * specified width and height. The result may be drawn upon
+ * by creating a GC and using any of its drawing operations,
+ * as shown in the following example:
+ * <pre>
+ * Image i = new Image(device, width, height);
+ * GC gc = new GC(i);
+ * gc.drawRectangle(0, 0, 50, 50);
+ * gc.dispose();
+ * </pre>
+ * <p>
+ * Note: Some platforms may have a limitation on the size
+ * of image that can be created (size depends on width, height,
+ * and depth). For example, Windows 95, 98, and ME do not allow
+ * images larger than 16M.
+ * </p>
+ *
+ * @param device the device on which to create the image
+ * @param width the width of the new image
+ * @param height the height of the new image
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
+ * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative or zero</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
+ * </ul>
+ * @since 1.4
+ */
+ public Image( final Device device, final int width, final int height ) {
+ super( checkDevice( device ) );
+ if( width <= 0 || height <= 0 ) {
+ SWT.error( SWT.ERROR_INVALID_ARGUMENT );
+ }
+ Color white = device.getSystemColor( SWT.COLOR_WHITE );
+ PaletteData palette = new PaletteData( new RGB[] { white.getRGB() } );
+ ImageData imageData = new ImageData( width, height, 24, palette );
+ internalImage = InternalImageFactory.findInternalImage( imageData );
+ }
+
+ /**
* Returns the bounds of the receiver. The rectangle will always
* have x and y values of 0, and the width and height of the
* image.

Back to the top