Todd, It will be nice to use different formats for icons on a button just like images on the web. In most cases, for a small icon that is 64 by 64 or smaller, GIF should do most of its trick. If you want to shoot something higher with descent transparency, I will suggest PNG. I might stay away using SVG as that may take up some unnecessary rasterization for drawing such element on the screen. Putting all icons in a similar format could help maintain the system stability and maintainability. Just my 2 cents.
- Tangent > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On > Behalf Of Todd Wilson > Sent: Thursday, March 14, 2002 12:11 PM > To: [EMAIL PROTECTED] > Subject: Using GIF, JPEG, and SVG images interchangeably > > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
