GUI_BMP_DrawEx swaps red and blue

  • Hello,
    to display bitmaps from SD card I use the drawing function

    Code
    GUI_BMP_DrawEx(APP_GetData, (void*)&SD_File, 0, 0);

    with the import function


    Code
    int APP_GetData(void * p, const U8 ** ppData, unsigned NumBytesReq, U32 Offs)
    {
      UINT 	NumBytesRead;
      U8 _acBuffer[2 * XSIZE_PHYS]; /*buffer must hold at least one line (2 byte * 800 pix)*/
      f_lseek((FIL *)p, Offs); /*set file pointer to the offset location*/
      f_read((FIL *)p, (void *)_acBuffer, NumBytesReq, &NumBytesRead); /*read data into buffer*/
      *ppData = (const U8 *)_acBuffer; /*data pointer = beginning of the buffer*/
      return (NumBytesRead); /*return number of read bytes*/
    }

    My color order is RGB.

    Code
    #define GUI_USE_ARGB 1 /*order of colors R|G|B*/

    On the screen the bitmaps are shown with red and blue swapped.
    On a PC the colors the same bmp files are displayed correctly.
    It looks like the saved bitmaps are coded RGB but GUI_BMP_DrawEx() expects BGR. How can this problem be solved?

    Regards
    Jan

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!