Any Plans for SVG support?

Are there any plans to support SVG — or some other form of vector graphics?

In my native iOS projects I like to use SVG (or iOS’s native handling of PDF) for graphics as much as possible. It makes it much easier to have images scale between iPhone and iPad and eliminates the need for @2x versions of the images.

I would love to have the same flexibility — without needing to resort to writing an SVG interpreter myself.

We could probably add PDF support — render PDF to texture using iOS’ native PDF rendering. But you would have to dictate a resolution when you do the render-to-texture. Direct rendering of vector graphics in OpenGL is a little bit ambitious for us.

@Simeon Correct, I didn’t mention that but yes you would have to specify the width and height you want to render, but that is a small price for the benefit vector images afford.

I personally use SVGKit in my apps, I am not sure how well that will work with Codea’s rendering later, or not.

Though I would also be fine with just PDF, it means more conversion but that isn’t too big of a hurdle.

I hadn’t seen SVGKit. We might be able to use that to add PDF and SVG media support.

The way we will probably handle it is to have it transparently cache the PDF or SVG asset on first use — so whenever you change the rendering dimensions (in the sprite() arguments) it creates a new texture.

It might not be needed, but you could also let the user pregenerate the vector sprites with a call like:

smallSprite = makeSprite(vectorImage, 50, 57);
largeSprite = makeSprite(vectorImage, 100, 114);

As I write this, I realize you could do the same thing with bitmaps as well — assuming Codea creates a texture for each size. Not strictly needed, but it could be a bit of an optimization.

Though one could do this now with images…

Yes, you could definitely handle your own caching by creating an image and rendering the sprite() with setContext. We will do some automatic caching for the naïve case (like we do for text rendering).

Cool, in that case makeSprite() is nothing more than a convenience function anyone can write.