Page 1 of 1

Expand a picture without flickering with 7.4

Posted: 21 Mar 2013 10:43
by dominique f pannier

I joined two projects (the second in the next post) . One is build with VIP 7.4, the other one with VIP 7.3.
The purpose of the projects is to expand the same picture.
One can see that the expansion with 7.3 is perfect, when the expansion with 7.4 displays an unpleasant flickering. The code is fast the same one : the 7.3 project uses the gdiPlus predicates, the 7.4 the image and graphics ones.

Is there a way to avoid such a flickering ?
I noted the same effect when resizing the window displaying classes in the 7.4 project : may be is it connected to the use of scintilla ?

Posted: 21 Mar 2013 10:43
by dominique f pannier
The second project.

Posted: 21 Mar 2013 15:56
by Kari Rastas
RTWIcon1.png is missing from both projects. Causes an error in the exe file of the 7.4 project.

Posted: 21 Mar 2013 16:21
by Thomas Linder Puls
Hi, Dominique.

I can reproduce the problem.

You forgot to include the png-file, but I used another. However, I noticed that the 74 program raised an exception when the png was missing, the 73 program did not.

We will look at the problem.

It has nothing to do with the scintilla (removing it from your program has no effect.

Posted: 22 Mar 2013 9:13
by dominique f pannier
Hi Thomas,
Sorry for the missing picture :-(
I trust that you will find a solution. :-)

Posted: 14 Jun 2013 16:58
by dominique f pannier
This behavior was not corrected in the 7402 release. Does it need special investigations, or maybe could it easyly rectified directly in the pfc ?

Posted: 7 Oct 2014 12:32
by Thomas Linder Puls
I am sorry that I forgot to return on this issue.

In brief:
  • Vip 7.3 is bogus
  • Vip 7.4 and 7.5 are correct
This is the behavior I see:
  • In Vip 7.3: the update is smooth, because the images are just drawn never erased. After expansion the dialog contains two copies of the image. If the image was deflated instead of expanded, the dialog would end with remains of many copies of the image.
  • In Vip7.4 and 7.5 the update flickers, but there is no remains of previous drawings.
The cause of the flickering in Vip 7.4 and 7.5 is that the background is erased before the image is drawn. This is also the cause of the correct behavior (that remains of previous versions are removed/erased).

The Vip 7.3 behavior can be achieved in 7.4 and 7.5 by setting an eraseBackgroundResponder. In Vip7.5 it can look like this:

Code: Select all

implement imageSup     inherits userControlSupport     open core, vpiDomains, image   ...   clauses     new():-         generatedInitialize(),         setEraseBackgroundResponder({ = noEraseBackground }).
Actually, the behavior is only nearly the same, because now the background is never erazed, which leaves it white rather than gray. So to get the exact same behavior it is necessary either to erase it the first time:

Code: Select all

clauses     new():-         generatedInitialize(),         First = varM::new(true),         setEraseBackgroundResponder({ = E :-             if true = First:value then                 First:value := false,                 E = eraseBackground             else                 E = noEraseBackground end if         })

Or to draw to paint the correct color in the entire area when the control is initially created (but that is much more difficult than the solution above).

Or to draw in the entire area (this is often the approach when using an image to create double buffering).

Posted: 9 Oct 2014 8:31
by dominique f pannier
Thank you for these informations, Thomas,

I will explore these different techniques.


Posted: 9 Oct 2014 15:05
by dominique f pannier
setEraseBackgroundResponder is running fine.

But care must be taken if other windows are displayed: the action of this responder is not limited to the window in which it is used : when using simultaneously a tooltip window, for instance, when this one is moved it's not completely erased (the border is not removed) if the response was noEraseBackground.

So I'm using setEraseBackgroundResponder before expanding the images, (before launching the timer). And after the expansion (when the timer will be killed), I use the predicate resetEraseBackgroundResponder.

And then the behavior of other windows is totally normal. 8-)