Closed bratgers closed 8 months ago
I found probably the reason why this is only supported on Linux. It seems an SWT issue:
If my assumption is correct, than this issue can be closed.
Hi,
In a Linux environment it is possible to load an SVG image to an element.
Eclipse uses different methods of handling and loading images for each platform, so this is a Linux specific implementation that delegates to GTK native code.
The image is shown nice and smoothly regardless the scale
Actually, that's not the case. The Eclipse image loader on Linux can load an SVG format file but then converts it to raster image data. You can see this if you take a small-ish SVG image, load it into a Canvas Image component and then resize the component so it is much larger.
Ultimately, the Eclipse SWT (Standard Widget Toolkit) can only display raster image data from an image file. To achieve true SVG rendering it would need to draw each line, pixel, arc, etc dynamically from the SVG file's XML instructions. The best SWT can do is to convert the SVG to raster format and then display that. So you may as well load a PNG file because the end result is the same.
Is it possible to support SVG as image type for all platforms in a view?
No, not to truly render SVG properly, as mentioned above. It is possible to convert the SVG file to raster format using a convoluted and slow process involving Apache Batik and XML conversion (example here). I tried it a few years ago as proof of concept, and the result was worse than using PNG format.
If my assumption is correct, than this issue can be closed.
Sadly, yes.
I wish it were not the case, but SWT does not support dynamic rendering of SVG instructions. The best it can do is convert from SVG to raster format on Linux only.
In a Linux environment it is possible to load an SVG image to an element. The image is shown nice and smoothly regardless the scale, instead of an PNG or JPG image. I also experience a performance gain when displaying and editing a view with a larger image.
I have shared my model with a I collegae. He is using a Windows environment. When he load the model, the image is not displayed. If he tried to import model with coArchi he received an error, that the image type is nog supported. I don 't know how this behavior is with Mac.
Is it possible to support SVG as image type for all platforms in a view?
The advantages:
I don't know what the reason is that the image is shown in Linux and not in Windows, it seems like an OS or an environment issue.