Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Source Link -> File Viewer > SVG
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Adequat
Tomato Guru

167 Posts

Posted - Sep 14 2018 :  03:28:14 AM  Show Profile  Reply with Quote
It would be great if your FileViewer plugins could preview SVG files (https://en.wikipedia.org/wiki/Scalable_Vector_Graphics)

I have recently switched from PNG for my documentation graphics to SVG.
PNG are previewed correctly.

feline
Whole Tomato Software

United Kingdom
17013 Posts

Posted - Sep 14 2018 :  08:43:18 AM  Show Profile  Reply with Quote
Do you have a couple of test images I could attach to the feature request? I have just tried two different image programs on my computer, and neither offer the option to save out an image in SVG. So its this or start pulling random images out of the internet... I have concerns about where this might lead

If you do have a couple of sample images we can use, please submit the files via the form:

http://www.wholetomato.com/support/contact.asp

including this thread ID or URL in the description, so we can match it up.

zen is the art of being at one with the two'ness
Go to Top of Page

Adequat
Tomato Guru

167 Posts

Posted - Sep 16 2018 :  02:13:14 AM  Show Profile  Reply with Quote
I personally use SVG with the great tool http://plantuml.com/class-diagram
PlantUML can render SVG grphics.

SVG ("Scalable Vector Graphics") is an XML based format to draw two-dimensional vector graphics.
This is not used to save "common" photos, it has more in common with a web page that it does with a PNG.
This format is natively supported by all web browsers and is gaining momentum because SVG is a key part of HTML5.
For my documentation purposes, SVG has the following advantages:

1. Pictures scale perfectly in web browsers (vector graphics)
2. URL can be inserted inside graphics
3. Any text in the SVG picture, displayed in the web browser, can be selected / copied, unlike with a freezed picture.
4. Smaller picture files

SVG graphics are complex to render. But I think you have a very easy solution...
SourceLink can preview HTML pages... and SVG are rendered easily in web pages: hence use your HTML preview
to display an on-the-flay HTML page that only contains the SVG file.

Find here some online SVG only pictures, all originating from PlantUML (right click and do "Save Image As").
https://blog.frankel.ch/assets/generated/developing-around-plantuml/overall-architecture.svg
https://plantweb.readthedocs.io/_images/ddcd30f09f9f9b6d0ec8ed7f8292813c178e368f91bb2b5f989ca18133e2b50e.svg
big one:
http://pierre3net.azurewebsites.net/Content/image/classDiagram_m-vm.svg

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17013 Posts

Posted - Sep 17 2018 :  09:13:09 AM  Show Profile  Reply with Quote
I have not come across UML in years, but yes, this is a natural fit for a vector graphics format. Thank you for the sample images, I have put in a feature request for this:

case=119335

As for using the HTML preview to preview the images, it depends on the control used, and what it supports. There are quite a lot of graphics formats, and not all programs can preview all of them. Plus we want the file viewer to be lighter weight than a full web browser.

zen is the art of being at one with the two'ness
Go to Top of Page

Adequat
Tomato Guru

167 Posts

Posted - Sep 17 2018 :  4:19:50 PM  Show Profile  Reply with Quote
Note that PlantUML, unlike its name suggests, has a much wider scope than UML. Lots of diagrams of different types can be easily built.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17013 Posts

Posted - Sep 17 2018 :  5:41:30 PM  Show Profile  Reply with Quote
I was thinking this would work well for flow diagrams, and other such types of diagram.

Have you considered writing your own SourceLinks plugin to preview SVG files? I tried wrapping the SVG file in a very simple HTML file, that simply shows the image, but this does not work in the HTML viewer SourceLinks is using. So the HTML viewer is not handling everything a full web browser does, which makes sense for a preview. But then its a question of where you draw the line for what the previewer should support...

zen is the art of being at one with the two'ness
Go to Top of Page

Adequat
Tomato Guru

167 Posts

Posted - Sep 19 2018 :  04:32:21 AM  Show Profile  Reply with Quote
quote:
I tried wrapping the SVG file in a very simple HTML file, that simply shows the image, but this does not work in the HTML viewer SourceLinks is using



Yes, it does work. I tried it.
With both cases: SVG as external file referenced by the HTML file, or inlined SVG inside a HTML page.

quote:
Have you considered writing your own SourceLinks plugin to preview SVG files?


Really not have the time :(
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17013 Posts

Posted - Sep 19 2018 :  07:26:04 AM  Show Profile  Reply with Quote
OK... which OS are you using? Also, which IDE and version of VA are you using?

I was testing this under Windows 7, but I have just tried it under Windows 10 as well, and the SVG image is not shown, when wrapped in HTML, on either machine for me. In case the problem is my wrapper, I am using this:

<HTML>
<IMG SRC="overall-architecture.svg"></IMG>
</HTML>

in a file called "overall-architecture_wrapper.html". The same file extension and HTML works with a .PNG file, so I would expect this to work for a SVG file as well.

So it looks like this working or not depends on some extra variable.

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Sep 19 2018 :  12:14:02 PM  Show Profile  Reply with Quote
This code works for displaying the image in a browser, but it doesn't work in the file viewer plugin:


<html>
<body>
<img src="./bitmap_vs_svg.svg" />
</body>
</html>


Maybe a security policy issue in the plugin...

Edited by - sean on Sep 19 2018 12:18:41 PM
Go to Top of Page

Adequat
Tomato Guru

167 Posts

Posted - Sep 20 2018 :  03:18:44 AM  Show Profile  Reply with Quote
You simply needs to declare it's a HTML5 page and it will work, simply like this:

<!DOCTYPE html>
<body>
<img src="overall-architecture.svg" />
</body>
</html>

HTML5 can preview lots of thing. This might be an idea to display even more stuff.
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Sep 20 2018 :  12:24:58 PM  Show Profile  Reply with Quote
Bingo! Thanks.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17013 Posts

Posted - Sep 20 2018 :  4:32:53 PM  Show Profile  Reply with Quote
Adding HTML to the list of languages I don't know enough about

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Dec 03 2018 :  6:29:18 PM  Show Profile  Reply with Quote
case=119335 is implemented in build 2301
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000