You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Sand Print <wh...@yahoo.com> on 2004/07/17 07:18:18 UTC
SVGParser to Renderer
Hi,
I am new to Batik and have just started exploring it.
I am trying to understand the sequence of steps that the SVG file goes thru to get rendered as an image.
When the SVG file gets parsed, how is it stored and how does the renderer get this data? What I mean is that is it stored as some datastructure that the renderer accepts?
Urgently require an answer. Pls help.
Thanks,
Sandy
---------------------------------
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
Re: SVGParser to Renderer
Posted by Tonny Kohar <to...@kiyut.com>.
Hi,
> I am new to Batik and have just started exploring it.
> I am trying to understand the sequence of steps that the SVG file goes
> thru to get rendered as an image.
> When the SVG file gets parsed, how is it stored and how does the
> renderer get this data? What I mean is that is it stored as some
> datastructure that the renderer accepts?
If I am not wrong it will go like this
SVG Document -> Bridge -> GVT -> JSVGCanvas/Renderer
For more detail please look at Batik diagram, It is available at Apache
batik site
Regards
Tonny Kohar
--
Sketsa
SVG Graphics Editor
http://www.kiyut.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
Re: How to best understand a SVG file
Posted by Tonny Kohar <to...@kiyut.com>.
Hi,
> I need to understand a SVG file in order to parse it and be able to save it
> on my own internal vector graphics format.
> What is the best way to go about it?
> The autotrace produces a svgz file that is a compacted svg file.How can I
> unpack it, so it will be numeric and like an XML file again?
SVGZ file is only gzip format of xml/svg text file.
Just use any gzip extractor, it will return to normal xml file again
Regards
Tonny Kohar
--
Sketsa
SVG Graphics Editor
http://www.kiyut.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
How to best understand a SVG file
Posted by Alice Mello Cavallo <me...@media.mit.edu>.
Hi all,
I need to understand a SVG file in order to parse it and be able to save it
on my own internal vector graphics format.
What is the best way to go about it?
The autotrace produces a svgz file that is a compacted svg file.How can I
unpack it, so it will be numeric and like an XML file again?
Thanks,
Alice
Alice Cristina Mello Cavallo
Interdisciplinary PhD Candidate at Tufts University
Learning, Technology and Drama
http://www.media.mit.edu/~mello/
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
Re: SVGParser to Renderer
Posted by Archna Tikku <ar...@yahoo.com>.
Hi Thomas,
Thanks for your reply.
Let me tell you what I am trying to do.
I have to display an SVG file on a J2ME device. That is the reason that I am trying to use a very light parser, since the size is an issue. I guess I need to strip down the Batik API to reduce the size ; as my SVG file just needs to have basic functionality of display, zooming and panning.
I was thinking that I can do it in three steps - Parse, store as some tree structure and render.
I am not sure how I can plug the parser instead of Xerces, as Batik has a while package of micro parsers.
Is the css support essential for SVG rendering... Is it necessary for basic rendering also?
Thanks a lot,
Sandy.
Thomas DeWeese <Th...@Kodak.com> wrote:
Sand Print wrote:
> Thank you both for your reply.
> I looked at the steps link, Cameron- it helped.
> Following on that question, I am trying to parse an SVG file using a
> very light parser. - so I get all the elements and attributes in the SVG
> file. Now I need to stored it in some local data structure which can go
> as an input to the renderer.
The renderer essentially is the GVT tree. The input used to
construct the GVT tree is the Batik DOM (which has support for
CSS and various other stuff needed for SVG). The bridge package
takes the DOM and builds the corresponding GVT tree.
> I was going through the GVT classes. Can you tell me how the SVG
> document is stored for the rendering process.
The Bridge builds a tree of GVT nodes from the SVG. If you
_really_really_really_ wanted to you could write code to build
your own GVT tree (essentially a duplicate of the Bridge) but since
this is much of the work of Batik doing a complete job would be
really hard.
It is also worth pointing out that SVG makes fairly heavy use
of forward/backwards references (gradients, use, patterns, clip,
etc). For these you really need to store the whole tree.
So I would suggest using your 'light parser' to build the
Batik DOM (if your parser supports SAX 2 with namespaces you
can simply tell Batik to use it instead of Xerces - the default).
>
> Thanks a lot,
> Sandy.
>
> */Cameron McCormack /* wrote:
>
> Hi Sandy.
>
> Sand Print:
> > I am new to Batik and have just started exploring it.
> > I am trying to understand the sequence of steps that the SVG file
> goes
> > thru to get rendered as an image.
> > When the SVG file gets parsed, how is it stored and how does the
> > renderer get this data? What I mean is that is it stored as some
> > datastructure that the renderer accepts?
> >
> > Urgently require an answer. Pls help.
>
> Have a look at the JavaDoc for the JSVGComponent class. It explains
> the steps taken when an SVG document is loaded.
>
> http://xml.apache.org/batik/javadoc/org/apache/batik/swing/svg/JSVGComponent.html
>
> Cameron
>
> --
> Cameron McCormack
> | Web: http://mcc.id.au/
> | ICQ: 26955922
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: SVGParser to Renderer
Posted by Sand Print <wh...@yahoo.com>.
Hi Thomas,
I did go through TinyLine, but the source code is not available. I need to create an API that can do the rendering on a J2ME device( similar to what TinyLine is doing actually) . The only helpful source I could find for that is Batik., since the code is available and I can study it.
Since I am working on Personal Profile CDC classes to start with, I can use the Java 2D API.
As of now, I am exploring how to store the Tree structure which will be the input to the renderer.... The Batik bridge package has lots of classes and I am trying to make out what the minimum set of classes I will need from this list would be. Any inputs appreciated.
Thanks,
Sandy.
Thomas DeWeese <Th...@Kodak.com> wrote:
Hi Sand,
I think you are mostly out of luck WRT Batik. Batik makes
heavy use of Java2D which is not currently supported in J2ME.
Are you aware of the 'TinyLine' project? This appears to be
what you want...
Sand Print wrote:
> Thanks for your reply.
> Let me tell you what I am trying to do.
> I have to display an SVG file on a J2ME device. That is the reason that
> I am trying to use a very light parser, since the size is an issue. I
> guess I need to strip down the Batik API to reduce the size ; as my SVG
> file just needs to have basic functionality of display, zooming and panning.
Just ;)
> I was thinking that I can do it in three steps - Parse, store as some
> tree structure and render.
> I am not sure how I can plug the parser instead of Xerces, as Batik has
> a while package of micro parsers.
As I said if your parser supports SAX2 events you can replace a
resource or override a method in the UserAgent class. The micro
parsers are used to parse the results of parsing the XML :). They
are probably one of the only pieces of Batik that will be of
significant use to you - other than perhaps as a reference.
> Is the css support essential for SVG rendering... Is it necessary for
> basic rendering also?
Full CSS is not required for any SVG implementation. However parts
of CSS are required for all SVG implementations. The biggest pieces
of this are inheritance (set fill on a 'g' element and all the
children inherit it) and the style attribute
(style="fill:blue; stroke:green")
>
> Thanks a lot,
> Sandy.
>
>
> */Thomas DeWeese /* wrote:
>
> Sand Print wrote:
>
> > Thank you both for your reply.
> > I looked at the steps link, Cameron- it helped.
> > Following on that question, I am trying to parse an SVG file using a
> > very light parser. - so I get all the elements and attributes in
> the SVG
> > file. Now I need to stored it in some local data structure which
> can go
> > as an input to the renderer.
>
> The renderer essentially is the GVT tree. The input used to
> construct the GVT tree is the Batik DOM (which has support for
> CSS and various other stuff needed for SVG). The bridge package
> takes the DOM and builds the corresponding GVT tree.
>
> > I was going through the GVT classes. Can you tell me how the SVG
> > document is stored for the rendering process.
>
> The Bridge builds a tree of GVT nodes from the SVG. If you
> _really_really_really_ wanted to you! could write code to build
> your own GVT tree (essentially a duplicate of the Bridge) but since
> this is much of the work of Batik doing a complete job would be
> really hard.
>
> It is also worth pointing out that SVG makes fairly heavy use
> of forward/backwards references (gradients, use, patterns, clip,
> etc). For these you really need to store the whole tree.
>
> So I would suggest using your 'light parser' to build the
> Batik DOM (if your parser supports SAX 2 with namespaces you
> can simply tell Batik to use it instead of Xerces - the default).
>
>
> >
> > Thanks a lot,
> > Sandy.
> >
> > */Cameron McCormack /* wrote:
> >
> > Hi Sandy.
> >
> > Sand Print:
> > > I am new to Batik and have just started exploring it.
> > > I am trying to understand the sequence of steps that the SVG file
> > goes
> > > thru to get rendered as an image.
> > > When the SVG f! ile gets parsed, how is it stored and how does the
> > > renderer get this data? What I mean is that is it stored as some
> > > datastructure that the renderer accepts?
> > >
> > > Urgently require an answer. Pls help.
> >
> > Have a look at the JavaDoc for the JSVGComponent class. It explains
> > the steps taken when an SVG document is loaded.
> >
> >
> http://xml.apache.org/batik/javadoc/org/apache/batik/swing/svg/JSVGComponent.html
> >
> > Cameron
> >
> > --
> > Cameron McCormack
> > | Web: http://mcc.id.au/
> > | ICQ: 26955922
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-dev-help@xml.apache.org
> >
> > Do you Yahoo!?
> > Vote for the stars of Yahoo!'s next ad campaign!
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
Re: SVGParser to Renderer
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Sand,
I think you are mostly out of luck WRT Batik. Batik makes
heavy use of Java2D which is not currently supported in J2ME.
Are you aware of the 'TinyLine' project? This appears to be
what you want...
Sand Print wrote:
> Thanks for your reply.
> Let me tell you what I am trying to do.
> I have to display an SVG file on a J2ME device. That is the reason that
> I am trying to use a very light parser, since the size is an issue. I
> guess I need to strip down the Batik API to reduce the size ; as my SVG
> file just needs to have basic functionality of display, zooming and panning.
Just ;)
> I was thinking that I can do it in three steps - Parse, store as some
> tree structure and render.
> I am not sure how I can plug the parser instead of Xerces, as Batik has
> a while package of micro parsers.
As I said if your parser supports SAX2 events you can replace a
resource or override a method in the UserAgent class. The micro
parsers are used to parse the results of parsing the XML :). They
are probably one of the only pieces of Batik that will be of
significant use to you - other than perhaps as a reference.
> Is the css support essential for SVG rendering... Is it necessary for
> basic rendering also?
Full CSS is not required for any SVG implementation. However parts
of CSS are required for all SVG implementations. The biggest pieces
of this are inheritance (set fill on a 'g' element and all the
children inherit it) and the style attribute
(style="fill:blue; stroke:green")
>
> Thanks a lot,
> Sandy.
>
>
> */Thomas DeWeese <Th...@Kodak.com>/* wrote:
>
> Sand Print wrote:
>
> > Thank you both for your reply.
> > I looked at the steps link, Cameron- it helped.
> > Following on that question, I am trying to parse an SVG file using a
> > very light parser. - so I get all the elements and attributes in
> the SVG
> > file. Now I need to stored it in some local data structure which
> can go
> > as an input to the renderer.
>
> The renderer essentially is the GVT tree. The input used to
> construct the GVT tree is the Batik DOM (which has support for
> CSS and various other stuff needed for SVG). The bridge package
> takes the DOM and builds the corresponding GVT tree.
>
> > I was going through the GVT classes. Can you tell me how the SVG
> > document is stored for the rendering process.
>
> The Bridge builds a tree of GVT nodes from the SVG. If you
> _really_really_really_ wanted to you! could write code to build
> your own GVT tree (essentially a duplicate of the Bridge) but since
> this is much of the work of Batik doing a complete job would be
> really hard.
>
> It is also worth pointing out that SVG makes fairly heavy use
> of forward/backwards references (gradients, use, patterns, clip,
> etc). For these you really need to store the whole tree.
>
> So I would suggest using your 'light parser' to build the
> Batik DOM (if your parser supports SAX 2 with namespaces you
> can simply tell Batik to use it instead of Xerces - the default).
>
>
> >
> > Thanks a lot,
> > Sandy.
> >
> > */Cameron McCormack /* wrote:
> >
> > Hi Sandy.
> >
> > Sand Print:
> > > I am new to Batik and have just started exploring it.
> > > I am trying to understand the sequence of steps that the SVG file
> > goes
> > > thru to get rendered as an image.
> > > When the SVG f! ile gets parsed, how is it stored and how does the
> > > renderer get this data? What I mean is that is it stored as some
> > > datastructure that the renderer accepts?
> > >
> > > Urgently require an answer. Pls help.
> >
> > Have a look at the JavaDoc for the JSVGComponent class. It explains
> > the steps taken when an SVG document is loaded.
> >
> >
> http://xml.apache.org/batik/javadoc/org/apache/batik/swing/svg/JSVGComponent.html
> >
> > Cameron
> >
> > --
> > Cameron McCormack
> > | Web: http://mcc.id.au/
> > | ICQ: 26955922
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-dev-help@xml.apache.org
> >
> > Do you Yahoo!?
> > Vote for the stars of Yahoo!'s next ad campaign!
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
> <http://advision.webevents.yahoo.com/yahoo/votelifeengine/>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
Re: SVGParser to Renderer
Posted by Sand Print <wh...@yahoo.com>.
Hi Thomas,
Thanks for your reply.
Let me tell you what I am trying to do.
I have to display an SVG file on a J2ME device. That is the reason that I am trying to use a very light parser, since the size is an issue. I guess I need to strip down the Batik API to reduce the size ; as my SVG file just needs to have basic functionality of display, zooming and panning.
I was thinking that I can do it in three steps - Parse, store as some tree structure and render.
I am not sure how I can plug the parser instead of Xerces, as Batik has a while package of micro parsers.
Is the css support essential for SVG rendering... Is it necessary for basic rendering also?
Thanks a lot,
Sandy.
Thomas DeWeese <Th...@Kodak.com> wrote:Sand Print wrote:
> Thank you both for your reply.
> I looked at the steps link, Cameron- it helped.
> Following on that question, I am trying to parse an SVG file using a
> very light parser. - so I get all the elements and attributes in the SVG
> file. Now I need to stored it in some local data structure which can go
> as an input to the renderer.
The renderer essentially is the GVT tree. The input used to
construct the GVT tree is the Batik DOM (which has support for
CSS and various other stuff needed for SVG). The bridge package
takes the DOM and builds the corresponding GVT tree.
> I was going through the GVT classes. Can you tell me how the SVG
> document is stored for the rendering process.
The Bridge builds a tree of GVT nodes from the SVG. If you
_really_really_really_ wanted to you could write code to build
your own GVT tree (essentially a duplicate of the Bridge) but since
this is much of the work of Batik doing a complete job would be
really hard.
It is also worth pointing out that SVG makes fairly heavy use
of forward/backwards references (gradients, use, patterns, clip,
etc). For these you really need to store the whole tree.
So I would suggest using your 'light parser' to build the
Batik DOM (if your parser supports SAX 2 with namespaces you
can simply tell Batik to use it instead of Xerces - the default).
>
> Thanks a lot,
> Sandy.
>
> */Cameron McCormack /* wrote:
>
> Hi Sandy.
>
> Sand Print:
> > I am new to Batik and have just started exploring it.
> > I am trying to understand the sequence of steps that the SVG file
> goes
> > thru to get rendered as an image.
> > When the SVG file gets parsed, how is it stored and how does the
> > renderer get this data? What I mean is that is it stored as some
> > datastructure that the renderer accepts?
> >
> > Urgently require an answer. Pls help.
>
> Have a look at the JavaDoc for the JSVGComponent class. It explains
> the steps taken when an SVG document is loaded.
>
> http://xml.apache.org/batik/javadoc/org/apache/batik/swing/svg/JSVGComponent.html
>
> Cameron
>
> --
> Cameron McCormack
> | Web: http://mcc.id.au/
> | ICQ: 26955922
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
---------------------------------
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
Re: SVGParser to Renderer
Posted by Thomas DeWeese <Th...@Kodak.com>.
Sand Print wrote:
> Thank you both for your reply.
> I looked at the steps link, Cameron- it helped.
> Following on that question, I am trying to parse an SVG file using a
> very light parser. - so I get all the elements and attributes in the SVG
> file. Now I need to stored it in some local data structure which can go
> as an input to the renderer.
The renderer essentially is the GVT tree. The input used to
construct the GVT tree is the Batik DOM (which has support for
CSS and various other stuff needed for SVG). The bridge package
takes the DOM and builds the corresponding GVT tree.
> I was going through the GVT classes. Can you tell me how the SVG
> document is stored for the rendering process.
The Bridge builds a tree of GVT nodes from the SVG. If you
_really_really_really_ wanted to you could write code to build
your own GVT tree (essentially a duplicate of the Bridge) but since
this is much of the work of Batik doing a complete job would be
really hard.
It is also worth pointing out that SVG makes fairly heavy use
of forward/backwards references (gradients, use, patterns, clip,
etc). For these you really need to store the whole tree.
So I would suggest using your 'light parser' to build the
Batik DOM (if your parser supports SAX 2 with namespaces you
can simply tell Batik to use it instead of Xerces - the default).
>
> Thanks a lot,
> Sandy.
>
> */Cameron McCormack <ca...@aka.mcc.id.au>/* wrote:
>
> Hi Sandy.
>
> Sand Print:
> > I am new to Batik and have just started exploring it.
> > I am trying to understand the sequence of steps that the SVG file
> goes
> > thru to get rendered as an image.
> > When the SVG file gets parsed, how is it stored and how does the
> > renderer get this data? What I mean is that is it stored as some
> > datastructure that the renderer accepts?
> >
> > Urgently require an answer. Pls help.
>
> Have a look at the JavaDoc for the JSVGComponent class. It explains
> the steps taken when an SVG document is loaded.
>
> http://xml.apache.org/batik/javadoc/org/apache/batik/swing/svg/JSVGComponent.html
>
> Cameron
>
> --
> Cameron McCormack
> | Web: http://mcc.id.au/
> | ICQ: 26955922
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
> <http://advision.webevents.yahoo.com/yahoo/votelifeengine/>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
Re: SVGParser to Renderer
Posted by Sand Print <wh...@yahoo.com>.
Thank you both for your reply.
I looked at the steps link, Cameron- it helped.
Following on that question, I am trying to parse an SVG file using a very light parser. - so I get all the elements and attributes in the SVG file. Now I need to stored it in some local data structure which can go as an input to the renderer.
I was going through the GVT classes. Can you tell me how the SVG document is stored for the rendering process.
Thanks a lot,
Sandy.
Cameron McCormack <ca...@aka.mcc.id.au> wrote:
Hi Sandy.
Sand Print:
> I am new to Batik and have just started exploring it.
> I am trying to understand the sequence of steps that the SVG file goes
> thru to get rendered as an image.
> When the SVG file gets parsed, how is it stored and how does the
> renderer get this data? What I mean is that is it stored as some
> datastructure that the renderer accepts?
>
> Urgently require an answer. Pls help.
Have a look at the JavaDoc for the JSVGComponent class. It explains
the steps taken when an SVG document is loaded.
http://xml.apache.org/batik/javadoc/org/apache/batik/swing/svg/JSVGComponent.html
Cameron
--
Cameron McCormack
| Web: http://mcc.id.au/
| ICQ: 26955922
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
---------------------------------
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
Re: SVGParser to Renderer
Posted by Cameron McCormack <ca...@aka.mcc.id.au>.
Hi Sandy.
Sand Print:
> I am new to Batik and have just started exploring it.
> I am trying to understand the sequence of steps that the SVG file goes
> thru to get rendered as an image.
> When the SVG file gets parsed, how is it stored and how does the
> renderer get this data? What I mean is that is it stored as some
> datastructure that the renderer accepts?
>
> Urgently require an answer. Pls help.
Have a look at the JavaDoc for the JSVGComponent class. It explains
the steps taken when an SVG document is loaded.
http://xml.apache.org/batik/javadoc/org/apache/batik/swing/svg/JSVGComponent.html
Cameron
--
Cameron McCormack
| Web: http://mcc.id.au/
| ICQ: 26955922
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org