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 nuka <nu...@gmail.com> on 2007/07/23 14:27:59 UTC
SVGGraphics2D clipRect method
Hi,
I use clipRect method of SVGGraphics2D in order two generate 2 pieces of svg
(I've created a JGraph object and I want to export it in 2 svg bundle).
JGraph is a java library for drawing graphs.
int xclip = 0;
int yclip = 0;
int widthclip = 640;
int heightclip = 480;
for(int i=0;i<2;i++)
{
svgdoc.clipRect(xclip, yclip, widthclip, heightclip);
svgdoc.translate(0, 0);
graph.paint(svgdoc);
baos = new ByteArrayOutputStream();
wrt = new OutputStreamWriter(baos, "UTF-8");
svgdoc.stream(wrt, false);
wrt.flush();
svgs[i] = writeNS(new String(baos.toByteArray()));
yclip += heightPx;
}
The first svg bundle is ok, the second one displays nothing.
I don't know if I use clipRect method in a wrong way. Or maybe translate.
Any hint is welcome.
thanks a lot.
--
View this message in context: http://www.nabble.com/SVGGraphics2D-clipRect-method-tf4129360.html#a11742681
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: SVGGraphics2D clipRect method
Posted by nuka <nu...@gmail.com>.
Hi,
I've found what is wrong - after the first loop the clip must be set to
null, svgdoc.setClip(null);
thanks a lot
Nuka
Thomas Behr-2 wrote:
>
> Hi nuka,
>
> your problem could be related to the fact that you "move" your clip not
> by its height but some other value:
> yclip += heightPx;
> instead of
> yclip += heightclip;
>
> Regards, Thomas
>
>
> nuka wrote:
>> Hi,
>>
>> I use clipRect method of SVGGraphics2D in order two generate 2 pieces of
>> svg
>> (I've created a JGraph object and I want to export it in 2 svg bundle).
>> JGraph is a java library for drawing graphs.
>>
>> int xclip = 0;
>> int yclip = 0;
>> int widthclip = 640;
>> int heightclip = 480;
>> for(int i=0;i<2;i++)
>> {
>> svgdoc.clipRect(xclip, yclip, widthclip, heightclip);
>> svgdoc.translate(0, 0);
>>
>> graph.paint(svgdoc);
>> baos = new ByteArrayOutputStream();
>> wrt = new OutputStreamWriter(baos, "UTF-8");
>> svgdoc.stream(wrt, false);
>>
>> wrt.flush();
>> svgs[i] = writeNS(new String(baos.toByteArray()));
>> yclip += heightPx;
>> }
>>
>>
>> The first svg bundle is ok, the second one displays nothing.
>>
>> I don't know if I use clipRect method in a wrong way. Or maybe translate.
>>
>> Any hint is welcome.
>>
>> thanks a lot.
>>
>
> --
> Thomas Behr
> yWorks GmbH
> Vor dem Kreuzberg 28
> 72070 Tuebingen, Germany
> Tel.: +49 7071 9709050
> Fax.: +49 7071 9709051
>
>
> ---------------------------------------------------------------------
> 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/SVGGraphics2D-clipRect-method-tf4129360.html#a11747006
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: SVGGraphics2D clipRect method
Posted by Thomas Behr <th...@yworks.com>.
Hi nuka,
your problem could be related to the fact that you "move" your clip not
by its height but some other value:
yclip += heightPx;
instead of
yclip += heightclip;
Regards, Thomas
nuka wrote:
> Hi,
>
> I use clipRect method of SVGGraphics2D in order two generate 2 pieces of svg
> (I've created a JGraph object and I want to export it in 2 svg bundle).
> JGraph is a java library for drawing graphs.
>
> int xclip = 0;
> int yclip = 0;
> int widthclip = 640;
> int heightclip = 480;
> for(int i=0;i<2;i++)
> {
> svgdoc.clipRect(xclip, yclip, widthclip, heightclip);
> svgdoc.translate(0, 0);
>
> graph.paint(svgdoc);
> baos = new ByteArrayOutputStream();
> wrt = new OutputStreamWriter(baos, "UTF-8");
> svgdoc.stream(wrt, false);
>
> wrt.flush();
> svgs[i] = writeNS(new String(baos.toByteArray()));
> yclip += heightPx;
> }
>
>
> The first svg bundle is ok, the second one displays nothing.
>
> I don't know if I use clipRect method in a wrong way. Or maybe translate.
>
> Any hint is welcome.
>
> thanks a lot.
>
--
Thomas Behr
yWorks GmbH
Vor dem Kreuzberg 28
72070 Tuebingen, Germany
Tel.: +49 7071 9709050
Fax.: +49 7071 9709051
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org