HI, I have been trying hard from past four nights to get this thing work but so far not able to do that.I have taken and modified few of the code from the ndk-sample(in the samples directory in the ndk r7) for plasma -sample for passing and mapping the bitmap from the JNI. Following is my code snippet [?]:
*Android : *
#this code is running in a thread
Bitmap mBitmap = Bitmap.createBitmap(320,240,
Bitmap.Config.RGB_565);
renderPlasma(mBitmap);
#this code is running in a thread
*Native : *
Java_<my_package_name>_DrawCanvas_renderPlasma(JNIEnv * env, jobject obj,
jobject bitmap)
{
AndroidBitmapInfo info;
unsigned char** pixels;
int ret =10;
if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
return;
}
if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) {
return;
}
if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
return;
}
/* Now fill the values with a nice little plasma */
fill_plasma(&info, pixels );
AndroidBitmap_unlockPixels(env, bitmap);//i am hoping that the bitmap
has been mapped to the contents of "pixel" at this point.
}
struct vdIn *pvideoBuff = 0;//v4l2 structure which contains the raw YUV data
void fill_plasma( AndroidBitmapInfo* info, unsigned char* pxl )
{
unsigned char* buf = (unsigned char* )malloc(pvideoBuff->framesizeIn);
uvc_startCapture(pvideoBuff);//v4l2 function which returns the raw yuc
data form the uvc compliant webcamera
compress_yuyv_to_jpeg(pvideoBuff, buf, pvideoBuff->framesizeIn, 80,
pvideoBuff->formatIn); //method to convert raw data into jpeg format- Quiet
popular code on the web
pxl = &buf;//i am thinking the pxl will have now all the contents of
the jpeg converted buffer
}
//the bitmap being returned from the native code has to be drawn on the
bitmap continuously.
canvas.drawBitmap(mBitmap, 0,0, null);
I suspect that pixel being a 2D array , I have to assisgn each array
elements from the buf.Plz correct me or slap a rockstar reply to this
problem.
Best Rgds and Thanks in advance
Softy
"..pain is temporary.....quitting lasts forever......"
--
You received this message because you are subscribed to the Google Groups
"Android Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/android-discuss?hl=en.
<<360.gif>>
