utouch-grail port for MoSync (Multitouch gesture recognition)

6 posts / 0 new
Last post
DI (FH) Ludwig Ertl
ert@csp.at's picture
Offline
Mobile Conjurer
Joined: 22 Feb 2010
Posts:
utouch-grail port for MoSync (Multitouch gesture recognition)

Hi,
I saw that MoSync recently added support for Multitouch, which is a nice to have feature for phones with a touchscreen. But what I am missing is the possibility to recognize touch gestures in order to be able to process them in my application.
I read that some Operating Systems support gesture recognition in their core (i.e. Windows Mobile), while others rely on the application to recognize them. So the best solution of course would be, if MoSync would be able to feed recognized touch gestures as an event, if the OS supports that.
As this is currently not the case, I ported the utouch-grail Gesture recognition library to MoSync. 

I hope that it is useful for some of you as it is for me. More details about the port can be found in the included README.TXT
The current build configuration is for Microwindows, therefore you have to enable the mosync\mosgrailev.c and mosync\winapi.c files if you want to use it with MoSync. There is a sample testing program: test-mosync\grail-gesture.c to test the library.

As I'm using it for multitouch gesture recognition, but not every phone that supports touch, also supports multitouch, a #define in the device profile would be handy so that I can only link the library if it is needed.

Regards,
Ludwig 

AttachmentSize
libgrail.zip104.18 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Abi Waqas
abi's picture
Offline
Mobile Wizard
Joined: 3 May 2010
Posts:

This is Amazing, very well done Ludwig.
Cheers,
Abi Waqas

Mattias Bybro
mattiasb's picture
Offline
Mobile Wizard
Joined: 20 Jan 2010
Posts:

Lovely! Must test :)

Abi Waqas
abi's picture
Offline
Mobile Wizard
Joined: 3 May 2010
Posts:

yeah, I am on it, is there any specific environment which I need to test it Erd?

Cheers,
Abi Waqas

DI (FH) Ludwig Ertl
ert@csp.at's picture
Offline
Mobile Conjurer
Joined: 22 Feb 2010
Posts:

To try it out, just:

1) Build configuration -> Active configuration -> Test
2) Change Project Type from Library to Application

3) Rebuild project

4) Run as -> Run MoRe Emulator

Draw your gestures and have a look at the lprintfln output. The gesture type that was recognized will be written to the log window.
Here is a table from my Windows API wrapper that may help you understanding the gestures recognized:

 

static int grailgesture2win32(int type)
{
	switch (type)
	{
	case GRAIL_TYPE_PINCH1:
	case GRAIL_TYPE_PINCH2:
	case GRAIL_TYPE_PINCH3:
	case GRAIL_TYPE_PINCH4:
	case GRAIL_TYPE_PINCH5:
		return GID_ZOOM;
	case GRAIL_TYPE_DRAG1:
		return GID_PAN;
	case GRAIL_TYPE_ROTATE1:
	case GRAIL_TYPE_ROTATE2:
	case GRAIL_TYPE_ROTATE3:
	case GRAIL_TYPE_ROTATE4:
	case GRAIL_TYPE_ROTATE5:
		return GID_ROTATE;
	case GRAIL_TYPE_TAP1:
		return GID_SELECT;
	case GRAIL_TYPE_TAP2:
	case GRAIL_TYPE_TAP3:
	case GRAIL_TYPE_TAP4:
	case GRAIL_TYPE_TAP5:
		return GID_TWOFINGERTAP;
	}
	return -1;
}
Regards,
Ludwig

Niklas Nummelin
niklas's picture
Offline
Mobile Wizard
Joined: 18 Dec 2007
Posts:

Pure awesomeness!

// Niklas