Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Image Flicker With Mouse Move
Image Flicker With Mouse Move [message #458415] Wed, 13 July 2005 09:49 Go to next message
Eclipse UserFriend
Originally posted by: nightblue99.yahoo.com

Hi;

I have a canvas with images on it. I add mouseMoveListener to the canvas,
such that

......
canvas.addMouseMoveListener(new MouseMoveListener(){
public void mouseMove(MouseEvent e) {
canvas.redraw(); /*Redraw all the images of canvas */
}


});

canvas.addPaintListener(new PaintListener(){
public void paintControl(PaintEvent e){

GC gc = e.gc;

//All image drawing operation are done here
gc.drawImages......

}

});

when moving one image of the canvas to the any position, (mouse down the
image and move the image), screen is flicker so much, how can I resolve
this problem?

Thanks for advance
Re: Image Flicker With Mouse Move [message #458423 is a reply to message #458415] Wed, 13 July 2005 13:55 Go to previous messageGo to next message
Robert Bacs is currently offline Robert BacsFriend
Messages: 165
Registered: July 2009
Senior Member
Use SWT.NO_BACKGROUND when creating the canvas.

If it still flickers then use double buffering in your paint handler.

Regards,
Boby


"nightblue" <nightblue99@yahoo.com> wrote in message
news:1ef4405d67ab70c0502df9ce95534d58$1@www.eclipse.org...
> Hi;
>
> I have a canvas with images on it. I add mouseMoveListener to the canvas,
> such that
>
> ......
> canvas.addMouseMoveListener(new MouseMoveListener(){
> public void mouseMove(MouseEvent e) {
> canvas.redraw(); /*Redraw all the images of canvas */
> }
>
>
> });
>
> canvas.addPaintListener(new PaintListener(){
> public void paintControl(PaintEvent e){
>
> GC gc = e.gc;
>
> //All image drawing operation are done here
> gc.drawImages......
>
> }
>
> });
>
> when moving one image of the canvas to the any position, (mouse down the
> image and move the image), screen is flicker so much, how can I resolve
> this problem?
>
> Thanks for advance
>
Re: Image Flicker With Mouse Move [message #458424 is a reply to message #458423] Wed, 13 July 2005 14:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nightblue99.yahoo.com

Hi;

I try SWT.NO_BACKGROUND option and I painted all the background problem
not solved. I try to draw all the images using the double buffering so the
same problem appeared. Actually the problem is mouseMove faster than
painting, I do not know;
Re: Image Flicker With Mouse Move [message #458429 is a reply to message #458424] Wed, 13 July 2005 14:53 Go to previous messageGo to next message
Robert Bacs is currently offline Robert BacsFriend
Messages: 165
Registered: July 2009
Senior Member
Why do you need to redraw on every mouseMove event ?

Boby

"nightblue" <nightblue99@yahoo.com> wrote in message
news:b364ffabebfc8edd9e49d3dc8e57ade3$1@www.eclipse.org...
> Hi;
>
> I try SWT.NO_BACKGROUND option and I painted all the background problem
> not solved. I try to draw all the images using the double buffering so the
> same problem appeared. Actually the problem is mouseMove faster than
> painting, I do not know;
>
Re: Image Flicker With Mouse Move [message #458431 is a reply to message #458424] Wed, 13 July 2005 15:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"nightblue" <nightblue99@yahoo.com> wrote in message
news:b364ffabebfc8edd9e49d3dc8e57ade3$1@www.eclipse.org...
> Hi;
>
> I try SWT.NO_BACKGROUND option and I painted all the background problem
> not solved. I try to draw all the images using the double buffering so the
> same problem appeared. Actually the problem is mouseMove faster than
> painting, I do not know;
>
Why not simply redraw an outline of the image on mousemove and actually only
redraw the image upon mouseup?
See how GEF does it?
Why do you need to move images on a canvas anyway?
--
Sunil
Re: Image Flicker With Mouse Move [message #458462 is a reply to message #458431] Wed, 13 July 2005 20:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nightblue99.yahoo.com

About Image Flicker: My design are is Canvas, the paintListener is
attached on it. When I pick a widget from the toolbar and drop on it, I
get the image and redraw the canvas then no problem. When I want to
focus on the image of the widget, new small rectangular widgets on the
NW(North West),N(North),W,E,S,C... are drawn that a user plays with
properties of the image of the widget(relocation,resize,..etc.). But when
the user mouse down on the C(Center of the image) and begins to mouse
move, the image of the widget is moving(in every move I call redraw of
the canvas) but then image flicking problems occur. Very fast painting can
be the problem? I dont know...
Re: Image Flicker With Mouse Move [message #458465 is a reply to message #458462] Wed, 13 July 2005 21:15 Go to previous messageGo to next message
Lucine is currently offline LucineFriend
Messages: 2
Registered: July 2009
Junior Member
I wonder if you received my reply earlier. To clarify, this is what I meant
in only the horizontal perspective:

addMouseMoveListener(new MouseMoveListener() {
public void mouseMove(MouseEvent e) {
int xLocationInParentCoordinates = e.x - mouseDownLocation
***this is e.x from MouseListener's mouseDown***
+ getLocation().x ***the location relative to your canvas if
events don't occur in the class which paints the canvas***



"nightblue" <nightblue99@yahoo.com> wrote in message
news:2696de7795b26dbb3d582e888407c248$1@www.eclipse.org...
> About Image Flicker: My design are is Canvas, the paintListener is
> attached on it. When I pick a widget from the toolbar and drop on it, I
> get the image and redraw the canvas then no problem. When I want to
> focus on the image of the widget, new small rectangular widgets on the
> NW(North West),N(North),W,E,S,C... are drawn that a user plays with
> properties of the image of the widget(relocation,resize,..etc.). But when
> the user mouse down on the C(Center of the image) and begins to mouse
> move, the image of the widget is moving(in every move I call redraw of
> the canvas) but then image flicking problems occur. Very fast painting can
> be the problem? I dont know...
>
Re: Image Flicker With Mouse Move [message #458475 is a reply to message #458465] Thu, 14 July 2005 09:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nightblue99.yahoo.com

Hi;

I can not understand what you have mentioned. Could you try to explain in
details?

thanks
Re: Image Flicker With Mouse Move [message #458521 is a reply to message #458462] Thu, 14 July 2005 14:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"nightblue" <nightblue99@yahoo.com> wrote in message
news:2696de7795b26dbb3d582e888407c248$1@www.eclipse.org...
> About Image Flicker: My design are is Canvas, the paintListener is
> attached on it. When I pick a widget from the toolbar and drop on it, I
> get the image and redraw the canvas then no problem. When I want to
> focus on the image of the widget, new small rectangular widgets on the
> NW(North West),N(North),W,E,S,C... are drawn that a user plays with
> properties of the image of the widget(relocation,resize,..etc.). But when
> the user mouse down on the C(Center of the image) and begins to mouse
> move, the image of the widget is moving(in every move I call redraw of
> the canvas) but then image flicking problems occur. Very fast painting can
> be the problem? I dont know...
>
Is there a particular reason why you aren't using GEF for this?
I have also developed a GUI editor and created it using GEF.
Works like a charm. Most of the problems you seem to be encountering are out
of the box in GEF.
Plus it comes with a bunch of other goodies.
---
Sunil
Re: Image Flicker With Mouse Move [message #458526 is a reply to message #458424] Thu, 14 July 2005 14:26 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You will need to provide sample code for us to debug.

"nightblue" <nightblue99@yahoo.com> wrote in message
news:b364ffabebfc8edd9e49d3dc8e57ade3$1@www.eclipse.org...
> Hi;
>
> I try SWT.NO_BACKGROUND option and I painted all the background problem
> not solved. I try to draw all the images using the double buffering so the
> same problem appeared. Actually the problem is mouseMove faster than
> painting, I do not know;
>
Previous Topic:Dynamic Buttons in Wizard Pages
Next Topic:EditMask available?
Goto Forum:
  


Current Time: Tue Oct 20 03:35:51 GMT 2020

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

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

Back to the top