What are options for writing an SVG-based desktop application?
Asked Answered
M

7

11

Say, I want to write a desktop application that will heavily use SVG. What are my choices of rendering engines, GUI toolkits, libraries, etc.?

I would like it to:

  1. run smoothly on Linux/Unix/Mac (everywhere with antialiasing)
  2. be open source
  3. be compatible with standard SVG (e.g. opacity, embedded raster graphics)
  4. accessible with modern dynamic language (Python, Ruby, Lisp, etc)
    • e.g. C-based solution would be perfect in that sense

So, what are my options?

Mauney answered 21/11, 2011 at 12:17 Comment(2)
When you say accessible with a modern dynamic language (Python, Ruby, Lisp, etc), are you saying you'd prefer to write the app in one of those languages?Shemikashemite
@Halst did you ever develop your svg-based application?Fuzee
F
15

I would suggest cairo, Cairo is a 2D graphics library with support for SVG file output.

The cairo API provides operations similar to the drawing operators of PostScript and PDF. Operations in cairo including stroking and filling cubic Bézier splines, transforming and compositing translucent images, and antialiased text rendering. All drawing operations can be transformed by any affine transformation (scale, rotation, shear, etc.)

Cairo is implemented as a library written in the C programming language, but bindings are available for several different programming languages. Which include Perl, Python, Ruby and so much more.

It also has several Toolkit Bindings. GTK+ 2.8+ has full support for cairo for example.

Also has and experimental backends with OpenGL. Which benefits include Easily integrate features like PS-, PDF-, SVG-support to your OpenGL-application (may need additional libraries).

Cairo is free software and is available to be redistributed and/or modified under the terms of either the GNU Lesser General Public License (LGPL) version 2.1 or the Mozilla Public License (MPL) version 1.1 at your option.

Fuzee answered 23/11, 2011 at 18:28 Comment(0)
V
2

Considering the Safari Browser, which runs smoothly on a Mac. You could write your application using the Raphael library.

This database shows the Raphael language the page itself is pure vector graphics.

Just throwing this your way to see if it fits inside your constraints...

http://www.irunmywebsite.com/raphael/additionalhelp.php?v=2

Velarde answered 23/11, 2011 at 23:40 Comment(1)
Not opensource is it? Also he wants unix and linux portability.Fuzee
S
2

Appcelarator Titanium Desktop seems like your best bet. You can write a Ruby, Python, or JavaScript app and use HTML and CSS as the GUI. There's also Adobe AIR but it's not open source.

As for SVG the best library I've found is d3.js. At first glance you might get the impression it's visualization library but it can be used for any type of SVG work. Some have mentioned Rapheal.js, its strength is that it's cross browser, however it leaves some SVG features out like group <g> tags due to it having to use VML with most versions of IE.

Shemikashemite answered 26/11, 2011 at 23:45 Comment(3)
I've only used d3 in the browser. Looks like you're not the first to run across this https://mcmap.net/q/1015872/-svg-in-titanium-desktop :(Shemikashemite
Thanks @Kreek for your quick response. I actually just went to delete my comment because I found a way to get it working. I'll link a blog post to that SO post when it's cleaned up.Grider
Oh nice! Always the way, guaranteed way to fix a bug is tell someone else about it, my theory is your subconscious kicks into gear and figures it out while you're typing/blabbing away :)Shemikashemite
G
2

I would suggest to go for Apache's Batik. Batik is Java-based SVG toolkit that can render, generate, manipulate and transcode SVG across all platforms wherever Java exists; from Desktops, applets and even handheld devices. It leverages the power of platform independence of Java. It is an ideal choice for Desktop applications. It supports full interactivity, linking, scripting and animations too.

Apache Cocoon, Oracle JDeveloper 10i, The JFreeChart project, ILOG Dicovery and Jviews - The advanced visual data analysis tools, Volity and Gamut Gaming projects, GLIPS Graffiti SVG Editor, eDoc Studio project, Apache FOP project etc. are some of the projects which use Batik.

Gamber answered 28/11, 2011 at 17:29 Comment(0)
R
0

I wouldn't use cairo directly. Instead try wxWigets...

There's a very usefull wxGraphicsContex class, that does much of the encapsualtion of cairo and other cool things for you. Theres even a SVG-Demo in the package.

There's also a project called "wxcairo", which uses libsvg.

If you interesed in a big, big project, that uses SVG as native format, take a look at "Inkcape". Its a very good illustration program written in GTK.

Rew answered 29/11, 2011 at 1:5 Comment(0)
B
0

Proabably too late for answering this question, I would suggest to have use of Opensource Webkit ,

By doing this, following are the advantages,

1 -- Will get additional Support for HTML ,
2 -- Compatible with all platform, Win , Mac , Linux , iOS , BB
3 -- On All the platform, it will use Cairo Library to render the graphics,
4 -- Easy to Extend and Scale to add Additional Feature ....

Bauer answered 26/2, 2013 at 13:44 Comment(0)
C
-2

Ignore all talk of Raphael and, instead, work with D3.

D3 can read your XML tree and easily produce SVG code based on your requirements. It means that you can render any XML document, in any way that you like. And that includes all Raphael output, and a whole lot more, besides.

I hadn't heard of Cairo, before today. But, with the results that D3 offers, I won't even be investigating it.

Crocodilian answered 3/11, 2012 at 14:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.