Saturday, August 19th 2017, 1:55am 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.

Zhiying

Beginner

Date of registration: Aug 20th 2012

Posts: 19

1

Tuesday, May 21st 2013, 9:10am

How to improve alpha blending efficency ?

Hi everyone,

I create the following effect by using alpha blending, it looks alright in simulator, yet in hardware environment I can see very obvious flickering ( when the message box is about to popup, I can see clearly of the drawing process of the mask window) , it seems the alpha blending effect has brought in a lot workload to CPU. Any suggestion on how to reduce the flickering ?



Thanks & BR !

Zhiying.

SEGGER - Adrian

Super Moderator

Date of registration: May 26th 2009

Posts: 994

2

Tuesday, May 21st 2013, 9:56am

Hello Zhiying,

I would recommend using Multiple Buffering or a driver cache, in case Multiple Buffering is not supported by the driver you use. Please find detailed information on how to do so in the chapter "Display Driver" and "Multiple Buffering" in the emWin user manual.

Best regards,
Adrian

Zhiying

Beginner

Date of registration: Aug 20th 2012

Posts: 19

3

Wednesday, May 22nd 2013, 9:33am

Thanks Adrian,

The driver I'm using is GUIDRV_Lin_32, I tried the "multiple buffering" and the flickering is gone, but I need to wait approximately 1 sec to see the popup msg window. It's rather slow compared to other widgets' response.
I'm considering to remove the mask window effect :(

SEGGER - Adrian

Super Moderator

Date of registration: May 26th 2009

Posts: 994

4

Wednesday, May 22nd 2013, 10:37am

Hello Zhiying,

The alpha-blending feature is already highly optimized, so I would recommend "faking" the actual effect. You can try to do the following:

Overwrite the paint event of the parent dialog using a callback function. Create a variable (e.g. PopUpIsActive) which enables you determine if a popup window is active. In case the popup window has to be displayed, set the PopUpIsActive to 1 and invalidate the parent dialog. In the paint event do the same drawing but use a different (darker) color set for the displayed items. Once the popup window is removed again, set the variable PopUpIsActive to 0 and invalidate the parent dialog again.

Best regards,
Adrian

Zhiying

Beginner

Date of registration: Aug 20th 2012

Posts: 19

5

Thursday, May 23rd 2013, 2:25am

A very clever idea! :thumbup:
I already overwrote the paint event of parent window, I'll try your suggestion.

SEGGER - Adrian

Super Moderator

Date of registration: May 26th 2009

Posts: 994

6

Thursday, May 23rd 2013, 9:32am

Hello Zhiying,

An additional note on dimming. The next emWin version V5.22 will provide the functionality for blurring and dimming. This will actually do the task you want to achieve here. Please also note that there is currently no fixed release date.

Best regards,
Adrian

RodolfoDias

Beginner

Date of registration: Mar 3rd 2017

Posts: 14

7

Wednesday, May 3rd 2017, 9:52pm

More information about Adrian's advice

Hi, I am facing the same problem described in this thread and I would appreciate more information about how to implement the 'faking' effect. After overwritting the paint function how can I change the color of the widgets?

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
case WM_PAINT:
{
     // Default painting.
     WM_DefaultProc(pMsg);
     // Custom painting.
            
     // What now?           

}
break; 

This post has been edited 2 times, last edit by "RodolfoDias" (May 3rd 2017, 10:08pm)


SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 345

8

Friday, May 12th 2017, 4:44pm

Hi,

Maybe this is something you are looking for.

In this example we create some buttons. On a press on the center button we copy the some of the screen content into a memory device. Now we start an animation and each time the animation gets executed we change the color of the device and write it to the screen. The result is a fading effect for the buttons.

Depending on the size of the area to be copied this can be quite memory consuming.

Regards,
Sven
SEGGER - Schoenen has attached the following file:
  • FadeWindow.zip (8.51 kB - 43 times downloaded - Last download: Aug 14th 2017, 10:18pm)