export GEF diagram as jpg [message #158326] |
Wed, 17 November 2004 16:56 |
Eclipse User |
|
|
|
Originally posted by: paolino125.hotmail.com
Hi, I known the answer to this question was alredy posted in this newsgroup,
but I'm getting crazy because I don't find it....
anyone could point me to that post?
Tanks a lot!
|
|
|
Re: export GEF diagram as jpg [message #158372 is a reply to message #158326] |
Wed, 17 November 2004 19:12 |
Eclipse User |
|
|
|
Originally posted by: paolino125.hotmail.com
OK, I resolved by self...
for any one with this problem, here is my solution:
IFigure fig2 = ((FreeformGraphicalRootEditPart)
part.getViewer().getRootEditPart()).getLayer(LayerConstants. CONNECTION_LAYER
);
IFigure fig3 = ((FreeformGraphicalRootEditPart)
part.getViewer().getRootEditPart()).getLayer(LayerConstants. PRIMARY_LAYER);
RectangleFigure fig4 = new RectangleFigure();
fig4.setBounds(new Rectangle(0,0,fig3.getClientArea().width,
fig3.getClientArea().height));
fig4.setBackgroundColor(ColorConstants.white);
ImageData data = new ImageData(fig3.getClientArea().width,
fig3.getClientArea().height, 24, new PaletteData(0xFF, 0xFF00, 0xFF000));
Image image = new Image(Display.getCurrent(), data);
GC gc = new GC(image);
Graphics g = new SWTGraphics(gc);
fig4.paint(g);
fig2.paint(g);
fig3.paint(g);
gc.dispose();
g.dispose();
ImageLoader loader = new ImageLoader();
ImageData datas[] = { image.getImageData() };
loader.data = datas;
loader.save("c:\\pippo.bmp", SWT.IMAGE_BMP);
image.dispose();
Hi
|
|
|
Re: export GEF diagram as jpg [message #158379 is a reply to message #158326] |
Wed, 17 November 2004 19:12 |
Eclipse User |
|
|
|
Originally posted by: usenet.jevopi.de
From: Remko Popma <remko.popma@azzurri.jp>
Newsgroups: eclipse.tools.gef
Subject: Re: Export to png or jpeg
Date: Sat, 24 Jan 2004 23:10:09 +0900
On 2004-11-17 17:56:58 +0100, "funky79" <paolino125@hotmail.com> said:
> Hi, I known the answer to this question was alredy posted in this newsgroup,
> but I'm getting crazy because I don't find it....
>
> anyone could point me to that post?
>
> Tanks a lot!
|
|
|
Re: export GEF diagram as jpg [message #158486 is a reply to message #158372] |
Thu, 18 November 2004 16:24 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Great!
- The PRINTABLE_LAYERS contains both connections and primary layers.
- In some cases selection is shown by the figure itself, so others might
want to temporarily deselect all editparts.
- Just construct the Image directly using new Image(display, w, h);
"funky79" <paolino125@hotmail.com> wrote in message
news:cng7s5$mnc$1@www.eclipse.org...
> OK, I resolved by self...
> for any one with this problem, here is my solution:
>
> IFigure fig2 = ((FreeformGraphicalRootEditPart)
>
part.getViewer().getRootEditPart()).getLayer(LayerConstants. CONNECTION_LAYER
> );
> IFigure fig3 = ((FreeformGraphicalRootEditPart)
>
part.getViewer().getRootEditPart()).getLayer(LayerConstants. PRIMARY_LAYER);
> RectangleFigure fig4 = new RectangleFigure();
> fig4.setBounds(new Rectangle(0,0,fig3.getClientArea().width,
> fig3.getClientArea().height));
> fig4.setBackgroundColor(ColorConstants.white);
>
> ImageData data = new ImageData(fig3.getClientArea().width,
> fig3.getClientArea().height, 24, new PaletteData(0xFF, 0xFF00, 0xFF000));
> Image image = new Image(Display.getCurrent(), data);
> GC gc = new GC(image);
> Graphics g = new SWTGraphics(gc);
>
> fig4.paint(g);
> fig2.paint(g);
> fig3.paint(g);
>
> gc.dispose();
> g.dispose();
>
> ImageLoader loader = new ImageLoader();
>
> ImageData datas[] = { image.getImageData() };
> loader.data = datas;
> loader.save("c:\\pippo.bmp", SWT.IMAGE_BMP);
>
> image.dispose();
>
> Hi
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03611 seconds