Is there a reliable converter bewteen draw2d.Graphics and awt.Graphics2D? [message #184662] |
Wed, 15 June 2005 12:30 |
Pavel Repkin 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 |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.02869 seconds