Having access to the Skia lib just for altering bitmap pixels directly
would indeed be a bit too much.
Thinking out loud here for a future solution. Although the OpenGL lib
is not yet accessible a lot of the Java OpenGL functions require a
java.nio.Buffer object. Can these Buffer objects be safely accessed
for read/write in native code using the GetDirectBufferAddress JNI
function without a performance hit?
If so, you could provide a similar function in android.graphics.Bitmap
that creates a Bitmap object from a user supplied java.nio.Buffer:
public static Bitmap createPointerBasedBitmap(Buffer pointer,
int stride, int width, int height, Bitmap.Config config)
It would not copy the data from the buffer and like the gl*Pointer()
functions it must be a direct buffer allocated on the native heap.
Developers can then do what they want with the pixels in native code
and use it like a normal Bitmap object back in Java. This would not
require any additional C-based API and I think Skia bitmaps can
already handle user-specified buffers internally.
Just a suggestion, not sure if it is feasible, any thoughts?
On Apr 16, 4:32 pm, David Turner <
di...@android.com> wrote:
> Just for the record, direct access to the Skia lib is *not* planned for any
> revision of the NDK.
> (The Skia headers are changing constantly, and there is no way we're going
> to provide a stable ABI for this lib).
>
> We'd rather provide a simple C-based API which would allow you to do
> something similar
> with more generic data structure.
>