Hi Gang, "Gang Su" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Saturday, June 16, 2007 7:49 AM > To: [email protected] > Cc: [email protected] > Subject: Re: Question on Render Portion of a SVG > > Hi Gang, > > "Gang Su" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
