該程序應該從SD卡中獲取圖像並調整其亮度。圖像通過NDK C代碼從SD卡中獲取。需要注意的是,描述圖像路徑的字符串通過JNI傳遞給NDK。將字符串傳遞給Android NDK中的C代碼
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");
}
這是可笑的:''jobject OBJ = FOPEN(bitmappath, 「RB」);'' – 2012-07-19 10:43:20