GraphicsV Class

The GraphicsV Java class is a subclass of Graphics2D that allows you to write SVG (Scalable Vector Graphics) and WMF (Windows MetaFile) files. These graphics file formats encode vector, not raster, information, so they are scalable and provide high quality images. I must note that this file was developed ad hoc--it is not intended as a complete implementation of these formats, but it does have many of the features you will need. Feel free to copy in whole or part, use as inspiration, etc. this class; all that I ask is an acknowledgement (if you wish to use this code in a commercial product, please contact me.)

Usage:

//SVG:
//let panel be a subclassed JPanel (or JComponent) that overrides the paintComponent function
GraphicsV svg = new GraphicsV(fc.getSelectedFile(), panel, GraphicsV.SVG); //create the Graphics2D object
panel.paintComponent(svg); //write to it
svg.output(); //write to file

//WMF
//let panel be a subclassed JPanel (or JComponent) that overrides the paintComponent function
GraphicsV wmf = new GraphicsV(fc.getSelectedFile(), panel, GraphicsV.WMF); //create the Graphics2D object
panel.paintComponent(wmf); //write to it
wmf.output(); //write to file

Get GraphicsV.java .


All content and software copyright 2002 Mark Hammer, unless otherwise noted. If you have any comments, please e-mail me at mark@mst.ufl.edu. No software or content on this web site or any linked pages comes with any warranty whatsoever, even the implied warranty of fitness for a specific purpose; the author is not liable for any damages caused by said software or information.