原子哥你好,环境是stm32f103VE,屏是2.8寸电阻触摸屏驱动芯片ITL9341,移植的图片显示函数如下:
[mw_shl_code=c,true]BOOL AI_LoadPicFile(u8 *filename,u16 sx,u16 sy,u16 ex,u16 ey)
{// FIL* f_bmp;
int funcret;//返回值
//得到显示方框大小
u8 fileTpe;
int index;
for( index=0;index<1024;index++)
iclip[index]=0;
if(ey>sy)PICINFO.S_Height=ey-sy;
else PICINFO.S_Height=sy-ey;
if(ex>sx)PICINFO.S_Width=ex-sx;
else PICINFO.S_Width=sx-ex;
//显示区域无效
if(PICINFO.S_Height==0||PICINFO.S_Width==0)
{
PICINFO.S_Height=LCD_H;
PICINFO.S_Width=LCD_W;
return FALSE;
}
//影响速度
//SD_Init();//初始化SD卡,在意外拔出之后可以正常使用
//显示的开始坐标点
PICINFO.S_YOFF=sy;
PICINFO.S_XOFF=sx;
fileTpe=f_typetell((u8*)filename); //得到文件的类型
if(fileTpe==T_BMP)//得到一个BMP图像
{
funcret=BmpDecode(filename); //得到一个BMP图像
return funcret;
}
else if(fileTpe==T_JPG||fileTpe==T_JPEG)//得到JPG/JPEG图片
{
funcret=f_open(f_jpeg,(const TCHAR*)filename,FA_READ);//打开文件
if(funcret==FR_OK){
f_read(f_jpeg,jpg_buffer,1024,(UINT*)&br);
InitTable();
if((funcret=InitTag())!=FUNC_OK)return FALSE;
if((SampRate_Y_H==0)||(SampRate_Y_V==0))return FALSE ;
AI_Drow_Init();
funcret=Decode();
}
f_close(f_jpeg);
}else return FALSE; //非图片格式!!!
if(funcret==FUNC_OK)return TRUE;//解码成功
else return FALSE; //解码失败
}[/mw_shl_code]
1.可是有些jpg图片显示不了,你能帮试下吗,就这张图片
,
2.我显示这中类型240*320的图片需要3s多才刷完,是不是有点慢。 |