Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Generic Image Export
Generic Image Export [message #203790] Mon, 28 November 2005 10:18 Go to next message
Thomas Maier is currently offline Thomas MaierFriend
Messages: 117
Registered: July 2009
Senior Member
Hi all,

I have thought about exporting GEF diagrams to "images" in several
formats in a generic and extensible way. I have implemented an
architecture that divides the whole thing into several plug ins and
would like to ask you gurus for comments on that. What follows is a
description of what I did/would like to do.

We have hacked in export support for the following formats:
- the two bitmap formats supported by SWT (JPEG and BMP)
- PDF export using itext (partially implemented)
- SVG export using batik (should be partially implemented)

Now I thought about polishing it all up and putting it on sourceforge.
We are using third-party software to generate PDF and SVG. Batik e.g.
is really a biggie so I would like to design something that allows you
to install only what you need, i.e. have the SVG export capability
separate from everything else and the PDF export capability separate
from everything else and so on, possibly in different plug ins.

Now, to export a GEF diagram you need to
a) load the model file
b) render it to the desired format and save it

It is impossible to implement loading the model in a generic way because
each model is different. So people who would like to use the export
plug in would have to give it something more universal. Eventually,
each model displayed in a graphical viewer is displayed as a figure, so
I thought I'd use that.

The figure can be told to paint itself, passing it a Graphics argument.
So by using SWTGraphics or writing other Graphics adapters, the
rendering to another format can be done transparently (not talking about
alpha channels here :)).

I thought it would be nice if the user was able to choose File >
Export..., select "Diagram Image" as the export engine and was presented
with a typical export wizard that allows choosing which files to export
into which target directory and so on.

So I came up with the following architecture: each client that wants to
contribute a model format to the export wizard, registers a
FigureProvider (suggestions for good names are especially welcome) at
the ImageExport plug in. Figure providers know how to load the model,
create a GraphicalViewer, set an EditpartFactory and so on and finally
get the root figure. Figure providers register the file types they
understand and get asked by the export wizard to provide a figure for a
model file.

Then there are ImageExporters that know how to render a Figure to the
format they export to and save the result to a file. They also register
at the ImageExport plug in. When the user calls the image export
wizard, the user can choose one of the registered formats from a combo box.

I did all that to keep the plug in dependencies down to a minimum. Your
own editor that wants to contribute to the export wizard may provide a
FigureProvider and *optionally* depend on the ImageExport plug in. That
means that it will register at the ImageExport plug in if it is
installed and that nothing will happen if it is not installed.

The exporter plug ins depend on the ImageExport plug in. The user
chooses which formats he wants to be able to export to and installs
exactly the ones needed,

As soon as the ImageExport plug in is installed, the user may activate
the Export Image wizard.

Does that all seem to make sense to you? Comments, suggestions,
discussion, anything is welcome.

Regards, Thomas.
Re: Generic Image Export [message #203809 is a reply to message #203790] Mon, 28 November 2005 13:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zx.us.ibm.com

You may also want to look at what GMF has for image export. I recall
them having export capability to a bunch of image formats (SVG,PNG,JPG,
etc...) as part of IBM's contribution.

Good work nonetheless ;)

Cheers,

