Bug 566565 - Extend SVG support to Nebula
Summary: Extend SVG support to Nebula
Status: CLOSED MOVED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-01 12:36 EDT by Wim Jongman CLA
Modified: 2021-07-05 11:39 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wim Jongman CLA 2020-09-01 12:36:47 EDT
Nebula currently handles SVG inside the o.e.n.cwt project. We would like to extract these classes into their own project and make the SWT/SVG library as complete as possible. 

AFAI could find, there are no real independent SVG implementations for SWT.

* People use Batik to render SVG into an image and then display this image inside an SWT canvas.

* GMF has some support [1]

* Java Swing/AWT implementation [2]


[1] https://git.eclipse.org/c/gmf-tooling/org.eclipse.gmf-tooling.git/tree/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg

[2] https://github.com/jfree/jfreesvg
Comment 1 Laurent CARON CLA 2020-09-12 13:00:41 EDT
Hi Wim

How about embed JFreeSVG with SWT/AWT bridge ?
Comment 2 Laurent CARON CLA 2020-09-12 13:03:22 EDT
Another idea : embed a JavaFX WebView ?
Comment 3 Wim Jongman CLA 2020-09-17 07:36:16 EDT
I'm looking for a native SWT implementation. Edward expressed interest in working on this. Edward, let me know if you need some pointers to get started.
Comment 4 Laurent CARON CLA 2020-09-17 13:11:57 EDT
Ok I understand,

I'll have a look this week to check if a port of JFreeSVG is conceivable.
Comment 5 Wim Jongman CLA 2020-09-17 13:20:36 EDT
(In reply to Laurent CARON from comment #1)
> Hi Wim
> 
> How about embed JFreeSVG with SWT/AWT bridge ?

Thanks, Laurent! Maybe you can work with Edward?  The plan is to move the existing svg support from cwt into its own widget.
Comment 6 Laurent CARON CLA 2020-09-17 15:44:59 EDT
I think a mix between JFreeSVG & SWT/AWT should be reasonable.

Stay tuned ;)
Comment 7 Edward Francis CLA 2020-09-21 23:02:46 EDT
(In reply to Wim Jongman from comment #3)
> I'm looking for a native SWT implementation. Edward expressed interest in
> working on this. Edward, let me know if you need some pointers to get
> started.

Wim, I am interested.  I've never contributed to anything like this, so I am definitely interested in some pointers.  Thanks.
Comment 8 Wim Jongman CLA 2020-10-20 12:49:08 EDT
(In reply to Edward Francis from comment #7)
> (In reply to Wim Jongman from comment #3)
> > I'm looking for a native SWT implementation. Edward expressed interest in
> > working on this. Edward, let me know if you need some pointers to get
> > started.
> 
> Wim, I am interested.  I've never contributed to anything like this, so I am
> definitely interested in some pointers.  Thanks.

Hey Edward, sorry for the delay. 

If you take a look at the filestructure of Nebula, you will see that each project has its own directory inside the widgets directory.

I think for now, we can create a new project o.e.nebula.cwt.svg inside the CWT widget that will be used to isolate the SVG code. 

Then we will need to add this new project to the CWT feature.
Comment 9 Laurent CARON CLA 2020-11-01 10:18:31 EST
I worked on the subject. Unfortunately, JFreeSVG can only output SVG documents, it cannot render existing SVG files within Java application.

If one wants to display SVG files in Java, the only solution is Apache Batik (SVGSalamender [1] is not an alternative because it has not been updated for years).

I'll work on a SWT Control that embeb a Batik Control viewer (with SWT/AWT).

Is there any legal issues ? (Apache Licence VS EPL 2) ?

Cheers,
Laurent


[1] = https://github.com/blackears/svgSalamander
Comment 10 Wim Jongman CLA 2020-11-01 10:49:31 EST
Laurent, please take a look at bug 568215
Comment 11 Laurent CARON CLA 2020-11-01 11:22:44 EST
(In reply to Wim Jongman from comment #10)
> Laurent, please take a look at bug 568215

Very intersting, thanks !
Comment 12 Christoph Laeubrich CLA 2020-11-01 11:52:32 EST
Simply providing a widget that shows/renders a SVG using batik is rather trivial. But SVG is more than a vector format, it allows styling via css (internal and external), animation and even live DOM manipulation.

All this makes it very hard to write a feature complete library (even batik is not feature complete!). So if one really likes to support an "SVG Widget" it should at least support basic interaction (something similar to what Inkscape does).

I have written a very basic SWT Render for Batik, but the SWT GC is just to limited to support some of the SVG features so a lot of things have to be emulated. So from my point of view it makes sense to simply render the SVG into BufferedImage and the display thins inside some kind of SWT Widget that support all the other fancy stuff.

There is one alternative (even though I never have never evaluated it):
As SWT allows to integrate native widgets and Inkscape is available for Win/Linux/Mac it MIGHT be possible to create some kind of integration with inskcape using as a renderer as well.

So in my opinion, the very first question should be: What should this SVG support?
- plain rendering/scaling of static svg?
- should DOM manipulation/CSS styl editing be supported (beside a simple "redraw all" operation
- do we want interactions with the DOM (event handlers?)
- do we need some kind of editing capability (SVG editor)
- what about animation support

all of these are non trivial tasks and writing it from scratch, so if anything is missing from Batik it makes more sense to contribute there.
Comment 13 Laurent CARON CLA 2021-06-20 06:09:29 EDT
Postponed to V2.6.0
Comment 14 Laurent CARON CLA 2021-06-25 06:45:30 EDT
Moved to Github : https://github.com/eclipse/nebula/issues/353