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 Jake B <ot...@gmail.com> on 2007/04/23 17:55:04 UTC

changing Swing to use SVGGraphics2D

Hi, I'm just getting started with Batik, and I'm trying to get a sense of
what it can do. Specifically, I have a question regarding the SVGGraphics2D
SVG generator. It says on the Batik webpage, that SVGGraphics2D is a
generator "that creates an SVG document from Java2D calls".
My understanding of Java Swing is that it "paints" graphical user interfaces
through calls to the Java2D API.
The core Java libraries, including Swing, have been released under the JLP
(I think), which allows reuse in academic research. I also believe that Sun
is supposed to release the remainder of the Java source under the GPL later
this year. In any case, the source code to Swing is exposed and modifiable.
My question is, would it be feasible to modify Swing so that, instead of
calling the Java2D API, it calls the SVGGraphics2D API? Does SVGGraphics2D
API implement the Java2D API? Does it do so fully?
If anyone has any insight into this, I would greatly appreciate it if you
would let me know.
Thanks.

-Jake

Re: changing Swing to use SVGGraphics2D

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

"Jake B" <ot...@gmail.com> wrote on 04/28/2007 12:05:52 PM:

> Do you know if anyone has implemented this? It seems like this idea 
> would be useful for two reasons:

   Ok, what you are after is different from what I first thought.
The Swing Widgets are designed to draw everything when something
changes.  They really aren't designed to work with SVG where they
should really only update the (usually small) number of elements
that actually changed.

   Put another way to really do what you want you would have to
do more than just use the SVGGraphics2D within the Swing tree.
The Swing components would have to become SVG aware which would
probably be a big undertaking.

> 1. It would provide a rich set of widgets, and a well-known GUI 
> framework, for building user interfaces in SVG. It should be noted 
> that people have tried to build such a toolkit from scratch, with 
> fairly unimpressive results: 
http://networkimprov.net/airwrx/awscene.html , 
> http://spark.sourceforge.net/ 

> 2. It could be used in combination with the XMLHttpRequest object 
> and JavaScript event handling to provide a super-minimal, web-based 
> user interface that looks like Swing. 
> Please let me know if any work has been done on this.

   Ohh, so you are looking to remote the swing UI.  This might work
but you will probably need to do some work to avoid sending the entire
UI SVG every time.

> On 4/27/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
> Hi Jake,
> 
> "Jake B" <ot...@gmail.com> wrote on 04/23/2007 11:55:04 AM:
> 
> > I'm just getting started with Batik, and I'm trying to get a
> > sense of what it can do. Specifically, I have a question regarding
> > the SVGGraphics2D SVG generator. It says on the Batik webpage, that
> > SVGGraphics2D is a generator "that creates an SVG document from 
> > Java2D calls".
> > My understanding of Java Swing is that it "paints" graphical user
> > interfaces through calls to the Java2D API.
> 
>    Correct.
> 
> > The core Java libraries, including Swing, have been released under 
> > the JLP (I think), which allows reuse in academic research. I also
> > believe that Sun is supposed to release the remainder of the Java
> > source under the GPL later this year. In any case, the source code 
> > to Swing is exposed and modifiable.
> > My question is, would it be feasible to modify Swing so that,
> > instead of calling the Java2D API, it calls the SVGGraphics2D API?
> 
>     Yes, this is actually quite simple.  You can call the paint 
> method on any Swing component.  There are a few things you need
> to be careful of (like swing double buffering).  Also Batik
> provides a helper class, batik.svggen.SwingSVGPrettyPrint.
> 
> > Does SVGGraphics2D API implement the Java2D API? Does it do so fully? 
> 
>    It is nearly complete however there are a few corner cases
> that can't really be mapped to SVG.  But the coverage is very good.
> 
> > If anyone has any insight into this, I would greatly appreciate it 
> > if you would let me know.
> > Thanks.
> >
> > -Jake
> 
> ---------------------------------------------------------------------
> 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: changing Swing to use SVGGraphics2D

Posted by Jake B <ot...@gmail.com>.
Do you know if anyone has implemented this? It seems like this idea would be
useful for two reasons:

   1. It would provide a rich set of widgets, and a well-known GUI
   framework, for building user interfaces in SVG. It should be noted that
   people have tried to build such a toolkit from scratch, with fairly
   unimpressive results: http://networkimprov.net/airwrx/awscene.html ,
   http://spark.sourceforge.net/
   2. It could be used in combination with the XMLHttpRequest object and
   JavaScript event handling to provide a super-minimal, web-based user
   interface that looks like Swing.

Please let me know if any work has been done on this.
Thanks.

-Jake

