xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: Possible problem with SVGGraphics2D drawImage
Date Fri, 24 Sep 2004 12:50:23 GMT
Hi Carsten,

Carsten Birn wrote:

> I have discovered a problem when trying to store a GIF image using the 
> SVGGraphics2D context. I am calling the drawImage(BufferedImage, posX, 
> posY, ImageObserver) method. 

    I think you are actually calling:
	 drawImage(Image, posX, posY, ImageObserver)

    This is an important distinction because an 'Image' loads
asynchronously so it may not be complete when you draw it.  When
you draw to a AWT Component it will refresh it's self as the image
updates (like a web browser) - This is what the ImageObserver nonsense
is about.  But when drawing to something like a BufferedImage (or in
this case the SVGGraphics2D) it's your responsibility to ensure that
the image is fully loaded - otherwise it renders what it has at the

    You could look at using the MediaTracker Interface.  Or there
is a little bit simpler interface in:

    I am only 90% certain this is the cause of the problem so I
would be interested to know if ensuring the image was fully
loaded does in fact solve the problem.

    Perhaps a quicker way to check would be to add a sleep to
your code for a few sec - which should give it plenty of time
to load the image.  The correct solution is to use some form
of ImageObserver (like MediaTracker).

> When i have an Icon with 1 color(ore more)  
> Black + Transparency 15x16 (Created with GIMP) the result is a line 
> from top till bottom on the right side.  (See Example)
> I have supplied an example (Ground.gif)  of the input and the result 
> (shown below).
> When anyone has experienced similar problems or have a clue i would 
> appreciate it a lot. 

To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

View raw message