Saving figure Image - connections are cut short in image if scroll bars [message #528281] |
Mon, 19 April 2010 18:31  |
Eclipse User |
|
|
|
Hi,
I have a GEF Editor where if I save the figure to an image some of the
connections are cut short in the saved image if the diagram is bigger
than the viewport and scroll bars are needed.
I save as follows:
GraphicalViewer diagramViewer;
File file;
....
ScalableFreeformRootEditPart rootEditPart =
(ScalableFreeformRootEditPart)diagramViewer.getRootEditPart( );
IFigure figure = rootEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS);
Rectangle rectangle = figure.getBounds();
Image image = new Image(Display.getDefault(), rectangle.width + 50,
rectangle.height + 50);
GC gc = new GC(image);
SWTGraphics graphics = new SWTGraphics(gc);
figure.paint(graphics);
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[]{image.getImageData()};
loader.save(file, SWT.IMAGE_PNG);
....
Anyone come across this?
PB
|
|
|
|
Re: Saving figure Image - connections are cut short in image if scroll bars [message #528287 is a reply to message #528286] |
Mon, 19 April 2010 19:11  |
Eclipse User |
|
|
|
On 19/04/2010 23:55, Phillipus wrote:
> On 19/04/2010 23:31, Phillipus wrote:
>> Hi,
>>
>> I have a GEF Editor where if I save the figure to an image some of the
>> connections are cut short in the saved image if the diagram is bigger
>> than the viewport and scroll bars are needed.
>>
>> I save as follows:
>>
>> GraphicalViewer diagramViewer;
>> File file;
>> ...
>> ScalableFreeformRootEditPart rootEditPart =
>> (ScalableFreeformRootEditPart)diagramViewer.getRootEditPart( );
>>
>> IFigure figure = rootEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS);
>> Rectangle rectangle = figure.getBounds();
>>
>> Image image = new Image(Display.getDefault(), rectangle.width + 50,
>> rectangle.height + 50);
>>
>> GC gc = new GC(image);
>> SWTGraphics graphics = new SWTGraphics(gc);
>> figure.paint(graphics);
>>
>> ImageLoader loader = new ImageLoader();
>> loader.data = new ImageData[]{image.getImageData()};
>>
>> loader.save(file, SWT.IMAGE_PNG);
>> ...
>>
>> Anyone come across this?
>>
>> PB
>
> Now I know why this is - because I'm using GEF 3.6 and in GEF 3.6 in the
> ConnectionLayer.java class they added a ClippingStrategy "which takes
> into account nested view ports and truncates those parts of connections
> which reach outside."
>
> Great.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309749
|
|
|
Powered by
FUDForum. Page generated in 0.04175 seconds