xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Wilson <todd_wil...@byu.edu>
Subject Using GIF, JPEG, and SVG images interchangeably
Date Thu, 14 Mar 2002 18:11:08 GMT
We're building a client-side Java app in which we'd like to
interchangeably use JPG, GIF, and SVG images as transparently as
possible.  So, for example, we could pass a GIF, JPEG, or SVG to a 
JButton to use as an icon, and it wouldn't care what the file format was.

There are a couple of possible solutions that we've come up with, and 
we're just wondering if anyone else can offer input:

1.  Either write or utilize an SVG wrapper class that implements the 
javax.swing.Icon interface.  This would allow us to pass either an 
ImageIcon object containing a GIF or JPEG, or an SVG wrapped in this 
class to objects, and they could be treated identically.  Does anyone 
know if such a wrapper already exists?

2.  Somehow derive a java.awt.Image object from a Batik-generated SVG 
object.  The closest thing we can find among the Batik packages that 
might be able to do this is the getOffScreen method of the JGVTComponent 
class, though it's not clear to us exactly how the offscreen image is to 
be generated since it doesn't seem to be created by default.  Is there 
another method for deriving an Image object from an existing Batik SVG 
object that we're not seeing?  Does this seem like a viable solution to 
our problem?

Many thanks in advance for any input.

Regards,

Todd Wilson


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


Mime
View raw message