デジタルフォトフレーム——8、3、3プログラム作成_画像表示のテスト
15980 ワード
mainを書きます.cテスト下
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* digitpic */
int main(int argc, char **argv)
{
int iFdBmp;
int iRet;
unsigned char *pucBMPmem;
struct stat tBMPstat;
PT_DispOpr ptDispOpr;
extern T_PicFileParser g_tBMPParser;
T_PixelDatas tPixelDatas;
T_PixelDatas tPixelDatasSmall;
T_PixelDatas tPixelDatasFB;
if (argc != 2)
{
printf("%s
" , argv[0]);
return -1;
}
DebugInit();
InitDebugChanel();
DisplayInit();
ptDispOpr = GetDispOpr("fb");
ptDispOpr->DeviceInit();
ptDispOpr->CleanScreen(0);
/* BMP */
iFdBmp = open(argv[1], O_RDWR);
if (iFdBmp == -1)
{
DBG_PRINTF("can't open %s
", argv[1]);
}
fstat(iFdBmp, &tBMPstat);
pucBMPmem = (unsigned char *)mmap(NULL , tBMPstat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, iFdBmp, 0);
if (pucBMPmem == (unsigned char *)-1)
{
DBG_PRINTF("mmap error!
");
return -1;
}
/* BMP RGB , , LCD */
iRet = g_tBMPParser.isSupport(pucBMPmem);
if (iRet == 0)
{
DBG_PRINTF("%s is not bmp file
", argv[1]);
return -1;
}
tPixelDatas.iBpp = ptDispOpr->iBpp;
iRet = g_tBMPParser.GetPixelDatas(pucBMPmem, &tPixelDatas);
if (iRet)
{
DBG_PRINTF("GetPixelDatas error!
");
return -1;
}
tPixelDatasFB.iWidth = ptDispOpr->iXres;
tPixelDatasFB.iHeight = ptDispOpr->iYres;
tPixelDatasFB.iBpp = ptDispOpr->iBpp;
tPixelDatasFB.iLineBytes = ptDispOpr->iXres * ptDispOpr->iBpp / 8;
tPixelDatasFB.aucPixelDatas = ptDispOpr->pucDispMem;
PicMerge(0, 0, &tPixelDatas, &tPixelDatasFB);
tPixelDatasSmall.iWidth = tPixelDatas.iWidth/2;
tPixelDatasSmall.iHeight = tPixelDatas.iHeight/2;
tPixelDatasSmall.iBpp = tPixelDatas.iBpp;
tPixelDatasSmall.iLineBytes = tPixelDatasSmall.iWidth * tPixelDatasSmall.iBpp / 8;
tPixelDatasSmall.aucPixelDatas = malloc(tPixelDatasSmall.iLineBytes * tPixelDatasSmall.iHeight);
PicZoom(&tPixelDatas, &tPixelDatasSmall);
PicMerge(128, 128, &tPixelDatasSmall, &tPixelDatasFB);
return 0;
}