Bitmap Graphics Display issue

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

  • Bitmap Graphics Display issue

    I observe an issue while displaying .png icon image having major curve ends & with transparent background
    The png icon image is converted to .c file using emWin BmpCvt tool
    While displaying those images using Segger emWin API "GUI_DrawBitmap" on transparent black pane, I observe that the edges are not sharp enough and at borders I can see white dots displaying the background video through the pane.
    I am using the Segger emWin version 5.14 API's

    Please let me know the reason behind the same and solution for it

  • Hello techEmbedded,

    This might have different reasons. The way your PNG image is shown on the display in the end depends on the original file, the actions which were done with the Bitmap Converter (e.g. "ConvertInto..."-functions, scaling) and the exact format which was used to store it as c file.

    Could you please send me the PNG file you use and a detailed description of what is done using the Bitmap Converter? I would like to reproduce the problem.

    Thank you in advance.

    Best regards,
  • Hi,
    Please find attached the png image with transparent background.
    We just open .png file and save as .c file in BmpCvt Tool
    This image is displayed on black opaque rectangle OSD
    GUI_DrawBitmap(&bmepg_horizontal_gasket, HGasketX0, HGasketY0);
    GUI_FillRoundedRect(ListBoxBk.x0, ListBoxBk.y0, ListBoxBk.x1, ListBoxBk.y1, 7);
    //Image draw API Call on top of above OSD
    GUI_DrawBitmap(&bmgenreicon, 360, 333);
    Image borders are not sharp enough and can see background video through those borders

    • Original_genreicon.png

      2.66 kB, 27×23, viewed 3,560 times
  • Hi
    Thanks for replying
    The Image as attached in previous post is of type .png format with transparent background
    I am using the Segger BMP Converter tool for emWin Version :5.02c.
    We just open this bitmap image using BmpCvt tool and use its option save-as to save it in .c file

  • Does emWin support drawing .png?

    Dear All,

    I use Segger BmpCvt to open a .png image, then use its save as feature to save to a .c file, select option 'true color with alpha channel'. then I use an API declared in GUI.h:
    int GUI_PNG_Draw (const void * pFileData, int DataSize, int x0, int y0);
    But I face compile error due to symbol GUI_PNG_Draw is undefined??

    Please advice me how to draw a .png image, I did try GUI_BMP_Draw but I have to convert the .png image to true color before using this function.

    Thanks for your time!
  • Dear Adrian,

    Thanks for your fast reply!

    I tried the files, complie no error!! However, I find that to use the GUI_PNG_Draw function, the pFileData must point to a real .png file (which contains .png header, channel, data...). So the BmpCvt does not help in this case, we have to use a hex editor, ex: HxD, to export a .c file from .png image. Correct me if I am wrong!?

    Thanks for your time!
  • Hello Tuong,

    You should find the tool Bin2C.exe in the Tool folder contained by your emWin shipment. This tool can be used to convert binary files to c-arrays. Unfortunately this tool is mentioned in the sections of the emWin documentation which explain the usage of JPEG and TTF files, but not in context with PNG files. I will review the documentation to make this clear in the future.

    If you have any further questions, please let me know.

    Best regards,