Hi Anthony, Anthony Cavalliotis <[EMAIL PROTECTED]> wrote on 11/28/2005 06:21:53 PM:
> > I'm not sure why you think the JSVGCanvas is not a 'true' Component. > Ignorance probably. What I meant was that to get a tree of sub > components I have to fetch a GVTTree rather than relying on a > structure such as: Ok, I see. The real problem isn't if it's a component it's that it manages it's own offscreen buffer and so all the freehep will see is the final BufferedImage which makes the whole thing moot. > > The real question is if you are trying to simply transcode why are you > > creating a component. I would look at subclassing > > batik.transcoder.SVGAbstractTranscoder this class will read an SVG file > > and build the GVT tree. Then you can more or less just call > > 'paint' on the root GVT node passing in the FreeHEP EMF Graphics2D. > > The SVGAbstractTranscoder is a good idea. Beforehand though, I got > something working with the JComponent approach which I'll include here > for anyone interested. Its a cut and paste modification of the > JSVGCanvas code with two files (1) SimpleEMFWriter.java (main > program); and (2) SVG2EMF.java (helper with the GVTTree) [apols for > the spew of inline code here] I think the Transcoder route would give you a much cleaner solution. > Even though the above works for simple svgs, complex ones (the ones I > need to convert) don't work. Things like boxes with a certain edge > shade/font missing. Can't really tell without doing more tests but > I'm thinking that there is something wrong with the freehep conversion > (or the styles/fonts batik uses for SVG might be nonstandard?). Not > sure if anyone has encountered this but I'll try and look at the > freehep forums and dig up (and post back) any answers. If you can post a 'before and after' example it might be helpful. Two comments that might help a little. First, the way you are using Batik all of your text will be drawn as shapes (using drawGlyphVector), so I doubt the fonts are at issue. There is some chance that there is a bug in the way EMFGraphics2D handles drawGlyphVector but the code to implement this is pretty simple. Second, I would suspect the problem is when Batik has to rasterize content. This tends to happen when filters are used (which would explain the failure for 'complex' cases). Do you know if the EMF graphics supports embedding raster content? > If I don't get this licked I *could* convert SVG->PS/PDF->EMF via > Apache FOP and pstoedit (or similar), but it seems like a horrible > kludge and requires lots of dlls etc on the pstoedit side (results are > near perfect though). Argh ... Surely someone has a nice (conversion > perfect) complete (pref Java) solution? Damn M$ and their closed > standards. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
