想用ucGUI显示FAT文件系统中的.jpg图片,程序如下:为什么显示不成功?求帮忙!!!!!
void ShowJPG(const char* sFilename)
{
GUI_HMEM hMem;
char *_acBuffer2;
GUI_JPEG_INFO JpegInfo;
hMem=GUI_ALLOC_AllocZero(480000); //ÉêÇëÒ»¿éÄÚ´æ¿Õ¼ä£¬²¢ÇÒÇåÁã
_acBuffer2=GUI_ALLOC_h2p(hMem); //½«ÉêÇëµ½µÄÄÚ´æµÄ¾ä±úת»»³ÉÖ¸ÕëÀàÐ
res=f_mount(&fs,"", 1);
res=f_open(&myfile,sFilename,FA_OPEN_ALWAYS|FA_READ|FA_OPEN_EXISTING);//
if(res!=FR_OK)
{
return;
}
res=f_read(&myfile,_acBuffer2,myfile.fsize,&br);
if(res!=FR_OK)
{
return;
}
GUI_JPEG_GetInfo(_acBuffer2,myfile.fsize,&JpegInfo);
GUI_JPEG_Draw(_acBuffer2,myfile.fsize,0,0);
GUI_ALLOC_Free(hMem);
f_close(&myfile);
}
|