To be fair, my reasons for this request (adding zlib and libPNG and such) are all about the specific case of “I want to load an external image, and my only means are cut-and-paste” - so I’m going to have a chunk of code that decodes a big string into an image. If you want to take it further, that’s awesome - but beyond the scope of what I was hoping you could get into a quick update.
Comments below on images APIs…
I wouldn’t have explicit retina support (unless you plan on extending the metaphor to iphone as well). It is not unreasonable to expect coders to support scaling their image appropriately for the platform they’re on. (You’d have the same issue with the built-in spritepacks)
A lot of it depends on if you go with the file metaphor; if you do, then “image=loadImage(somedatasource)” is perfectly reasonable. I do think you’ll be better off just sandboxing standard Lua file I/O if possible; the more things can be compatible with “standard” Lua the better off we are, I think. I think regular Lua I/O, jailed to the Codea Projects directory, isn’t unreasonable. It still leaves us with the bootstrapping of getting data there, and of decoding it, but that’s what I was looking for zlib/libPNG for.
NOW - pie in the sky. Say you don’t want people to have to mess with raw encoded data at all (a noble goal). You have that now with spritepacks - you’d simply need to add a mechanism to download/install new spritepacks, and perhaps to save an image to a spritepack, and maybe extend the metaphor so a spritepack is part of a project.
Here’s what I’m thinking - have each project make an implicit spritepack with the same name as the project, initially empty. So - a project named “test” would have a “test” spritepack associated with it with no sprites. The API could then be:
sprite("spritepack/imagename") - draws image "imagename" from spritepack "spritepack"
sprite("imagename") - draws image from project storage
sprite(image) - draw an image object
saveSprite(image, "imagename") - Save the image object to the current project spritepack; saving nil would delete the sprite
saveSprite(image, "spritepack/imagename") - Save the image object to a different spritepack or project
setSpritepackInfo("spritepack", "A nice spritepack name", "The author", "a URL", icon) - where icon is an image object *OR* "name" for the name of an image in that spritepack
This avoids global/project differences - any project can access images from any other project (or installed spritepack) if it knows the name. It also lets you make a project that does nothing but add a new spritepack.
If you refer to a spritepack that doesn’t exist - it’s created. This all also assumes that there’s a spritepack manager that lets you view them (as you can now), and maybe delete packs or sprites, and ideally download spritepacks from the internet. (the spritepack manager could easily be a lua project using the API above, plus some way to enumerate projects and spritepacks)
In a perfect world, in addition to all of this, "sprite("http://home.bortels.us/tomfez.jpg")" would also work. I understand that may not fly.