1 decade ago
by vellum
I'm writing a drawing app that uses Ejecta for rendering. I'd like to be able to get a UIImage from Ejecta for sharing -- to one's camera roll, twitter, or facebook.
I'm considering adding a custom method to EJCanvasContext2D. Would this be the best approach? Might there be an easier way to coax a UIImage from Ejecta?
1 decade ago
by dominic
Yes, you'll need a custom method. The most flexible approach would probably be something like this:
var imageData = ctx.getImageDataHD(0, 0, width, height);
var pixels = imageData.pixels;
ejecta.saveImageFromPixels(pixels, width, height);
This
imageFromPixels()
method would use the
JSTypedArrayGetDataPtr() function to get a pointer to the pixel array and construct the UIImage from it.
1 decade ago
by vellum
Thanks, Dominic. That was helpful. One observation: glReadPixels() performance seems pretty slow, particularly on a retina iPad. Do you have any plans to add support for iOS 5+ texture caches?
http://stackoverflow.com/questions/9550297/faster-alternative-to-glreadpixels-in-iphone-opengl-es-2-0
http://allmybrain.com/2011/12/08/rendering-to-a-texture-with-ios-5-texture-cache-api/
Page 1 of 1
« first
« previous
next ›
last »