Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327267

Summary: GraphicsSVG ignores scaling of SVG images
Product: [Modeling] GMF-Runtime Reporter: Alex Boyko <aboyko>
Component: GeneralAssignee: Alex Boyko <aboyko>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, ansgar.radermacher, pierre-charles.david
Version: 2.3   
Target Milestone: 1.11.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 465575    
Attachments:
Description Flags
Patch that corrects the issue none

Description Alex Boyko CLA 2010-10-07 14:47:21 EDT
1. Create a diagram with a few SVG images on it
2. Resize SVG image based shapes such that SVG image becomes larger/smaller
3. Export the diagram to SVG (RenderedScaledGrsaphics must be used during the export)

Actual: Note that SVG images will have original size.
Expected: SVG images should scaled as they are on the diagram

GraphicsSVG doesn't scale SVG images. Hence, either GraphicsSVG should scale the SVG images or scale factor inserted in the SVG DOM document.
Comment 1 Ansgar Radermacher CLA 2017-02-09 03:45:37 EST
SVG images are wrongly scaled during export. This can also be reproduced in 465575.

Analysis:
GMF uses a graphics wrapper which could either be RenderedScaledGraphics or (Rendered)MapModeGraphics.
These wrappers delegate to GraphicsSWT, GraphicsSVG depending on whether you are exporting or inside the editor. The problem is that the class RenderHelper makes an instanceof DrawableRenderedImage test to differentiate whether it deals with the graphics wrapper from GMF or the device specific graphics. However, unlike GraphicsSWT, GraphicsSVG also implements this interface and thus wrongly delegates directly to it without applying scaling first. I´ll add a patch that fixes the problem
Comment 2 Ansgar Radermacher CLA 2017-02-09 04:14:00 EST
Created attachment 266739 [details]
Patch that corrects the issue
Comment 3 Pierre-Charles David CLA 2017-02-14 05:48:04 EST
Patch applied as 4d9ab970b2ae92907570628393aa0738b470706b.