Discussions related to Visual Prolog
dominique f pannier
Active Member
Posts: 40
Joined: 23 Sep 2002 23:01

Expand a picture without flickering with 7.4

Unread post by dominique f pannier »

Hi,

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 ?
Attachments
ExpandPict 7.4.zip
(36.99 KiB) Downloaded 609 times
Regards
Dominique Pannier
dominique f pannier
Active Member
Posts: 40
Joined: 23 Sep 2002 23:01

Unread post by dominique f pannier »

The second project.
Attachments
ExpandPict 7.3.zip
(37.52 KiB) Downloaded 560 times
Regards
Dominique Pannier
Kari Rastas
Active Member
Posts: 36
Joined: 4 Mar 2000 0:01

Unread post by Kari Rastas »

RTWIcon1.png is missing from both projects. Causes an error in the exe file of the 7.4 project.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post 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.
Regards Thomas Linder Puls
PDC
dominique f pannier
Active Member
Posts: 40
Joined: 23 Sep 2002 23:01

Unread post by dominique f pannier »

Hi Thomas,
Sorry for the missing picture :-(
I trust that you will find a solution. :-)
Regards
Dominique Pannier
dominique f pannier
Active Member
Posts: 40
Joined: 23 Sep 2002 23:01

Unread post by dominique f pannier »

Hi,
This behavior was not corrected in the 7402 release. Does it need special investigations, or maybe could it easyly rectified directly in the pfc ?
Regards
Dominique Pannier
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post 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).
Regards Thomas Linder Puls
PDC
dominique f pannier
Active Member
Posts: 40
Joined: 23 Sep 2002 23:01

Unread post by dominique f pannier »

Thank you for these informations, Thomas,

I will explore these different techniques.

:D
Regards
Dominique Pannier
dominique f pannier
Active Member
Posts: 40
Joined: 23 Sep 2002 23:01

Unread post 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-)
Regards
Dominique Pannier
Post Reply