Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to avoid flicker when resizing Composite or canvas?
How to avoid flicker when resizing Composite or canvas? [message #463916] Tue, 15 November 2005 17:31 Go to next message
Bill Ewing is currently offline Bill EwingFriend
Messages: 7
Registered: July 2009
Junior Member
Using google we found a lot of topics about "flicker" but not this
specific one.

We are familiar with and use the double buffered technique to prepare an
off screen image. We use a PaintListener's paintControl method to draw
the image into an composite or canvas on the screen.

We can't seem to avoid flicker. It seems the target composite or canvas
gets repainted to its background color before we draw our off screen image
onto it, somewhat defeating the purpose of double buffering.

Can anyone advise possible remedies?

In the Win32 world, I recall we used "Invalidate" or "InvalidateRect" GDI
functions to tell the system the screen or part of it needed updating.
There was a parameter that allowed us to erase everything or not. Do we
have the equivalent of that with SWT?
Re: How to avoid flicker when resizing Composite or canvas? [message #463920 is a reply to message #463916] Tue, 15 November 2005 17:56 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Create your canvas with the style bit SWT.NO_BACKGROUND - without this flag
the background is drawn before paint is called.

You can also investigate SWT.NO_REDRAW_RESIZE - without this style, the
entire area of the widget is redrawn on resize. With this style, only the
'backwards L' is redrawn. This style is suitable if you do not scale the
image each time it is resized.

SWT also has the style SWT.DOUBLE_BUFFERED - this gives you the OS supported
double buffering and you don't need to maintain your own offscreen image.

"B Ewing" <bewing@nexusbio.com> wrote in message
news:642211496254fcb7a2ee8e2291e05275$1@www.eclipse.org...
> Using google we found a lot of topics about "flicker" but not this
> specific one.
>
> We are familiar with and use the double buffered technique to prepare an
> off screen image. We use a PaintListener's paintControl method to draw
> the image into an composite or canvas on the screen.
>
> We can't seem to avoid flicker. It seems the target composite or canvas
> gets repainted to its background color before we draw our off screen image
> onto it, somewhat defeating the purpose of double buffering.
>
> Can anyone advise possible remedies?
>
> In the Win32 world, I recall we used "Invalidate" or "InvalidateRect" GDI
> functions to tell the system the screen or part of it needed updating.
> There was a parameter that allowed us to erase everything or not. Do we
> have the equivalent of that with SWT?
>
Re: How to avoid flicker when resizing Composite or canvas? [message #463928 is a reply to message #463920] Tue, 15 November 2005 18:30 Go to previous message
Bill Ewing is currently offline Bill EwingFriend
Messages: 7
Registered: July 2009
Junior Member
Thank you for the informative and speedy reply, Veronika.

BTW, we were frustrated with Win32 bugs underlying SWT's Table. We made a
Grid control that handles 2*32 rows or columns, lets us put any size
images or text in it, is super fast, and now thanks to you, is
flicker-free.

We started out wanting to make it compatible with the SWT Plus initiative
and let it be a drop-in replacement for Table. But that would mean using
the TableItem and TableColumn classes, plus we wanted rich features that
it could not support.
Previous Topic:Layout manager question
Next Topic:SWT.NO_REDRAW_RESIZE does not work within a SahsForm
Goto Forum:
  


Current Time: Tue Apr 16 09:43:33 GMT 2024

Powered by FUDForum. Page generated in 0.19042 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top