Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Is there a reliable converter bewteen draw2d.Graphics and awt.Graphics2D?
Is there a reliable converter bewteen draw2d.Graphics and awt.Graphics2D? [message #184662] Wed, 15 June 2005 12:30 Go to next message
Pavel Repkin is currently offline Pavel RepkinFriend
Messages: 4
Registered: July 2009
Junior Member
Hi!
We use GEF as a platform for diagram editor.
As a vector format for image exporting we've choosen SVG.
In previous pure-java (non-Eclipse) edition of our tool, it was very easy to
export SVG.
All we had to do is to paint graphical primitives tree to
SVGGraphics2D instead of Graphics2D.

Now, on Eclipse platform, the primitives (Figures) use draw2d.Graphics,
so we couldn't use the old approach on spot.
To overcome this we've written a class - SwtToAwtGraphics that extends
SWTGraphics and delegates
method calls to Graphics2D methods.
After that, we could paint Figure-tree to SVGGraphics2D through
SwtToAwtGraphics.

Unfortunately, this solution doesn't seem good at least for the following
reasons:
- the result image isn't always of a good quality, because SwtToAwtGraphics
is inaccurate in conversion between SWT and AWT aspects, especially with
fonts.
- We have to correct our code as long as SwtGraphics evolves.
SwtGraphics in M7 was significantly improved and we had to spent some time
adjusting
SwtToAwtGraphics to work smoothly.

So, my question is - is there any converter between draw2d.Graphics and
awt.Graphics2D
that provides fine quality and is up to date with the latest version of
Eclipse platform?

Pavel Repkin
Re: Is there a reliable converter bewteen draw2d.Graphics and awt.Graphics2D? [message #185081 is a reply to message #184662] Wed, 22 June 2005 13:15 Go to previous message
Eclipse UserFriend
Originally posted by: pghoekerd.hotmail.com

Heyy

I have the same problem and also no solution (hopefully) yet.
Maybe one of these workarounds are possible, still looking in to it
Converting your composite to a java frame (using SWT_AWT) and use
SVGGraphics2D to convert it to SVG. No succes, maybe I misunderstood the
purpose of SWT_AWT
Convert your image to a another type of image (maybe jpeg) and use a
converter to covert it to svg

Peter Hoekerd

"Pavel Repkin" <pavel.repkin@borland.com> wrote in message
news:d8p713$jio$1@news.eclipse.org...
> Hi!
> We use GEF as a platform for diagram editor.
> As a vector format for image exporting we've choosen SVG.
> In previous pure-java (non-Eclipse) edition of our tool, it was very easy
> to export SVG.
> All we had to do is to paint graphical primitives tree to
> SVGGraphics2D instead of Graphics2D.
>
> Now, on Eclipse platform, the primitives (Figures) use draw2d.Graphics,
> so we couldn't use the old approach on spot.
> To overcome this we've written a class - SwtToAwtGraphics that extends
> SWTGraphics and delegates
> method calls to Graphics2D methods.
> After that, we could paint Figure-tree to SVGGraphics2D through
> SwtToAwtGraphics.
>
> Unfortunately, this solution doesn't seem good at least for the following
> reasons:
> - the result image isn't always of a good quality, because
> SwtToAwtGraphics
> is inaccurate in conversion between SWT and AWT aspects, especially with
> fonts.
> - We have to correct our code as long as SwtGraphics evolves.
> SwtGraphics in M7 was significantly improved and we had to spent some time
> adjusting
> SwtToAwtGraphics to work smoothly.
>
> So, my question is - is there any converter between draw2d.Graphics and
> awt.Graphics2D
> that provides fine quality and is up to date with the latest version of
> Eclipse platform?
>
> Pavel Repkin
>
Previous Topic:guides on ruler not displaying properly
Next Topic:Non-moveable edit parts
Goto Forum:
  


Current Time: Sat Aug 17 11:21:09 GMT 2024

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

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

Back to the top