[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] Re: export GEF diagram as jpg
|
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@xxxxxxxxxxx> wrote in message
news:cng7s5$mnc$1@xxxxxxxxxxxxxxxxxx
> 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
>
>