0

I would like to use the functionality of PixelCopy (Image to bitmap) on pre-Nougat devices but unfortunately it is not available. Is there some compat method available which does the same thing? I'm thinking that if it is not available, I will have to use reflection to get the ThreadedRenderer and reimplement PixelCopy that way. Has anyone thought of any better solutions?

Edit: This is different than the possible duplicate because it is about general Image not SurfaceView, so canvas solutions aren't relevant to it.

hellowill89
  • 1,538
  • 2
  • 15
  • 26
  • Seeing as the `ThreadedRenderer.copySurfaceInto()` method also doesn't exist below Nougat, I'm not sure how far reflection will get you. The implementation is also in C++. – TheWanderer Jan 11 '19 at 02:11
  • Are you sure `copySurfaceInto` doesn't exist below Nougat? The `ThreadedRenderer` class itself appears to exist pre-Nougat. – hellowill89 Jan 11 '19 at 02:30
  • Also, it's not a duplicate. My question is not about Views, but about a general `Surface` which can come from an `InputReader` rather than a `SurfaceView` – hellowill89 Jan 11 '19 at 02:30
  • Take a look for yourself: https://android.googlesource.com/platform/frameworks/base/+/marshmallow-release/core/java/android/view/ThreadedRenderer.java. – TheWanderer Jan 11 '19 at 02:32
  • Ok, I see. But `copyLayerInto` method exists and a hardware layer can be retrieved from an `Image`. I will update the question to say `Image` rather than `Surface` – hellowill89 Jan 11 '19 at 02:35
  • Actually given that change, there does seem to be some `Image` to `Bitmap` questions out there, so I will close this. – hellowill89 Jan 11 '19 at 02:38

0 Answers0