Displaying BMP file on LPC54628

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

    • Displaying BMP file on LPC54628

      Hi,

      Currently I'm using LPC54628 development board and trying to display any image (BMP in general). I have 32x32 bmp image converted to C file. This is code generated from Bitmap Converter.

      C Source Code

      1. static GUI_CONST_STORAGE unsigned short _acface[] = {
      2. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      3. 0x0056,
      4. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      5. 0x0056,
      6. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      7. 0x0056,
      8. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0377, 0x0478, 0x0478, 0x0478, 0x0478, 0x0478, 0x0477, 0x0377, 0x0367, 0x0366, 0x0156, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      9. 0x0056,
      10. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0799, 0x0EDE, 0x0EDF, 0x0EDF, 0x0EDF, 0x0EDF, 0x0ECF, 0x0ECF, 0x0EBF, 0x0DBF, 0x0DAF, 0x099A, 0x0156, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      11. 0x0056,
      12. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0789, 0x0EEE, 0x0FEF, 0x0FEF, 0x0FEF, 0x0EDF, 0x0EDF, 0x0ECF, 0x0ECF, 0x0EBF, 0x0DBF, 0x0DAF, 0x0DAF, 0x0889, 0x0156, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      13. 0x0056,
      14. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0799, 0x0EEF, 0x0FFF, 0x0FFF, 0x0FEF, 0x0EEF, 0x0EDF, 0x0ECF, 0x0ECF, 0x0EBF, 0x0DBF, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x098A, 0x0156, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      15. 0x0056,
      16. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0799, 0x0EEF, 0x0FFF, 0x0FFF, 0x0FFF, 0x0EEF, 0x0EDF, 0x0ECF, 0x0EBF, 0x0DBF, 0x0DBF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0D9F, 0x0889, 0x0156, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      17. 0x0056,
      18. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0799, 0x0EEF, 0x0FFF, 0x0FFF, 0x0FFF, 0x0EEF, 0x0ECF, 0x0EBF, 0x0DBF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x098A, 0x0156, 0x0056, 0x0056, 0x0056, 0x0056,
      19. 0x0056,
      20. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0689, 0x0EEF, 0x0FFF, 0x0FFF, 0x0FFF, 0x0EEF, 0x0ECF, 0x0DBF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x088A, 0x0156, 0x0056, 0x0056, 0x0056,
      21. 0x0056,
      22. 0x0056, 0x0056, 0x0056, 0x0056, 0x0789, 0x0EEE, 0x0FFF, 0x0EEE, 0x0BBB, 0x0999, 0x0989, 0x0879, 0x0A8C, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0C9E, 0x097B, 0x0879, 0x0879, 0x0869, 0x0A7C, 0x0C9F, 0x0C9F, 0x0C9F, 0x0C9F, 0x098A, 0x0156, 0x0056, 0x0056,
      23. 0x0056,
      24. 0x0056, 0x0056, 0x0056, 0x0056, 0x0CCD, 0x0EEF, 0x0EDE, 0x0777, 0x0CCC, 0x0EEE, 0x0DDD, 0x0DDD, 0x0A9A, 0x0758, 0x0758, 0x0323, 0x0869, 0x0657, 0x0BBB, 0x0EEE, 0x0DDD, 0x0EEE, 0x0BAB, 0x0758, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C9F, 0x0255, 0x0056, 0x0056,
      25. 0x0056,
      26. 0x0056, 0x0056, 0x0056, 0x0056, 0x0DCD, 0x0EEF, 0x0999, 0x0EEE, 0x0FFF, 0x0FFF, 0x0999, 0x0555, 0x0EEE, 0x0CCC, 0x0647, 0x0D9F, 0x0546, 0x0EEE, 0x0CCC, 0x0555, 0x0BBB, 0x0FFF, 0x0FFF, 0x0CCC, 0x096B, 0x0C8F, 0x0C8F, 0x0C8F, 0x0145, 0x0056, 0x0056,
      27. 0x0056,
      28. 0x0056, 0x0056, 0x0056, 0x0056, 0x0DCD, 0x0EEF, 0x0989, 0x0FFF, 0x0FFF, 0x0FFF, 0x0BBB, 0x0CCC, 0x0EEE, 0x0EEE, 0x0869, 0x0D9F, 0x0879, 0x0FFF, 0x0DDD, 0x0DDD, 0x0CCC, 0x0FFF, 0x0FFF, 0x0EEE, 0x0859, 0x0C8F, 0x0C7F, 0x0C7F, 0x0145, 0x0056, 0x0056,
      29. 0x0056,
      30. 0x0056, 0x0056, 0x0056, 0x0056, 0x0DCD, 0x0EDF, 0x0A9B, 0x0CCC, 0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF, 0x0AAA, 0x0B8D, 0x0D9F, 0x097B, 0x0CCC, 0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF, 0x0AAA, 0x0B7D, 0x0C7F, 0x0C7F, 0x0C7F, 0x0145, 0x0056, 0x0056,
      31. 0x0056,
      32. 0x0056, 0x0056, 0x0056, 0x0056, 0x0CBD, 0x0EDF, 0x0DCE, 0x0878, 0x0DDD, 0x0FFF, 0x0FFF, 0x0FFF, 0x0BBB, 0x087A, 0x0D9F, 0x0D9F, 0x0C9E, 0x0868, 0x0DDD, 0x0FFF, 0x0FFF, 0x0FFF, 0x0BBB, 0x086A, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0144, 0x0056, 0x0056,
      33. 0x0056,
      34. 0x0056, 0x0056, 0x0056, 0x0056, 0x0CBD, 0x0ECF, 0x0ECF, 0x0EBF, 0x097A, 0x0879, 0x0989, 0x0879, 0x0A7C, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x097A, 0x0879, 0x0889, 0x0879, 0x0A7C, 0x0C8F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0144, 0x0056, 0x0056,
      35. 0x0056,
      36. 0x0056, 0x0056, 0x0056, 0x0056, 0x0CBD, 0x0ECF, 0x0ECF, 0x0DBF, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0C9F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0144, 0x0056, 0x0056,
      37. 0x0056,
      38. 0x0056, 0x0056, 0x0056, 0x0056, 0x0BAC, 0x0DBF, 0x0DBF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0C8F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0144, 0x0056, 0x0056,
      39. 0x0056,
      40. 0x0056, 0x0056, 0x0056, 0x0056, 0x0B9C, 0x0DBF, 0x0DAF, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0C8E, 0x0A7C, 0x097A, 0x096A, 0x0A7B, 0x0B8D, 0x0D9F, 0x0D9F, 0x0C9F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C6F, 0x0C7F, 0x0C7F, 0x0145, 0x0056, 0x0056,
      41. 0x0056,
      42. 0x0056, 0x0056, 0x0056, 0x0056, 0x0A9B, 0x0DAF, 0x0DAF, 0x0D9F, 0x0D9F, 0x0A7C, 0x0647, 0x0758, 0x0869, 0x0A7B, 0x0A7C, 0x0A7C, 0x0A7B, 0x0A7B, 0x0A7B, 0x0969, 0x0859, 0x0647, 0x0748, 0x0C7F, 0x0C6F, 0x0C6F, 0x0C7F, 0x0C8E, 0x0145, 0x0056, 0x0056,
      43. 0x0056,
      44. 0x0056, 0x0056, 0x0056, 0x0056, 0x0366, 0x0BAC, 0x0D9F, 0x0D9F, 0x0D9F, 0x0859, 0x0646, 0x0C8E, 0x0D9F, 0x0A7B, 0x086A, 0x097B, 0x0A7C, 0x097B, 0x086A, 0x0C8E, 0x0C8F, 0x0859, 0x0313, 0x0C6F, 0x0C6F, 0x0C6F, 0x0C8E, 0x0567, 0x0056, 0x0056, 0x0056,
      45. 0x0056,
      46. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0256, 0x0BAC, 0x0D9F, 0x0D9F, 0x0A7B, 0x0B7D, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0D9F, 0x0C9F, 0x0C8F, 0x0C8F, 0x0C7F, 0x0B7F, 0x0749, 0x0C6F, 0x0C6F, 0x0B8E, 0x0466, 0x0056, 0x0056, 0x0056, 0x0056,
      47. 0x0056,
      48. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0366, 0x0BAC, 0x0D9F, 0x0D9F, 0x0D9F, 0x0C9F, 0x0C9F, 0x0C9F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C6F, 0x0C6F, 0x0C6F, 0x0B8D, 0x0466, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      49. 0x0056,
      50. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0256, 0x0BAC, 0x0D9F, 0x0C9F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C6F, 0x0C6F, 0x0C6F, 0x0B8D, 0x0456, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      51. 0x0056,
      52. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0366, 0x0BAC, 0x0C9F, 0x0C8F, 0x0C8F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C6F, 0x0C6F, 0x0B8D, 0x0466, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      53. 0x0056,
      54. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0256, 0x0BAC, 0x0C9F, 0x0C8F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0C7F, 0x0B8E, 0x0456, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      55. 0x0056,
      56. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0266, 0x098A, 0x096A, 0x086A, 0x085A, 0x085A, 0x085A, 0x085A, 0x085A, 0x085A, 0x086A, 0x0466, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      57. 0x0056,
      58. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      59. 0x0056,
      60. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      61. 0x0056,
      62. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      63. 0x0056,
      64. 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056, 0x0056,
      65. 0x0056
      66. };
      67. GUI_CONST_STORAGE GUI_BITMAP bmface = {
      68. 32, // xSize
      69. 32, // ySize
      70. 64, // BytesPerLine
      71. 16, // BitsPerPixel
      72. (unsigned char *)_acface, // Pointer to picture data
      73. NULL, // Pointer to palette
      74. GUI_DRAW_BMP444_12
      75. };
      Display All

      I' d like to simply display it using:

      C Source Code

      1. int c = GUI_BMP_Draw(&bmface, 10, 10);
      But this function always returns 1 and of course nothing is displayed. I don't know where the problem is. Any other emwin features work like a charm - only images displaying fails. Maybe it's a problem with pallete or something? Maybe should I convert it to other format?

      Best regards!
    • Hi,

      You have to differentiate between bitmaps and BMPs. If we talk about bitmaps (e.g. in the manual) we always referring to emWin specific formats. A BMP is always the format invented by Microsoft.

      In your case you try to draw an emWin specific bitmap with a function made to display a BMP file. This can't work.

      Try GUI_DrawBitmap() instead.

      Another way might be to convert the BMP file into a c-array (which is exactly the same as the binary BMP file but as c-code). You can use the tool Bin2C.exe (found in the emWin download section on our website).

      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.