Sunday, April 20th 2014, 12:05am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Date of registration: Mar 14th 2012

Posts: 6

1

Wednesday, March 14th 2012, 9:48am

Bitmap Graphics Display issue

Hi,
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

Thanks,
techEmbedded

SEGGER - Adrian

Super Moderator

Date of registration: May 26th 2009

Posts: 406

2

Wednesday, March 14th 2012, 10:10am

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,
Adrian

Date of registration: Mar 14th 2012

Posts: 6

3

Wednesday, March 14th 2012, 11:18am

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_SetColor(BG_BLACK_COLOR_OPA_85);
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

Thanks
techEmbedded has attached the following image:
  • Original_genreicon.png

SEGGER - Adrian

Super Moderator

Date of registration: May 26th 2009

Posts: 406

4

Thursday, March 15th 2012, 2:46pm

Hello techEmbedded,

Could you please tell me which format you used to save the image as c file? Thank you.

Best regards,
Adrian

Date of registration: Mar 14th 2012

Posts: 6

5

Friday, March 16th 2012, 7:24am

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

Regards,
techEmbedded

Date of registration: Mar 14th 2012

Posts: 6

6

Monday, March 19th 2012, 7:44am

Hi,
Just for your info, I would like to attach the generated .c file of my .png image using Segger BmpCvt tool for your reference
Let me know in case any more info required.
Thanks in advance,
techEmbedded

P.S: .c file has been converted to .txt for attachment purpose
techEmbedded has attached the following file:

tuong

Beginner

Date of registration: Jul 10th 2012

Posts: 4

7

Thursday, July 12th 2012, 9:23am

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!

SEGGER - Adrian

Super Moderator

Date of registration: May 26th 2009

Posts: 406

8

Thursday, July 12th 2012, 12:51pm

Hello Tuong,

Yes, emWin can be used to draw PNG files. Please use the following link to download the additionally required files:

www.segger.com/link/emwin_png.zip

You can also find this information in the chapter 8.4 "PNG file support" in the emWin documentation.

Best regards,
Adrian

tuong

Beginner

Date of registration: Jul 10th 2012

Posts: 4

9

Friday, July 13th 2012, 5:57am

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!

SEGGER - Adrian

Super Moderator

Date of registration: May 26th 2009

Posts: 406

10

Friday, July 13th 2012, 9:16am

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,
Adrian