It's an SVG thing that is badly described everywhere I've looked. :-( Here's what I've discovered: There are two coordinate systems, the one you use to draw in, which is expressed in pixels, and the one that that is displayed. I use SVG and Batik for cartography, and I'm producing maps that are typically 12" x 18" and need to be printed at 300dpi. The physical (ie display/print) dimensions are given by the "width" and "height" attributes, while the drawing dimensions are described by the "viewPort" attribute. This means that for the document I describe, i will write <svg width="12in" height="18in" viewPort="0 0 3600 5400">
HTH, Martin 2009/8/29 Mark Pokorny <[email protected]>: > Hi all, > > Please forgive me as I have no doubt this has already been covered, > but unfortunately I couldn't find anything on this in the archives or > on the Internet as a whole (at least, nothing I had any chance of > understanding!) > > I have a small Swing programme that uses a JSVGCanvas to render an SVG > image. The image is very large (1200 × 1200 pixels) but only has a > couple of simple shapes on it. I would like to scale it down so that > it fits on my Swing JFrame, but I cannot seem to grasp how to do it. > Does anyone have any pointers? > > > > // ---- My Code ---- > > import java.awt.geom.AffineTransform; > import java.io.IOException; > import javax.swing.JFrame; > import org.apache.batik.swing.JSVGCanvas; > > public class SVGTest5 > { > > public static void main(String[] args) throws IOException > { > > JFrame frame = new JFrame("SVGTest"); > frame.setLayout(null); > frame.setSize(1000,600); > frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); > > JSVGCanvas svgCanvas = new JSVGCanvas(); > svgCanvas.loadSVGDocument("test.svg"); > AffineTransform transform = new AffineTransform(); > transform.scale(0.2d,0.2d); > svgCanvas.setRenderingTransform(transform); > svgCanvas.setSize(1200,1200); > > frame.add(svgCanvas); > frame.setVisible(true); > > } > > } > > // ---- End Code ---- > > > > NB: The code outlined above renders 'test.svg' perfectly, but at full > size (it should be at 20% by dimensions). > > Thanks and regards, > > Mark. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- >From my iMac --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
