该程序应从 SD 卡中获取图像并调整其亮度。并且图像是通过 NDK C 代码从 SD 卡中获取的。需要注意的是,描述图像路径的字符串通过 JNI 传递给 NDK。
Java代码:
private void adjustBrightness() {
imagePath = (Environment.getExternalStorageDirectory().getPath()+"earthglobe.jpeg").toCharArray();
brightness(imagePath, brightness);
}
public native void brightness(char[] imagePath, float brightness);
NDK 代码:
JNIEXPORT void JNICALL Java_com_example_ImageActivity_brightness(JNIEnv * env,char[] bitmappath, jfloat brightnessValue)
{
string bmpath = bitmappath+'\0';
jobject obj = fopen( bitmappath , "rb" );
}