load a bitmap file using GUI_BMP_DrawEx()

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

  • load a bitmap file using GUI_BMP_DrawEx()

    I generated a screenshot bitmap file using GUI_BMP_SerializeEx(), I can open it on my PC, and then I need to draw this bitmap file on the screen again using GUI_BMP_DrawEx() or any others, and unfortunately when I use GUI_BMP_DrawEx(), it return 1 which mean error,

    - I can't use SetFilePointer(), or the alternate functions (ftell, and fseek), its not supported with libc version I'm working with, I uEZ software environment from TeamFDI, teamfdi.com/ , which don't support such functions, so is there a work around to do so.

    - I tried to save and read again another small bmp file, so it don't need multiple file read, and adjusting the file pointer, the GUI_BMP_DrawEx(), returned 0, and it accessed Getdata_fn once, but it didn't draw any thing.

    - I tried to use GUI_BMP_Draw(), as I read the whole bmp file first to a buffer with the proper size, and try to draw this buffer with GUI_BMP_Draw(), it return 0, but again nothing drawn.

    All the above tries based on sample code at 2DGL_DrawBMP.C code

    Find attached sample code illustrates my tries.

    • new 3.txt

      (1.68 kB, downloaded 635 times, last: )
  • Hi,

    I managed successfully to Draw the bmp file using GUI_BMP_Draw(), thanks, my concern now, is that it took too much time to save the screenshot using GUI_BMP_SerializeEx (), it generate 256KB file, the screen size is 480x272 4.3", how could I minimize this time, or minimize the file size generated?

    Also for GUI_BMP_Draw(), it took too much time to read the previous generated file to display.

  • Hello,

    Does your CPU interface with the frame buffer directly or in an indirect way?

    Please note that the function GUI_BMP_SerializeEx() reads the frame buffer, so storing a screenshot takes exactly the time for reading the frame buffer. In case of a direct interface reading preformance can not be improved. In case of an indirect interface it is recommended to use a display driver cache or Memory Devices.

    Drawing performance usually can be improved by using a data and instruction cache. For details on how to configure this, please refer to the user manual of your MCU.

    Best regards,
  • Hello,

    Please note that the function GUI_CreateBitmapFromStream...() can be used only to display emWin bitmaps, which can be created using the Bitmap Converter. For details on how to use the function GUI_CreateBitmapFromStream...(), please refer to the section 8.1.5 "2-D Graphic Library" -> "Graphic API" -> "Drawing streamed bitmaps".

    Reading cache or Memory Device data from RAM is faster than reading the frame buffer via indirect interface. Please note that the writing speed may also have an impact on the performance of the function GUI_BMP_SerializeEx().

    Best regards,