You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Gang Su <su...@umich.edu> on 2007/06/13 21:51:36 UTC

Question on Render Portion of a SVG

Dear users,

 

 

I am new to Batik and found it a great package for SVG.

I have a question. Is it possible for me to use Batik to render portion of a
huge SVG?

For example, I can define a huge SVG (1,000,000 * 1,000,000), and want to
render 100*100 tiles progressively.

Is it possible?

Thank you very much for the help!

And I would like to join the mailing list. Thank you!

 

Gang Su

Bioinformatics Student

University of Michigan, Ann Arbor 


RE: Question on Render Portion of a SVG

Posted by th...@kodak.com.
Hi Gang,

"Gang Su" <su...@umich.edu> wrote on 06/18/2007 04:50:06 PM:

> Thank you very much for your solution it worked perfectly!!
> Another question is if it is possible to truncate a large svg into small
> tile svgs? For example, I can define a huge svg, what if I want to 
convert
> the large SVG into small tiles?

   This is software, anything is _possible_. :)
 
   There are two main ways to go with this.  First you could
use the SVGGraphics2D rather than a Graphics2D from a BufferedImage
for drawing the GVT tree (you can look at transcoder source).

   The other way would be to use the SVG DOM to identify all
the SVG elements that intersect a rectangle using 
SVGElement.getIntersectionList.  This can be used from Java
or from Script.

> If this tiling is possible, a more difficult question is if one large
> element can be divided into tiles, is it possible for the tiles to 
maintain
> the embedded hyper link, even the embedded scripting? 

  Once you have the list of elements that should
be displayed you can build any document you want (by cloning
the intersection elements), including doing things like adding 
a predefined script block and/or a defs section.

   Some care needs to be taken when doing that if the script
block depends on document structure or certain 'id's being
present.

   Hyper links aren't a problem, unless the hyper link used to
point into the 'full' SVG document, in which case it might be a
lot of work to figure out what tile it should point at now.


> Thank you again for the great help!
> Have a great day,
> 
> Gang
> 
> -----Original Message-----
> From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> Sent: Saturday, June 16, 2007 7:49 AM
> To: batik-users@xmlgraphics.apache.org
> Cc: batik-users@xmlgraphics.apache.org
> Subject: Re: Question on Render Portion of a SVG
> 
> Hi Gang,
> 
> "Gang Su" <su...@umich.edu> wrote on 06/13/2007 03:51:36 PM:
> 
> > I am new to Batik and found it a great package for SVG.
> > I have a question. Is it possible for me to use Batik to render 
> > portion of a huge SVG?
> 
>    Yes.
> 
> > For example, I can define a huge SVG (1,000,000 * 1,000,000), and 
> > want to render 100*100 tiles progressively.
> > Is it possible?
> 
>    Yes, you can do this.  The simplest way would be to use
> the SVG Transcoders with an aoi for each 100x100 block.
> However, this will rebuild the graphics tree for each 100x100
> block, so it may be very slow.
> 
>    So a faster way would be to create the Graphics tree once
> and repeatedly call 'paint' on the root graphics node.
> I would construct a 100x100 BufferedImage, get a Graphics2D
> from it and just translate the Graphics2D for each block.
> 
>    There is example code for building the Graphics tree on
> the Wiki.  You may also find it useful to look at the code
> for the Image transcoders (batik.transcoder.image) to understand
> how to save the BufferedImage when you are done.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


RE: Question on Render Portion of a SVG

Posted by Gang Su <su...@umich.edu>.
Hi Thomas,

Thank you very much for your solution it worked perfectly!!
Another question is if it is possible to truncate a large svg into small
tile svgs? For example, I can define a huge svg, what if I want to convert
the large SVG into small tiles?
If this tiling is possible, a more difficult question is if one large
element can be divided into tiles, is it possible for the tiles to maintain
the embedded hyper link, even the embedded scripting? 
Thank you again for the great help!
Have a great day,

Gang

-----Original Message-----
From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Sent: Saturday, June 16, 2007 7:49 AM
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: Re: Question on Render Portion of a SVG

Hi Gang,

"Gang Su" <su...@umich.edu> wrote on 06/13/2007 03:51:36 PM:

> I am new to Batik and found it a great package for SVG.
> I have a question. Is it possible for me to use Batik to render 
> portion of a huge SVG?

   Yes.

> For example, I can define a huge SVG (1,000,000 * 1,000,000), and 
> want to render 100*100 tiles progressively.
> Is it possible?

   Yes, you can do this.  The simplest way would be to use
the SVG Transcoders with an aoi for each 100x100 block.
However, this will rebuild the graphics tree for each 100x100
block, so it may be very slow.

   So a faster way would be to create the Graphics tree once
and repeatedly call 'paint' on the root graphics node.
I would construct a 100x100 BufferedImage, get a Graphics2D
from it and just translate the Graphics2D for each block.

   There is example code for building the Graphics tree on
the Wiki.  You may also find it useful to look at the code
for the Image transcoders (batik.transcoder.image) to understand
how to save the BufferedImage when you are done.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Question on Render Portion of a SVG

Posted by th...@kodak.com.
Hi Gang,

"Gang Su" <su...@umich.edu> wrote on 06/13/2007 03:51:36 PM:

> I am new to Batik and found it a great package for SVG.
> I have a question. Is it possible for me to use Batik to render 
> portion of a huge SVG?

   Yes.

> For example, I can define a huge SVG (1,000,000 * 1,000,000), and 
> want to render 100*100 tiles progressively.
> Is it possible?

   Yes, you can do this.  The simplest way would be to use
the SVG Transcoders with an aoi for each 100x100 block.
However, this will rebuild the graphics tree for each 100x100
block, so it may be very slow.

   So a faster way would be to create the Graphics tree once
and repeatedly call 'paint' on the root graphics node.
I would construct a 100x100 BufferedImage, get a Graphics2D
from it and just translate the Graphics2D for each block.

   There is example code for building the Graphics tree on
the Wiki.  You may also find it useful to look at the code
for the Image transcoders (batik.transcoder.image) to understand
how to save the BufferedImage when you are done.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org