Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Graphics Operating Systems Programming Software Windows IT Technology

Lightweight C++ Library For SVG On Windows? 130

redblue writes "I would like to display vector graphics in my Windows C++ programs with minimal system requirements. Some of the possibilities are: 1. Enhanced Metafile Format format/EMF+, 2. Flash/SWG, 3. Silverlight/XAML, 4. SVG. The non-open proprietary nature of #2 & #3 make them unattractive. Since EMF+ is not amenable to easy editing, it leaves SVG as the only format worth pursuing. The trouble is that the major vendors have a lock on the market with their proprietary formats; leaving SVG high and dry with no easy native OS support. At least not on Windows. From what I could learn on the intertubes, Cairo is the best, if not only, reasonable system that may enable compiled SVG support. Unfortunately, AFAIK, it comes with a price tag of >2MB overhead and the C++ bindings are not straightforward." Read on for the rest of redblue's question; can you improve on his home-brewed solution?
"In a flash of the NIH syndrome, I rolled my own SVG processing engine and it has addressed my needs. You can see the result on http://www.arosmagic.com/Solitaire. A simple breakdown is: Framework+CRT(150K), SVG engine(100k), SVG art(350k). My SVG library is sufficient for me for now. But I can't help wonder:
1. Is there a better SVG library out there already available for easy inclusion?
2. If not, is there a need, i.e. market demand, for a lightweight (~200K) C++ SVG library that does not have the baggage of Silverlight or Flash?

If the answers are No/Yes, it may be worth it to make this library fully SVG compliant and release it as an open source alternative to the offerings from the entities that we shall not name but just collectively refer to as The Microbe. Please help out by letting me know if such a component is something that you would personally want to use in your current/future projects."
This discussion has been archived. No new comments can be posted.

Lightweight C++ Library For SVG On Windows?

Comments Filter:
  • Trim cairo? (Score:3, Interesting)

    by EkriirkE ( 1075937 ) on Thursday May 28, 2009 @03:01PM (#28127887) Homepage
    It looks like your needs/game only use basic vectors, nothing fancy like blends, blurs. Could you just strip out much of the code from the SVG source that does stuff you don't foresee using?
  • by Anonymous Coward on Thursday May 28, 2009 @03:10PM (#28128093)

    ..about ripping the V8 and Skia engines from Chrome and making a standalone vector graphics system. Skia is light by design. V8 is fast and easy to embed by design. It's all C++ from the ground up. Implement the SVG interpreter in Javascript. Provide a JSON based alternative for the XML haters. Merge ongoing improvements from Chrome et al.

    Just need a year of funding...

  • by Kludge ( 13653 ) on Thursday May 28, 2009 @03:19PM (#28128309)

    The pragmatic reality is that SVG is becoming standard very quickly. Have a look at wikipedia.org. (Have you heard of it?)

    " proprietary" solutions are actually the way to go. Read the actual license terms for them and you'll see there's actually NOTHING that they prevent you to do, that you'll likely to have any interest in doing.

    Yes, I'm sure that Adobe will have no problem with him using their library in his program that he gives out to all his friends and clients.

  • Re:Webkit? (Score:4, Interesting)

    by Carewolf ( 581105 ) on Thursday May 28, 2009 @03:21PM (#28128361) Homepage

    Pulling QtWebkit in is not exactly light weight. But Qt actually has another SVG rendered that implements the SVG tiny standard. Using QtSvg is still several megabytes of Qt libraries though, so except for the nice C++ interface, not the solution for the original question.

  • Mobile SVG (Score:2, Interesting)

    by SpaceToast ( 974230 ) on Thursday May 28, 2009 @03:28PM (#28128527) Homepage Journal
    I'd suggest looking at projects for bringing SVG to smartphones. You may find an SVG library for Windows CE that would compile under (vanilla) Windows -- probably not feature complete, but chances are the Mobile SVG specs are enough for your needs. I believe there is at least one very trim branch of Firefox underway, though SVG support may be one of the things that it trimmed. Good luck.
  • Re:Antigrain rules (Score:3, Interesting)

    by RAMMS+EIN ( 578166 ) on Thursday May 28, 2009 @05:38PM (#28130653) Homepage Journal

    How would you say AGG [antigrain.com] compares to Cairo [cairographics.org]?

  • by Anonymous Conrad ( 600139 ) on Thursday May 28, 2009 @07:11PM (#28131807)

    Yes, I'm sure that Adobe will have no problem with him using their library in his program that he gives out to all his friends and clients.

    The Flash player? Go right ahead: "Adobe provides a free license to allow you to redistribute Adobe Flash Player or Adobe Shockwave Player on your company's intranet, or with your software product or service." (here) [adobe.com]

    Ditto the XAML solution: the render is included in .NET 3.

    The pragmatic reality, to borrow your phrase, is that more people have a Flash player installed than an SVG renderer.

  • My SVG Library (Score:2, Interesting)

    by JM Apocalypse ( 630055 ) on Friday May 29, 2009 @05:51AM (#28136377)

    I've been working on a similar problem in my spare time for quite some time now. I needed a SVG library that was BSD-compatible, could draw any Adobe Illustrator SVG, and selectively enable or disable objects by their ID that was suitable for inclusion in a 3D game.

    I couldn't find any library that fit the requirements, so I ended up writing a C++ library called Donner SVG. It is heavily based on librsvg except written with SVG DOM in mind and for minimal dependencies. It's only dependencies are Cairo, rapidxml, and libcroco, but none of libcroco's dependencies as I wrote a compatibility layer. Additionally, the renderer can be easily swapped out to eliminate the Cairo requirement.

    Some notable features:
    - Ability to access the SVG document tree and modify it after loading an SVG.
    - Supports all shapes and paint server types (radial and linear gradients with stops, solid colors, and transparency).
    - CSS2 selector support.
    - Bounding box calculation.

    It renders static SVGs very well, but I don't consider it to be releasable yet. My goal is to fully implement the #SVG-static feature string and use the library to implement a SVG extension for skeletal animation and inverse kinematics.

    I'm willing to send a copy of the source over if anyone is interested, just contact me at "donner (at) jeffrules (dot) com". It is licensed under the LGPL as parts of it are borrowed from librsvg.

"It's a dog-eat-dog world out there, and I'm wearing Milkbone underware." -- Norm, from _Cheers_

Working...