Resizing framebuffer (image) in native

100 views
Skip to first unread message

Miha

unread,
Apr 14, 2014, 6:53:31 AM4/14/14
to andro...@googlegroups.com
Hi!

I'm doing some native development and I have an image (pixel data) that I'd like to resize. I'm currently doing it on the CPU using bilinear scaling (a relatively simple algorithm), but I'm wondering if there is a GPU accelerated API available? Something that would leverage the GPU power to transform the image.

I was looking at android.graphics.Bitmap implementation and saw that it calls into native (SKIA implementation?) parts for some of the operations, though no scaling there. Note that I'm not displaying the image on screen, just sending it across the wire. I have a byte[] which holds the original image data, and I would like to rotate & scale it and get the result in a new byte[], that I can send over the wire. The process of rotation and scaling would be ideally executed on the GPU.

Another idea (though don't know if it is doable) is to use OpenGL and use renderbuffer then use opengl transforms and read data from renderbuffer.

Can this be done somehow? Or am I kicking in the dark?

Thanks,
 Miha.

J Decker

unread,
Apr 16, 2014, 9:21:03 PM4/16/14
to andro...@googlegroups.com
The native surface is actually a opengl hardware scaled thing.
if it's the full screen image you want scaled, then just set the dimensions of the native surface to the target and it'll get scaled to the screen.
If you want to do it the next step is really open GLES2 (skip doing it without shaders, because that's depricated anyway)  and the 2d transform is simple to implement... 

but don't try and pull it back, just load your normal image and draw it how you want it
Reply all
Reply to author
Forward
0 new messages