SVG, pdf, and vector graphics in general.

I did a quick search on the forums. Correctly me if I am wrong, but Codea supports PDFs but not SVG right?

I am looking to be able to scale graphics without losing resolution like SVG images do.

Are PDFs just vector graphics in disguise? Or should I just stick with PNGs and just make them over sized so when they grow/shrink I don’t lose resolution?

What is the best way you have found to scale graphics and keep them looking nice?

Thanks as always! I love this community.

@MrScience101 PDFs are vector graphics, even just the text in a PDF document is so you can scale that to any size.

Here’s an experiment, turns out your probably better off using raster graphics.


--# Main
displayMode(FULLSCREEN)
function setup()
    n = 0
end

function draw()
    background(255,255)
    n = n + 0.6
    sprite("Dropbox:Untitled 30",WIDTH/2,HEIGHT/2,n,n/2)
    fill(59,255)
    text(1/DeltaTime,100,100)
end

function touched(t)
    
end

Here’s the image
https://www.dropbox.com/s/rhincu554zj4aq1/Untitled%2030.pdf

My understanding is that when Codea reads in a PDF then it rasterises it to the specified width. So at read time then you have free choice, but after that it is fixed. You could always re-read it in when the size gets too far from the original choice (I’ve seen many systems that do a low-resolution initial zoom and then a repass at the higher resolution once the user has decided on the zoom).

@Andrew_Stacey good point I will have a look at that

Brilliant! Thank you both so very much!

In StackIt, everything is a vector graphic. However, I’m the setup, I rasterize everything. That way I some have to worry about resolution errors or anything.

@Luatee As @Andrew_Stacey says, Codea rasterizes it when you draw it. If you want to render a large vector image, it’s intended that you use something like:

function setup()
    img = readImage("Documents:Vector Image", size)
end

function draw()
    sprite(img, WIDTH / 2, HEIGHT / 2)
end

(Pseudo-code, but you get the point. Rasterize it once, no lag.)

@SkyTheCoder I understand that no worries, I was demonstrating to MrScience101 that is it possible to render a 50x50 pixel pdf at any size using that code above.