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 Brian Kwan <gb...@hotmail.com> on 2004/02/16 02:55:09 UTC

How to transform SVG to Java Graphics2D

System Configuration:
Operating System: Microsoft Windows 2000 Professional
JDK Version: J2SDK 1.4.2_03
Batik Version: Batik 1.5

Problem Description:
How to transform SVG into Java Graphics2D? Have tried to transform into JPEG
and then used it by ImageIcon of Java, but there is a problem, for example,
there is a svg drawing with canvas size 100 * 100, but the shape only have
used 50 * 50 space of canvas, so as it transform into JPEG, it would become
a graphics with original size. So even using scaling the resize its size, as
the size of canvas is relative big to the shape, so the drawing resize, it
would become much smaller, and even cannot see the shape. what is more,
graphics2d don't have method to "cut" the blank space of the graphics.

Thanks for answering.

Regards

_________________________________________________________________
Linguaphone :  Learning English? Get Japanese lessons for FREE 
http://go.msnserver.com/HK/30476.asp


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


Re: How to transform SVG to Java Graphics2D

Posted by Bibek Sahu <sc...@dodds.net>.
Howdy,

The easiest way would probably be to use the SVGIcon that I wrote.  It
still needs a little polishing, but it sounds like what's there is
sufficient for your needs.  You'll need two files:

SVGIcon.java: http://cvs.lessonbuilder.sourceforge.net/viewcvs.py/*checkout*/lessonbuilder/LessonBuilder/src/org/globalcircle/svg/SVGIcon.java?rev=1.4
SVGImageConverter.java: http://cvs.lessonbuilder.sourceforge.net/viewcvs.py/*checkout*/lessonbuilder/LessonBuilder/src/org/globalcircle/svg/SVGImageConverter.java?rev=1.1

Good luck,
Bibek

On Mon, 16 Feb 2004, Brian Kwan wrote:

> System Configuration:
> Operating System: Microsoft Windows 2000 Professional
> JDK Version: J2SDK 1.4.2_03
> Batik Version: Batik 1.5
>
> Problem Description:
> How to transform SVG into Java Graphics2D? Have tried to transform into JPEG
> and then used it by ImageIcon of Java, but there is a problem, for example,
> there is a svg drawing with canvas size 100 * 100, but the shape only have
> used 50 * 50 space of canvas, so as it transform into JPEG, it would become
> a graphics with original size. So even using scaling the resize its size, as
> the size of canvas is relative big to the shape, so the drawing resize, it
> would become much smaller, and even cannot see the shape. what is more,
> graphics2d don't have method to "cut" the blank space of the graphics.
>
> Thanks for answering.
>
> Regards
>
> _________________________________________________________________
> Linguaphone :  Learning English? Get Japanese lessons for FREE
> http://go.msnserver.com/HK/30476.asp
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>


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