I can´t draw bitmap with GUI_BMP_DrawEx() function, this is my code:
static void _ShowBMP(const TCHAR* sFilename)
{
int XSize, YSize, XPos, YPos, result;
FIL hFile;
FRESULT error;
error = f_open(&hFile, sFilename, (FA_READ | FA_OPEN_EXISTING));
if (error == FR_OK)
{
GUI_ClearRect(0, 0, 480, 272);
XSize = GUI_BMP_GetXSizeEx(_GetData, (void *)&hFile);
YSize = GUI_BMP_GetYSizeEx(_GetData, (void *)&hFile);
XPos = (XSize > 480) ? 0 : 160 - (XSize / 2);
YPos = (YSize > 272) ? 60 : 150 - (YSize / 2);
result = GUI_BMP_DrawEx(_GetData, (void *)&hFile, XPos , YPos );
if (!result)
{
GUI_Delay(2000);
}
f_close(&hFile);
}
}
and my getData() function
/*static*/ int _GetData(void * p, const U8 ** ppData, unsigned NumBytesReq, U32 Off)
{
U8 _acBuffer[0x20000];
unsigned int NumBytesRead;
FIL* phFile;
FRESULT error;
phFile = p;
// if (NumBytesReq > sizeof(_acBuffer))
// {
// NumBytesReq = sizeof(_acBuffer);
// }
//
// Set file pointer to the offset location
//
error = f_lseek(phFile, Off);
error = f_read(phFile, _acBuffer, sizeof(_acBuffer), &NumBytesRead);
*ppData = _acBuffer;
return NumBytesRead;
}
I have try increasing
GUI_ALLOC_AssignMemory((void *)GUI_MEMORY_ADDR, GUI_NUMBYTES); This to 0x200000
and I have try increasing _acBuffer
and I have try with (void *)&hFile insted of &hFile as someone mentioned in other post, but nothing happend
GUI_BMP_DrawEx() function returns 1 so, something is wrong.
could anybody help me?
static void _ShowBMP(const TCHAR* sFilename)
{
int XSize, YSize, XPos, YPos, result;
FIL hFile;
FRESULT error;
error = f_open(&hFile, sFilename, (FA_READ | FA_OPEN_EXISTING));
if (error == FR_OK)
{
GUI_ClearRect(0, 0, 480, 272);
XSize = GUI_BMP_GetXSizeEx(_GetData, (void *)&hFile);
YSize = GUI_BMP_GetYSizeEx(_GetData, (void *)&hFile);
XPos = (XSize > 480) ? 0 : 160 - (XSize / 2);
YPos = (YSize > 272) ? 60 : 150 - (YSize / 2);
result = GUI_BMP_DrawEx(_GetData, (void *)&hFile, XPos , YPos );
if (!result)
{
GUI_Delay(2000);
}
f_close(&hFile);
}
}
and my getData() function
/*static*/ int _GetData(void * p, const U8 ** ppData, unsigned NumBytesReq, U32 Off)
{
U8 _acBuffer[0x20000];
unsigned int NumBytesRead;
FIL* phFile;
FRESULT error;
phFile = p;
// if (NumBytesReq > sizeof(_acBuffer))
// {
// NumBytesReq = sizeof(_acBuffer);
// }
//
// Set file pointer to the offset location
//
error = f_lseek(phFile, Off);
error = f_read(phFile, _acBuffer, sizeof(_acBuffer), &NumBytesRead);
*ppData = _acBuffer;
return NumBytesRead;
}
I have try increasing
GUI_ALLOC_AssignMemory((void *)GUI_MEMORY_ADDR, GUI_NUMBYTES); This to 0x200000
and I have try increasing _acBuffer
and I have try with (void *)&hFile insted of &hFile as someone mentioned in other post, but nothing happend
GUI_BMP_DrawEx() function returns 1 so, something is wrong.
could anybody help me?