|
Re: Exporting as Image [message #238433 is a reply to message #238373] |
Mon, 10 September 2007 06:27 |
Eclipse User |
|
|
|
Originally posted by: puneet82sri.sify.com
You must have saved the figure before being displayed over editor.
Save it once your editor/shell is opened.
|
|
|
|
|
Re: Exporting as Image [message #238473 is a reply to message #238450] |
Tue, 11 September 2007 18:34 |
Eclipse User |
|
|
|
Originally posted by: vb.prismtech.com
Thanks.
"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:fc4b4h$1q6$1@build.eclipse.org...
> Here is a piece of code that works for me. At the end you have ImageData
> in your display color depth that can be saved or processed further.
>
> GraphicalViewer viewer = (GraphicalViewer)
> getWorkbenchPart().getAdapter( GraphicalViewer.class );
> LayerManager layers = (LayerManager)
> viewer.getEditPartRegistry().get( LayerManager.ID );
> IFigure figure = layers.getLayer( LayerConstants.PRINTABLE_LAYERS );
> Rectangle bounds = figure.getBounds();
> if( figure instanceof FreeformFigure) {
> bounds = ((FreeformFigure) figure).getFreeformExtent();
> }
> Image image = new Image( Display.getDefault(), bounds.width,
> bounds.height );
> boolean antialiasing = false;
> GC gc = new GC( image );
> gc.setAntialias( antialiasing ? SWT.ON : SWT.OFF );
> gc.setTextAntialias( antialiasing ? SWT.ON : SWT.OFF );
> Graphics graphics = new SWTGraphics( gc );
> graphics.translate( bounds.getLocation().negate() );
> figure.paint( graphics );
> graphics.dispose();
> gc.dispose();
> ImageData imageData = image.getImageData();
> image.dispose();
>
>
> "Vikram" <vb@prismtech.com> wrote in message
> news:fbsa1s$aq9$1@build.eclipse.org...
>> Hi,
>> I have an editor that has a FreeFormLayer with custom editparts and
>> connections.
>> I want to export this as an image ( JPEG ).
>>
>> I used the code snippet found here:
>> http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg0 5012.html
>>
>> I don't see the connections in the exported image.
>>
>> What do I need in order to do that?
>>
>> Thanks
>>
>>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03384 seconds