Hi Thomas

You are right about the drawImage method. 
The strange thing is that my icon is drawn correctly when it is painted into a JPanel.
I load my icons using javax.imageio.ImageIO.read and this returns a bufferedImage. 

I've found an approach that works and it is: 

drawImage(BufferedImage, BufferedImageOP, posX,posY)
BufferedImageOP = AffineTransformOP(AffineTransform, TYPE_BILINEAR);

Thanks for the rapid responses. 

Carsten Birn


Am Fr 24.09.2004 14:50, Thomas DeWeese <[EMAIL PROTECTED]> schrieb:

> 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
> moment.
> 
>     You could look at using the MediaTracker Interface.  Or there
> is a little bit simpler interface in:
>       batik.ext.awt.image.spi.JDKRegistryEntry.MyImgObs.
> 
>     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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to