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 prad <pr...@yahoo.co.in> on 2006/10/05 04:07:15 UTC

sensitive bounding box of svg document

Hi ,

I have a sensitive bounding box of svg document (-1044.5 , -1370.5 ,   
3220.0 , 2176.0)....From this rectangle i need to take out one rectangle
with the specified x,y,width and height ...say(-1044.5 -1370.5  600 600) and
write it to a file.Is it possible and how can i achieve it. 

Thanks & Regards
Prad
-- 
View this message in context: http://www.nabble.com/sensitive-bounding-box-of-svg-document-tf2386150.html#a6651630
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: sensitive bounding box of svg document

Posted by "V. de Weger" <ba...@beno-delft.nl>.
Prad, I've never used the tool but there seems to be some overlap between
you're question and this article:

http://www.svgopen.org/2005/papers/VectorAndRasterTilesForMappingApplications/index.html

Vincent


prad wrote:
> 
> Hi ,
> 
> I have a sensitive bounding box of svg document (-1044.5 , -1370.5 ,   
> 3220.0 , 2176.0)....From this rectangle i need to take out one rectangle
> with the specified x,y,width and height ...say(-1044.5 -1370.5  600 600)
> and write it to a file.Is it possible and how can i achieve it. 
> 
> Thanks & Regards
> Prad
> 

-- 
View this message in context: http://www.nabble.com/sensitive-bounding-box-of-svg-document-tf2386150.html#a6668583
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: sensitive bounding box of svg document

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

prad <pr...@yahoo.co.in> wrote on 10/11/2006 03:32:54 AM:

> Am getting little bit confused...Can u explain me the first method u ie
> ...Read the SVG, build the GVT tree, construct an SVGGraphics2D, set the
> clip on the SVGGraphics2D to the desired output rect, pass the 
Graphics2D
> to the paint on the root of the GVT tree and serialize with some code
> sample......'ll be very greatful to u

   I don't know how to explain this any better.  I would suggest that you
try writing the code and post what you get and I'll comment on that.

> thomas.deweese wrote:
> > 
> > Hi Prad,
> > 
> > prad <pr...@yahoo.co.in> wrote on 10/04/2006 10:07:15 PM:
> > 
> >> I have a sensitive bounding box of svg document (-1044.5 , -1370.5 , 
> >> 3220.0 , 2176.0)....From this rectangle i need to take out one 
rectangle
> >> with the specified x,y,width and height ...say(-1044.5 -1370.5  600 
600) 
> > and
> >> write it to a file.Is it possible and how can i achieve it. 
> > 
> >    There is no pre-packaged way to do this in Batik.  There are three
> > main options I can think of off the top of my head:
> > 
> >         1) Read the SVG, build the GVT tree, construct an 
SVGGraphics2D 
> > set the
> >          clip on the SVGGraphics2D to the desired output rect, pass 
the
> >            Graphics2D to the paint on the root of the GVT tree and 
> > serialize
> >          the result in the Graphics2D.  This is the least work.
> > 
> >         2) Read the SVG, boot the SVG DOM.  Walk the SVG document and 
> > check BBox's
> >          for intersection with your area of interest (don't forget to 
take 
> > into
> >            account transforms).  Copy elements that intersect to a new 

> > document 
> >          (or a new 'sub tree' DOM).
> > 
> >         3) Do #2, but when a shape's BBox intersects the area of 
interest
> >            check if it is a "path", if so parse it's 'd' attribute 
into a
> >            GeneralPath (using batik.parser.PathParser) and use the 
Java2D
> >            Area class to intersect the GeneralPath with the clip box 
and
> >            then serialize the resultant path into a new 'd' attribute 
and
> >            use that instead for the copied element.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
http://www.nabble.com/sensitive-bounding-box-of-
> svg-document-tf2386150.html#a6751688
> Sent from the Batik - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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: sensitive bounding box of svg document

Posted by prad <pr...@yahoo.co.in>.
Hi Thomas,

Am getting little bit confused...Can u explain me the first method u ie
...Read the SVG, build the GVT tree, construct an SVGGraphics2D, set the
clip on the SVGGraphics2D to the desired output rect, pass the  Graphics2D
to the paint on the root of the GVT tree and serialize with some code
sample......'ll be very greatful to u

Thanks & regards
Prad
         the result in the Graphics2D.

thomas.deweese wrote:
> 
> Hi Prad,
> 
> prad <pr...@yahoo.co.in> wrote on 10/04/2006 10:07:15 PM:
> 
>> I have a sensitive bounding box of svg document (-1044.5 , -1370.5 , 
>> 3220.0 , 2176.0)....From this rectangle i need to take out one rectangle
>> with the specified x,y,width and height ...say(-1044.5 -1370.5  600 600) 
> and
>> write it to a file.Is it possible and how can i achieve it. 
> 
>    There is no pre-packaged way to do this in Batik.  There are three
> main options I can think of off the top of my head:
> 
>         1) Read the SVG, build the GVT tree, construct an SVGGraphics2D 
> set the
>          clip on the SVGGraphics2D to the desired output rect, pass the
>            Graphics2D to the paint on the root of the GVT tree and 
> serialize
>          the result in the Graphics2D.  This is the least work.
> 
>         2) Read the SVG, boot the SVG DOM.  Walk the SVG document and 
> check BBox's
>          for intersection with your area of interest (don't forget to take 
> into
>            account transforms).  Copy elements that intersect to a new 
> document 
>          (or a new 'sub tree' DOM).
> 
>         3) Do #2, but when a shape's BBox intersects the area of interest
>            check if it is a "path", if so parse it's 'd' attribute into a
>            GeneralPath (using batik.parser.PathParser) and use the Java2D
>            Area class to intersect the GeneralPath with the clip box and
>            then serialize the resultant path into a new 'd' attribute and
>            use that instead for the copied element.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/sensitive-bounding-box-of-svg-document-tf2386150.html#a6751688
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: sensitive bounding box of svg document

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

prad <pr...@yahoo.co.in> wrote on 10/04/2006 10:07:15 PM:

> I have a sensitive bounding box of svg document (-1044.5 , -1370.5 , 
> 3220.0 , 2176.0)....From this rectangle i need to take out one rectangle
> with the specified x,y,width and height ...say(-1044.5 -1370.5  600 600) 
and
> write it to a file.Is it possible and how can i achieve it. 

   There is no pre-packaged way to do this in Batik.  There are three
main options I can think of off the top of my head:

        1) Read the SVG, build the GVT tree, construct an SVGGraphics2D 
set the
         clip on the SVGGraphics2D to the desired output rect, pass the
           Graphics2D to the paint on the root of the GVT tree and 
serialize
         the result in the Graphics2D.  This is the least work.

        2) Read the SVG, boot the SVG DOM.  Walk the SVG document and 
check BBox's
         for intersection with your area of interest (don't forget to take 
into
           account transforms).  Copy elements that intersect to a new 
document 
         (or a new 'sub tree' DOM).

        3) Do #2, but when a shape's BBox intersects the area of interest
           check if it is a "path", if so parse it's 'd' attribute into a
           GeneralPath (using batik.parser.PathParser) and use the Java2D
           Area class to intersect the GeneralPath with the clip box and
           then serialize the resultant path into a new 'd' attribute and
           use that instead for the copied element.


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