Author Topic: Gesture challenge  (Read 917 times)

Biterider

  • Member
  • *****
  • Posts: 1041
  • ObjAsm Developer
    • ObjAsm
Gesture challenge
« on: December 29, 2021, 09:47:38 PM »
Hi
I want to implement a zoom gesture that acts on a window, but selectively in the x and y directions.  :icon_idea:

The idea is to analyze the 2-finger pinch gesture and get the line connecting the 2 contact points and break it down into delta x and delta y to calculate the zoom factors in each direction.

Has anyone done something like that?

Biterider

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10011
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Gesture challenge
« Reply #1 on: December 29, 2021, 10:12:54 PM »
The only way I have even zoomed a window is with MoveWindow(). Primitive but fast and smooth if the steps are not too large.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

jj2007

  • Member
  • *****
  • Posts: 13306
  • Assembly is fun ;-)
    • MasmBasic
Re: Gesture challenge
« Reply #2 on: December 29, 2021, 10:17:37 PM »
I don't have a touch screen, but these messages could be helpful:
WM_GESTURE
WM_TOUCH
WM_POINTER

You are certainly aware of RegisterTouchWindow & friends. Sounds like a nice project :thumbsup:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10011
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Gesture challenge
« Reply #3 on: December 29, 2021, 10:33:34 PM »
If you can track the two finger positions, the rest should be easy. You would probably need to write both a left hand and right hand resizer but they are not all that hard to do.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

raymond

  • Member
  • ***
  • Posts: 310
    • Raymond's page
Re: Gesture challenge
« Reply #4 on: December 30, 2021, 04:23:08 AM »
You could consider trying the Windows BitBlt function. I've never tried using it to stretch only in one direction but it could work.
Whenever you assume something, you risk being wrong half the time.
http://www.ray.masmcode.com/

Biterider

  • Member
  • *****
  • Posts: 1041
  • ObjAsm Developer
    • ObjAsm
Re: Gesture challenge
« Reply #5 on: December 31, 2021, 03:49:57 AM »
Hi
Thanks for your replays.  :biggrin:

AFAIK, there are 2 ways to get touch information: WM_TOUCH/WM_POINTER or WM_GESTURE and they are mutually exclusive.
WM_TOUCH is more of the raw approach, while WM_GESTURE gives a more elaborate result that can be used right away if you want the standard gestures.

In this case, WM_GESTURE returns a zoom gesture, but does not distinguish in which direction.
On the other hand, if we want to use WM_TOUCH we have to write a full gesture recognition algorithm, which is a huge undertaking.

Zooming the window contents is another topic that is not relevant right now.

Biterider