javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Fri Jul 09 16:35:45 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java Fri Jul 23 12:27:20 2010 +0300
@@ -20,6 +20,7 @@
import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Internal_PackageSupport;
+import org.eclipse.swt.graphics.Point;
import java.io.IOException;
import java.io.InputStream;
@@ -432,6 +433,43 @@
static Image createImageWithoutSecurityCheck(Device device, String filename) {
return new Image(device, filename, false);
}
+
+ /*
+ * Returns the bounds of an image without creating an Image instance.
+ */
+ static Point getImageSize(Device device, String filename) {
+
+ if (filename == null) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ }
+
+ InputStream is = device.getClass().getResourceAsStream(filename);
+
+ if (is == null) {
+ SWT.error(SWT.ERROR_IO);
+ }
+
+ return getImageSize(is);
+ }
+
+ /*
+ * Returns the bounds of an image without creating an Image instance.
+ */
+ static Point getImageSize(InputStream stream) {
+ Point point = null;
+
+ try {
+ point = org.eclipse.swt.internal.qt.graphics.ImageLoader.getImageSize(stream);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO);
+ } catch (NullPointerException e) {
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ } catch (IllegalArgumentException e) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ return point;
+ }
/**
* Disposes of the operating system resources associated with the image.