如何通过JNI将数组从C传递到Java而无需复制

时间:2014-10-12 16:14:56

标签: java android c

C我有

int left = ..., top = ..., width = ..., height = ...;
void *pixels = GetScreenshot(left, top, width, height);

// use JNI to call SaveImageToGallery

::free(pixels);

在Java中我有

public void SaveImageToGallery(int[] pixels, int width, int height)
{
    // ...
}

如何使用JNI将pixels传递给Java函数SaveImageToGallery而不复制它们?

0 个答案:

没有答案