From ffde862e033a0825e1e9972a89c0f1f80b261a8e Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 14 Aug 2006 23:12:35 +0000 Subject: 2006-08-14 Mark Wielaard Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116139 138bc75d-0d04-0410-961f-82ee72b054a4 --- .../classpath/java/awt/image/BufferedImage.java | 53 +++++++++++++++++----- 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'libjava/classpath/java/awt/image/BufferedImage.java') diff --git a/libjava/classpath/java/awt/image/BufferedImage.java b/libjava/classpath/java/awt/image/BufferedImage.java index 77b8d6cc174..76848db0833 100644 --- a/libjava/classpath/java/awt/image/BufferedImage.java +++ b/libjava/classpath/java/awt/image/BufferedImage.java @@ -100,11 +100,33 @@ public class BufferedImage extends Image Vector observers; /** - * Creates a new buffered image. + * Creates a new BufferedImage with the specified width, height + * and type. Valid type values are: * - * @param w the width. - * @param h the height. - * @param type the image type (see the constants defined by this class). + * + * + * @param w the width (must be > 0). + * @param h the height (must be > 0). + * @param type the image type (see the list of valid types above). + * + * @throws IllegalArgumentException if w or h is + * less than or equal to zero. + * @throws IllegalArgumentException if type is not one of the + * specified values. */ public BufferedImage(int w, int h, int type) { @@ -181,13 +203,15 @@ public class BufferedImage extends Image case TYPE_4BYTE_ABGR_PRE: bits = bits4; break; - case TYPE_BYTE_GRAY: - bits = bits1byte; - break; - case TYPE_USHORT_GRAY: - bits = bits1ushort; - dataType = DataBuffer.TYPE_USHORT; - break; + case TYPE_BYTE_GRAY: + bits = bits1byte; + cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); + break; + case TYPE_USHORT_GRAY: + bits = bits1ushort; + cs = ColorSpace.getInstance(ColorSpace.CS_GRAY); + dataType = DataBuffer.TYPE_USHORT; + break; } cm = new ComponentColorModel(cs, bits, alpha, premultiplied, alpha ? @@ -203,6 +227,8 @@ public class BufferedImage extends Image String msg2 = "type not implemented yet"; throw new UnsupportedOperationException(msg2); // FIXME: build color-cube and create color model + default: + throw new IllegalArgumentException("Unknown image type " + type); } init(cm, @@ -504,7 +530,10 @@ public class BufferedImage extends Image int[] pixels = getRGB(x, y, width, height, (int[])null, offset, stride); - ColorModel model = getColorModel(); + // We already convert the color to RGB in the getRGB call, so + // we pass a simple RGB color model to the consumers. + ColorModel model = new DirectColorModel(32, 0xff0000, 0xff00, 0xff, + 0xff000000); consumers.add(ic); -- cgit v1.2.1