On 4/27/07, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
> Hi Jake,
>
> "Jake B" <ot...@gmail.com> wrote on 04/23/2007 11:55:04 AM:
>
> > I'm just getting started with Batik, and I'm trying to get a
> > sense of what it can do. Specifically, I have a question regarding
> > the SVGGraphics2D SVG generator. It says on the Batik webpage, that
> > SVGGraphics2D is a generator "that creates an SVG document from
> > Java2D calls".
> > My understanding of Java Swing is that it "paints" graphical user
> > interfaces through calls to the Java2D API.
>
>    Correct.
>
> > The core Java libraries, including Swing, have been released under
> > the JLP (I think), which allows reuse in academic research. I also
> > believe that Sun is supposed to release the remainder of the Java
> > source under the GPL later this year. In any case, the source code
> > to Swing is exposed and modifiable.
> > My question is, would it be feasible to modify Swing so that,
> > instead of calling the Java2D API, it calls the SVGGraphics2D API?
>
>     Yes, this is actually quite simple.  You can call the paint
> method on any Swing component.  There are a few things you need
> to be careful of (like swing double buffering).  Also Batik
> provides a helper class, batik.svggen.SwingSVGPrettyPrint.
>
> > Does SVGGraphics2D API implement the Java2D API? Does it do so fully?
>
>    It is nearly complete however there are a few corner cases
> that can't really be mapped to SVG.  But the coverage is very good.
>
> > If anyone has any insight into this, I would greatly appreciate it
> > if you would let me know.
> > Thanks.
> >
> > -Jake
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

Re: changing Swing to use SVGGraphics2D

Posted by Jacob <ot...@gmail.com>.
Is there any sample code that uses SwingSVGPrettyPrint?

-Jake

thomas.deweese@kodak.com wrote:
> Hi Jake,
>
> "Jake B" <ot...@gmail.com> wrote on 04/23/2007 11:55:04 AM:
>
>   
>> I'm just getting started with Batik, and I'm trying to get a 
>> sense of what it can do. Specifically, I have a question regarding 
>> the SVGGraphics2D SVG generator. It says on the Batik webpage, that 
>> SVGGraphics2D is a generator "that creates an SVG document from 
>> Java2D calls". 
>> My understanding of Java Swing is that it "paints" graphical user 
>> interfaces through calls to the Java2D API. 
>>     
>
>    Correct.
>
>   
>> The core Java libraries, including Swing, have been released under 
>> the JLP (I think), which allows reuse in academic research. I also 
>> believe that Sun is supposed to release the remainder of the Java 
>> source under the GPL later this year. In any case, the source code 
>> to Swing is exposed and modifiable. 
>> My question is, would it be feasible to modify Swing so that, 
>> instead of calling the Java2D API, it calls the SVGGraphics2D API? 
>>     
>
>     Yes, this is actually quite simple.  You can call the paint
> method on any Swing component.  There are a few things you need
> to be careful of (like swing double buffering).  Also Batik
> provides a helper class, batik.svggen.SwingSVGPrettyPrint.
>
>   
>> Does SVGGraphics2D API implement the Java2D API? Does it do so fully?
>>     
>
>    It is nearly complete however there are a few corner cases
> that can't really be mapped to SVG.  But the coverage is very good.
>
>   
>> If anyone has any insight into this, I would greatly appreciate it 
>> if you would let me know. 
>> Thanks.
>>
>> -Jake
>>     
>
> ---------------------------------------------------------------------
> 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: changing Swing to use SVGGraphics2D

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

"Jake B" <ot...@gmail.com> wrote on 04/23/2007 11:55:04 AM:

> I'm just getting started with Batik, and I'm trying to get a 
> sense of what it can do. Specifically, I have a question regarding 
> the SVGGraphics2D SVG generator. It says on the Batik webpage, that 
> SVGGraphics2D is a generator "that creates an SVG document from 
> Java2D calls". 
> My understanding of Java Swing is that it "paints" graphical user 
> interfaces through calls to the Java2D API. 

   Correct.

> The core Java libraries, including Swing, have been released under 
> the JLP (I think), which allows reuse in academic research. I also 
> believe that Sun is supposed to release the remainder of the Java 
> source under the GPL later this year. In any case, the source code 
> to Swing is exposed and modifiable. 
> My question is, would it be feasible to modify Swing so that, 
> instead of calling the Java2D API, it calls the SVGGraphics2D API? 

    Yes, this is actually quite simple.  You can call the paint
method on any Swing component.  There are a few things you need
to be careful of (like swing double buffering).  Also Batik
provides a helper class, batik.svggen.SwingSVGPrettyPrint.

> Does SVGGraphics2D API implement the Java2D API? Does it do so fully?

   It is nearly complete however there are a few corner cases
that can't really be mapped to SVG.  But the coverage is very good.

> If anyone has any insight into this, I would greatly appreciate it 
> if you would let me know. 
> Thanks.
> 
> -Jake

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