中级会员
- 积分
- 240
- 金钱
- 240
- 注册时间
- 2016-6-5
- 在线时间
- 44 小时
|
3金钱
我使用 文件系统把 bmp 图片 (ARPG 的)从SD卡中读取出来,然后显示,绘制出来的图片有黑边
同一张图片 使用 BmpCvt 转换成 C 文件,放到代码里显示就没有黑边,怎么解决
[mw_shl_code=c,true]LCD_Show_Picture_SD("1:/SYSTEM/APP/APPS/ICOS/app03_48.bmp",0,30,30,1,1);
GUI_DrawBitmap(&bmapp03_48,88,88);
void LCD_Show_Picture_SD(const char *sFilename,u8 type,u16 x,u16 y,u16 Num,u16 Denom)
{
int XSize,YSize;
GUI_HMEM hMem;
int i;
GUI_JPEG_INFO JpegInfo;
GUI_GIF_INFO InfoGif1;
GUI_GIF_IMAGE_INFO InfoGif2;
hMem=GUI_ALLOC_AllocZero(1024*1024);
Picture_Buffer=GUI_ALLOC_h2p(hMem);
Picture_result = f_open(&Picture_file,sFilename,FA_OPEN_EXISTING|FA_READ|FA_OPEN_ALWAYS);
if(Picture_result != FR_OK)
{
return;
}
Picture_result=f_read(&Picture_file,Picture_Buffer,Picture_file.fsize,&Picture_bw);
if(Picture_result != FR_OK)
{
return;
}
XSize=GUI_BMP_GetXSize(Picture_Buffer);
YSize=GUI_BMP_GetYSize(Picture_Buffer);
if(type==0)
{
if(Num==Denom)
{
GUI_BMP_Draw(Picture_Buffer,x,y);
}
else
{
GUI_BMP_DrawScaled(Picture_Buffer,x,y,Num,Denom);
}
}
else if(type==1)
{
GUI_JPEG_GetInfo(Picture_Buffer,Picture_file.fsize,&JpegInfo);
if(Num==Denom)
{
GUI_JPEG_Draw(Picture_Buffer,Picture_file.fsize,x,y);
}
else
{
GUI_JPEG_DrawScaled(Picture_Buffer,Picture_file.fsize,x,y,Num,Denom);
}
}
else if(type==2)
{
GUI_GIF_GetInfo(Picture_Buffer,Picture_file.fsize,&InfoGif1);
i=0;
if(i<InfoGif1.NumImages)
{
GUI_GIF_GetImageInfo(Picture_Buffer,Picture_file.fsize,&InfoGif2,i);
if(Num==Denom)
{
GUI_GIF_DrawSub(Picture_Buffer,Picture_file.fsize,(LCD_GetXSize()-InfoGif1.xSize)/2,(LCD_GetYSize()-InfoGif1.ySize)/2,i++);
}
else
{
GUI_GIF_DrawSubScaled(Picture_Buffer,Picture_file.fsize,(LCD_GetXSize()-InfoGif1.xSize*2)/2,(LCD_GetYSize()-InfoGif1.ySize*2)/2,i++,2,1);
}
}
else
{
i=0;
}
}
else
{
}
GUI_ALLOC_Free(hMem);
f_close(&Picture_file);
}[/mw_shl_code]
|
|