Draw bitmap with GUI_BMP_DrawEx() function, LPCXpresso54608 board

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Draw bitmap with GUI_BMP_DrawEx() function, LPCXpresso54608 board

      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?
    • Hi,

      Which version of emWin are you using?

      What kind of BMP are you trying to display?

      Does it work with another BMP (e.g. instead 16bit a 24bit BMP)?

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      On my end the BMPs are getting displayed correctly.

      You can find the emWin version in GUI_Version.h.
      Can you also post your LCD configuration (I guess it's named support_emwin.c)?

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      I gave it a try and checked it with version 5.38 of emWin. The BMPs are getting dipslayed properly.

      Maybe there is an issue with the filesystem?

      Please try the example attached. There I draw the screen.bmp slightly different. I converted into a c-array and compile into the application. This way you don't have a FS in between.

      Regards,
      Sven
      Files
      • DrawBMP.zip

        (339.4 kB, downloaded 293 times, last: )
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.