7

Latest Android SDK (R22) has removed android.renderscript.RSSurfaceView and android.renderscript.RenderScriptGL classes. How can we use RenderScript dirrectly on SurfaceView or regular Android View?

Bao Le
  • 16,643
  • 9
  • 65
  • 68

1 Answers1

0

Short answer: It's complicated.

Long answer: https://github.com/googlesamples/android-HdrViewfinder

They seem to make an RGBA allocation:

    Type.Builder rgbTypeBuilder = new Type.Builder(rs, Element.RGBA_8888(rs));
    rgbTypeBuilder.setX(dimensions.getWidth());
    rgbTypeBuilder.setY(dimensions.getHeight());
    mOutputAllocation = Allocation.createTyped(rs, rgbTypeBuilder.create(),
            Allocation.USAGE_IO_OUTPUT | Allocation.USAGE_SCRIPT);

Then get a surface from a SurfaceView holder to pass to the allocation. Then they run some rs on it, and then call:

mOutputAllocation.ioSend();

for each frame... Check the code, seems there are some pitfalls there.

Sigurdur
  • 61
  • 1
  • 3