~ Chris
Re: Generic Image Export [message #203886 is a reply to message #203790] Mon, 28 November 2005 20:50 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Sounds good to me, can't wait to see some details...

"Thomas Maier" <Thomas.Maier@uni-kassel.de> wrote in message
news:438AD969.4000302@uni-kassel.de...
> Hi all,
>
> I have thought about exporting GEF diagrams to "images" in several
> formats in a generic and extensible way. I have implemented an
> architecture that divides the whole thing into several plug ins and
> would like to ask you gurus for comments on that. What follows is a
> description of what I did/would like to do.
>
> We have hacked in export support for the following formats:
> - the two bitmap formats supported by SWT (JPEG and BMP)
> - PDF export using itext (partially implemented)
> - SVG export using batik (should be partially implemented)
>
> Now I thought about polishing it all up and putting it on sourceforge.
> We are using third-party software to generate PDF and SVG. Batik e.g.
> is really a biggie so I would like to design something that allows you
> to install only what you need, i.e. have the SVG export capability
> separate from everything else and the PDF export capability separate
> from everything else and so on, possibly in different plug ins.
>
> Now, to export a GEF diagram you need to
> a) load the model file
> b) render it to the desired format and save it
>
> It is impossible to implement loading the model in a generic way because
> each model is different. So people who would like to use the export
> plug in would have to give it something more universal. Eventually,
> each model displayed in a graphical viewer is displayed as a figure, so
> I thought I'd use that.
>
> The figure can be told to paint itself, passing it a Graphics argument.
> So by using SWTGraphics or writing other Graphics adapters, the
> rendering to another format can be done transparently (not talking about
> alpha channels here :)).
>
> I thought it would be nice if the user was able to choose File >
> Export..., select "Diagram Image" as the export engine and was presented
> with a typical export wizard that allows choosing which files to export
> into which target directory and so on.
>
> So I came up with the following architecture: each client that wants to
> contribute a model format to the export wizard, registers a
> FigureProvider (suggestions for good names are especially welcome) at
> the ImageExport plug in. Figure providers know how to load the model,
> create a GraphicalViewer, set an EditpartFactory and so on and finally
> get the root figure. Figure providers register the file types they
> understand and get asked by the export wizard to provide a figure for a
> model file.
>
> Then there are ImageExporters that know how to render a Figure to the
> format they export to and save the result to a file. They also register
> at the ImageExport plug in. When the user calls the image export
> wizard, the user can choose one of the registered formats from a combo
> box.
>
> I did all that to keep the plug in dependencies down to a minimum. Your
> own editor that wants to contribute to the export wizard may provide a
> FigureProvider and *optionally* depend on the ImageExport plug in. That
> means that it will register at the ImageExport plug in if it is
> installed and that nothing will happen if it is not installed.
>
> The exporter plug ins depend on the ImageExport plug in. The user
> chooses which formats he wants to be able to export to and installs
> exactly the ones needed,
>
> As soon as the ImageExport plug in is installed, the user may activate
> the Export Image wizard.
>
> Does that all seem to make sense to you? Comments, suggestions,
> discussion, anything is welcome.
>
> Regards, Thomas.
Re: Generic Image Export [message #204018 is a reply to message #203886] Tue, 29 November 2005 20:45 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
It might be a good idea to use this framework also to copy a diagram to the
clipboard.
Re: Generic Image Export [message #204080 is a reply to message #203809] Wed, 30 November 2005 11:14 Go to previous messageGo to next message
Thomas Maier is currently offline Thomas MaierFriend
Messages: 117
Registered: July 2009
Senior Member
Great, thanks for the pointer. I'll look at that when I'll be back
online. Might you be so kind to give me a hint about what you mean by
"IBM's contribution"?

Thanks, Thomas.

Chris Aniszczyk schrieb:
> You may also want to look at what GMF has for image export. I recall
> them having export capability to a bunch of image formats (SVG,PNG,JPG,
> etc...) as part of IBM's contribution.
>
> Good work nonetheless ;)
>
> Cheers,
>
> ~ Chris
>
Re: Generic Image Export [message #204088 is a reply to message #203886] Wed, 30 November 2005 11:14 Go to previous messageGo to next message
Thomas Maier is currently offline Thomas MaierFriend
Messages: 117
Registered: July 2009
Senior Member
Felix L J Mayer schrieb:
> Sounds good to me, can't wait to see some details...

I guess you mean code :). Unfortunately I am sick at home for a couple
of days and can hardly work on it so I expect I'll have to wait until
next week to upload some stuff.

Thomas
Re: Generic Image Export [message #204095 is a reply to message #204018] Wed, 30 November 2005 11:40 Go to previous messageGo to next message
Thomas Maier is currently offline Thomas MaierFriend
Messages: 117
Registered: July 2009
Senior Member
Felix L J Mayer schrieb:
> It might be a good idea to use this framework also to copy a diagram to the
> clipboard.

I think I have read a posting that this is not possible with SWT, but I
might be wrong.

Digged it up: Konstantin Scheglov wrote it, 28.1.2004, Re: Export to png
or jpeg:

> When I asked about putting images in Clipboard in SWT group, Veronika
> answered that this is impossible, because not portable.

However, this is almost two years old. Maybe you have some newer
information?

Thomas.
Re: Generic Image Export [message #204264 is a reply to message #204080] Thu, 01 December 2005 17:34 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
He means http://www.eclipse.org/gmf/

"Thomas Maier" <Thomas.Maier@uni-kassel.de> wrote in message
news:438D8989.30604@uni-kassel.de...
> Great, thanks for the pointer. I'll look at that when I'll be back
> online. Might you be so kind to give me a hint about what you mean by
> "IBM's contribution"?
>
> Thanks, Thomas.
>
> Chris Aniszczyk schrieb:
>> You may also want to look at what GMF has for image export. I recall
>> them having export capability to a bunch of image formats (SVG,PNG,JPG,
>> etc...) as part of IBM's contribution.
>>
>> Good work nonetheless ;)
>>
>> Cheers,
>>
>> ~ Chris
>>
Re: Generic Image Export [message #204271 is a reply to message #204095] Thu, 01 December 2005 17:46 Go to previous message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
There is a SWT Clipboard example, and I will look into it.

As to the argument that putting images onto the clipboard is not portable:
Isn't that what SWT is for, allowing us to use platform-specific UI features
in a platform-independent way?

"Thomas Maier" <Thomas.Maier@uni-kassel.de> wrote in message
news:438D8FC9.3070702@uni-kassel.de...
> Felix L J Mayer schrieb:
>> It might be a good idea to use this framework also to copy a diagram to
>> the
>> clipboard.
>
> I think I have read a posting that this is not possible with SWT, but I
> might be wrong.
>
> Digged it up: Konstantin Scheglov wrote it, 28.1.2004, Re: Export to png
> or jpeg:
>
>> When I asked about putting images in Clipboard in SWT group, Veronika
>> answered that this is impossible, because not portable.
>
> However, this is almost two years old. Maybe you have some newer
> information?
>
> Thomas.
Previous Topic:PluginTransfer Drag and Drop
Next Topic:contentassist-like Popup menu
Goto Forum:
  


Current Time: Thu Apr 25 18:49:53 GMT 2024

Powered by FUDForum. Page generated in 0.03538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top