Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Whats the problem here?

0 views
Skip to first unread message

Steve Menard

unread,
Feb 22, 2002, 3:25:47 PM2/22/02
to
I am trying to copy a certain image to a buffered image, and I get the
following stack trace :

java.lang.IllegalArgumentException: Width (4) and height (0) must be > 0
at java.awt.image.SampleModel.<init>(SampleModel.java:105)
at
java.awt.image.SinglePixelPackedSampleModel.<init>(SinglePixelPackedSampleMo
del.java:125)
at java.awt.image.Raster.createPackedRaster(Raster.java:656)
at java.awt.image.Raster.createPackedRaster(Raster.java:431)
at
java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorMo
del.java:905)
at sun.java2d.loops.LockableRaster.<init>(LockableRaster.java:130)
at
sun.java2d.loops.RasterOutputManager.convertFrom(RasterOutputManager.java:14
63)
at
sun.java2d.loops.RasterOutputManager.performOpaqueBlit(RasterOutputManager.j
ava:1026)
at
sun.java2d.loops.RasterOutputManager.compositeSrcDst(RasterOutputManager.jav
a:673)
at
sun.java2d.loops.RasterOutputManager.renderImage(RasterOutputManager.java:47
9)
at sun.java2d.SunGraphics2D.renderingPipeImage(SunGraphics2D.java:2223)
at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:1626)
at
sun.awt.image.BufferedImageGraphics2D.drawImage(BufferedImageGraphics2D.java
:388)
at
sun.awt.image.ImageRepresentation.drawToBufImage(ImageRepresentation.java:71
6)
at
sun.awt.image.BufferedImageGraphics2D.drawImage(BufferedImageGraphics2D.java
:548)
at com.polyester.foundation.display.StillLayer.render(StillLayer.java:94)

I am using Sun's VM version 1.3.1_02 on windows 2000.

The target Graphics2D is from an image created by Component.createImage().
The source Image is created from file unsing Toolkit.createImage(). The
source image is definitely NOT 4 by 0. There may be a clipping region on the
target Graphics2D.

Even more puzzling, this error does not happen when the target Graphics2D is
from a BufferedImage created with new BufferedImage.

So whats the problem here??? What is that width and height thing? And just
where does it come from?

I am about to tear my hair out here ......

Steve


Linda Radecke

unread,
Feb 22, 2002, 6:07:47 PM2/22/02
to

Steve Menard wrote:

> I am trying to copy a certain image to a buffered image, and I get the
> following stack trace :

[StackTrace]

> I am using Sun's VM version 1.3.1_02 on windows 2000.

> The target Graphics2D is from an image created by Component.createImage().
> The source Image is created from file unsing Toolkit.createImage(). The
> source image is definitely NOT 4 by 0. There may be a clipping region on the
> target Graphics2D.

> Even more puzzling, this error does not happen when the target Graphics2D is
> from a BufferedImage created with new BufferedImage.

> So whats the problem here??? What is that width and height thing? And just
> where does it come from?

This is often a problem using Component.createImage; it returns
null, if the component is not displayable on the screen yet,e.g.
it is not added to a container and pack() is called. If width and
height aren't valid, a BufferedImage - object can not be constructed.

Linda
--
.-. I hear him, before I go to sleep And focus on the day
( ( that's been. I realise he's there, When I turn the
'-` light off and turn over.
Kate Bush - The Man With The Child In His Eyes

0 new messages