Danny, I have tried to reproduce the bug you report but with no success (see the attached test file and corresponding SVG when using the Batik SVG Generator test infrastructure).
Could you tell me what you call exactly on Graphics2D and how it differs from the code I attached? Vincent. Danny Ayers wrote: > > Hi, > > Sorry if I'm missing something obvious here (it's been a 13hr session), but > my code seems to have found a wonderfully awful algorithm for converting > from a simple GeneralPath into a <path/>. > > The Java2D code goes like this : > > path.moveTo(x - CROSS_WIDTH / 2, y - CROSS_HEIGHT / 2); // top left > path.lineTo(x + CROSS_WIDTH / 2, y + CROSS_HEIGHT / 2); // bottom right > path.moveTo(x - CROSS_WIDTH / 2, y + CROSS_HEIGHT / 2); // bottom left > path.lineTo(x + CROSS_WIDTH / 2, y - CROSS_HEIGHT / 2); // top right > > An example of the SVG generated through SVGGraphics2D is at > http://www.isacat.net/svg/verbose.svg > > Suggestions on general ways of getting this sensible and/or pointers to > related docs would be appreciated - e.g. am I still liable to get this stuff > using a couple of Line2Ds instead? > > Cheers, > Danny. > > --- > Danny Ayers > <stuff> http://www.isacat.net </stuff> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]
/***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * * ------------------------------------------------------------------------- * * This software is published under the terms of the Apache Software License * * version 1.1, a copy of which has been included with this distribution in * * the LICENSE file. * *****************************************************************************/ package org.apache.batik.svggen; import java.awt.*; import java.awt.geom.*; /** * Test created after Danny Ayers bug report. * * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a> * @version $Id$ */ public class LinePathTest implements Painter { public void paint(Graphics2D g) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setPaint(Color.black); g.setStroke(new BasicStroke(8)); GeneralPath path = new GeneralPath(); float x = 100; float y = 100; float CROSS_WIDTH = 50; float CROSS_HEIGHT = 50; path.moveTo(x - CROSS_WIDTH / 2, y - CROSS_HEIGHT / 2); // top left path.lineTo(x + CROSS_WIDTH / 2, y + CROSS_HEIGHT / 2); // bottom right path.moveTo(x - CROSS_WIDTH / 2, y + CROSS_HEIGHT / 2); // bottom left path.lineTo(x + CROSS_WIDTH / 2, y - CROSS_HEIGHT / 2); // top right g.draw(path); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
