Thank you, Edge.
The data returned is a char *, and I do not have a pitch member. I have modified the code you gave to me.
The result is not what I expected. You can easily to see the difference between two images as below. The first image is the 320 X 240 (RGBA)which from the camera. The second one is from the program. They should be the same, but they are quite different.
According to the width, some parts are missing, and divided into 4 parts. Some of the height parts are still missing.
unsigned char *memptr = background.Lock(&info);
if (memptr)
{
unsigned long yctr;
for (yctr = 0; yctr <= (unsigned long)cparam.ysize; yctr++){
ClassEMemory::Copy(&memptr[yctr*info.width],&dataPtr[yctr*cparam.xsize],cparam.xsize*32/8);
}
background.Unlock();
}
DrawBackground(display);
cparam.ysize - height of the image (in pixels).
cparam.xsize - length of the image (in pixels).
I also find that info.width=256. info.height=256.
Therefore,the width is smaller than 320, and the height is larger than 240.
How can I fix such problem?
Thank you so much.