How to improve image drawing performance.

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

  • How to improve image drawing performance.

    Hi,

    I have a window in my project that draws several images on the screen to be used as buttons. My problem is, I've noticed that every time this window is draw the performance decreases, it is possible to notice that the process takes too long.

    The question is. Is there a way to improve the drawing process of images?

    • I already load my images in memory before calling the method GUI_BMP_Draw
    • Using the same software version, I've removed the GUI_BMP_DRAW, with everything else unchanged, to run a test and the window was drawn pretty fast.

    Should I use another image format, instead of BMP?
    Should I use another method to draw my image, instead of GUI_BMP_Draw?

    Any advice will be welcome. Thanks.
  • Hi,

    the fastest way to draw an image is to use the emWin format. Use the bitmap the bitmap converter to convert an image into the proper format. The format depends on your color conversion used for the display driver.

    For example, if you run your LCD with GUICC_M8888I you should convert the images in to "true color with alpha, r/b swapped, alpha inverted".

    This will be the fastest format for drawing images.

    If you don't have enough memory available you might want to use the *dta format. This is almost the same as the image format above with difference that this can be placed on e.g. an SD card.

    If it takes too much time load the image every time it is required you can also draw them once into a memory device and use the memory device for displaying them.

    Maybe like this.

    C Source Code

    1. hMem = GUI_MEMDEV_Create(0, 0, SizeOfImageX, SizeOfImageY);
    2. GUI_MEMDEV_Select(hMem);
    3. GUI_BMP_Draw(pFileData, 0 ,0);
    4. GUI_MEMDEV_Select(0);
    5. GUI_MEMDEV_WriteAt(hMem, 10 , 10);


    Now you can use the memory device hMem instead of the BMP. Memory devices have the same color conversion as the emWin formats mentioned above. So displaying them should be quite fast, too,

    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.