Loading Vector Graphics (eg: SVG)

Started by
3 comments, last by dave 15 years, 11 months ago
Before I jump straight into this I thought I would ask first. Has anyone got any experience with Loading Vector Graphics and Rendering them with Direct X? I was considering: http://librsvg.sourceforge.net/ To get the the Vector Image Loaded, and then couple it with DirectX. Perhaps I am overthinking this and there are far simpler solutions. Anyone tried something similar?
Advertisement
Have you looked into Windows Presentation Foundation? I'm no expert, but I was under the impression that had at least some elements of SVG in its architecture. With the .NET 3.5 SP1 release we should be able to hook it up with D3D shaders...

I've seen the occasional blog post about people trying this on SM2/SM3 hardware and there were a load of people talking about SVG being a good candidate for the SM4/SM5 features - the GS in particular being good for this sort of thing.

That said, it generally seems to be a pretty quiet topic. Anyone who is or has done this sort of thing with Direct3D isn't shouting it out [smile]


Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Yeah, I have it working with WPF, which from what I investigated appears as if it was built ontop of a DX Layer (To what extent I should really investigate further). I just wanted to move it from the WPF layer down to the DX Layer making it more robust for game development.

I would assume some other people would have looked into it especially given that flash GUI's are all the rage these days. What I am trying to do is not too far removed from loading in Flash data (Just I don't have the hassle of action script).
WPF is indeed built on top of Direct3D.

The recent news about better WPF and D3D integration may well be worth watching. I'm not sure it'll really help for actual game UI's but it could definitely be very powerful for tools and more general multimedia applications.

You hear the occasional story about people creating Flash->WPF or Flash->D3D renderers/convertors, but unless I'm missing something the details haven't been published [sad]

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

It's far from simple and i'm near the end of an implementation now. The steps that are involved are (assuming C++ and therefore native Direct3D):

1. Load in the outlines of true type font files.

Use FreeType2 for this. Look at FT_Outline.

2. Convert the curves (which can be of nth order bezier) into a list of points.

This involves sampling from Nth order beziers, not simple to implement.

3. Tessellate the points.

I used ear clipping for this which is non trivial.

Once you have the geometry you can do many things with it, but you can stick it in a vertex buffer and draw it.

EDIT: I will soon be writing an article that is an in depth look at how to carry out these steps.

EDIT2: This is purely for vector fonts, however it uses techniques that are used in your original question.

This topic is closed to new replies.

Advertisement