Recent

Author Topic: Move image onMouseMove  (Read 3260 times)

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Move image onMouseMove
« on: February 01, 2015, 10:55:53 pm »
Hi,

I've some speed problem with shifting image on TImage when use onMouseMove.
Every time I redraw the image by Image1.Canvas with proper shift. But it's slow.
I use BGRABtimap to draw on TImage, OnMouseDown I do snapshot and OnMouseMove I draw with shift
bmpI.Draw(Image1.Canvas,X-MouseXStart, Y-MouseYStart,false);

Can I simply redraw TImage (draw with shift) ? I can have white "not draw" outlined filed OnMouseMove, I can draw rest image after OnMouseUP.
Do not know if you understand what I mean, somethink like speed function Image1.Canvas.Shift(X,Y)

balazsszekely

  • Guest
Re: Move image onMouseMove
« Reply #1 on: February 02, 2015, 06:50:00 am »
I'm not sure, if I understand your correctly, but instead of drawing each time the image with shift, just draw once to a TImage. Then move the the image left or right according to the mouse position.

bigeno

  • Sr. Member
  • ****
  • Posts: 266
Re: Move image onMouseMove
« Reply #2 on: February 02, 2015, 09:55:01 pm »
Thanks for the hint.
I checked a simple example and it move image quickly. So I implemented in my code and surprise  :o because it was same slow as my previous draw on canvas.
I had extra code which I did not notice  >:D on mousemove, sorry  :(
FIXED

 

TinyPortal © 2005-2018