Batik handles the SVG side for you. You just have to handle the changes
of the transformation matrix on the Graphics2D object correctly. Either
you can track what transformations are applied incrementally, or you can
just retrieve the currently valid transformation matrix. Things like the
PathIterator can help you handle those when painting shapes. Either you
just use an identity transform if you apply the transformation matrix in
the context or you can pass in the current transformation matrix any you
get corrected coordinates. Depends on what your own format looks like.

Keep in mind that if you implement a Graphics2D implementation, it
doesn't necessarily have a dependency on Batik. You could use any Java2D
source to create graphics in your format. For example, you could write a
plug-in for the Java Printing System as a wrapper around your Graphics2D
implementation (much like the Transcoder subclass I mentioned). That
would allow any application printing to JPS to create documents in your
format. A big bag of possibilities. ;-)

On 28.01.2009 16:38:51 Marek Scholaster wrote:
> Thanks Jeremias,
> just one more question: transformations are resolved inside Batik or 
> they are left on Graphics2D ?
> 
> Jeremias Maerki wrote:
> > In FOP we convert SVG (or rather vector graphics in general) into
> > various output formats (PDF, PS, GOCA, HP/GL2). For that we "simply"
> > write Graphics2D implementations. When you have that, you can write a
> > Transcoder subclass that uses that Graphics2D implementation to convert
> > the SVG with the same API that Batik provides. If you don't have to do
> > anything SVG-specific, that's most likely the easiest route. Examples
> > for that are PSDocumentGraphics2D in XML Graphics Commons, or various
> > other Graphics2D implementations inside FOP. HTH
> >
> > On 28.01.2009 15:47:20 Marek Scholaster wrote:
> >   
> >> Hello,
> >> I'm new to Batik and would like to know whether Batik can help me with 
> >> my problem and if so, where to start.
> >>
> >> I need to write a conversion program from SVG to my custom format 
> >> (vector based, only a few shapes, no transformations)
> >> In addition I need to handle different layers differently (  <g 
> >> id="layer1">  )
> >>  
> >> Basically I need the svg document in a state where all transformations 
> >> are resolved and there is still information about layer of each shape.
> >>
> >> Thank you for any help,
> >> Marek Scholaster
> >>     
> >




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to