screen resolution - new Codea, old iPad

I wrote a little drawing app with Codea (it draws using the ellipse() function in different sizes and colors), and I like to take screenshots of the results and save them. I’d like to print them out, but the resolution of the saved file is limited of course by the resolution of the iPad screen, and printing anything larger than 4x6 doesn’t work so well.

If I run my same app on a “new iPad,” will I end up with higher-resolution saved images?

And, if so, is there any way to get that higher resolution from running Codea on my clunky old iPad 1? I.e., even though I can’t view them at a higher res on the old iPad screen, is there any way to save the additional data from the resolution that Codea is capable of working at?

I figure this is a longshot, but I thought I might as well ask. Otherwise, aw shucks, I may just HAVE to buy a new iPad…

The new iPad still considers itself to be 1024x768 “pixels”. When an app takes advantage of the pixel doubling, all it’s doing is specifying a double-resolution image to be displayed at normal dimensions in “pixels”. For example, an app might display a 40x40-pixel image but specify it to be drawn at 20x20 “pixels”.

Haven’t tested what behavior arises in Codea yet.

The resolution of Codea on the new iPad screen is 2048x1536 pixels, but it still assumes 1024x768 “logical” pixels. So any code you write should look identical on both — it will just look a lot sharper on the new iPad.

At the moment it’s hard to get the image data out of Codea, but this will be changed in an update. So while you can technically create an image bigger than the screen on an older iPad, it’s kind of hard to actually save right now.

Certain sprite packs are compatible and are marked as “Retina” in the sprite pack list. The other sprite packs will draw at the correct size, but will not look as sharp as Retina sprite packs. (Retina sprite packs simply have double resolution graphics available for when drawing on a retina display.)

And if I take a screenshot on the new iPad, while running Codea (but not through Codea, just by clicking the Home and Power buttons simultaneously), what do I get? A 1024x768 image, or 2048x1536? (Apologies if you answered this above, I’m trying to fully understand this…)

I’m surprised by this - although in hindsight it makes sense.

Hmm. If I make an image() that is 64x64 pixels - and draw it to the screen - will it be 64 or 32 “logical” pixels in width? ie. do they “blow up” so image pixels match screen pixels, or do they draw full rez (ie. smaller on a retina device)? I’ll have to try it - I think I already know, and if I’m right it might be handy to have a 2x mode for the sprite() call.

It just seems to me that a 64x64 pixel image not filling a 64x64 box is a surprise.

Ok I was wrong - it does “upsize” images. Which now makes me wonder - is there a way I can get sprite() to draw at retina resolution?

And is there a way to address the screen at sub-pixel coordinates (maybe fractional coordinates simply work, I dunno)

sprite() will draw at retina resolution if a retina sprite is available. That is, if there is an identical image with an @2x suffix that has double the resolution.

You’ll notice that some sprite packs are marked “Retina.” These have double resolution images available and will render at the correct size with full clarity.

For images, they are allocated at full size on a retina device, for example:

image(400,400) actually creates an internal 800x800 image. Accessing pixels through set and get will access 2x2 pixel blocks. However there is a rawSet and rawGet, as well as an actualWidth and actualHeight (might be called something else, it’s in the docs) that allow you to navigate the full image data.

The reason it allocates a larger internal image is for when the image is used with setContext(). This allows you to render into images at full retina resolution.

Ah! “rawSet” and “rawGet” (and the actualHeight/Width) were what I was looking for. I just double-checked, I don’t see it in the docs, at least under “image”.