Freehand drawing quality

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Freehand drawing quality

Post by Mag » Fri Jun 27, 2014 1:36 pm

I'm working on a mobile app that should allows to the user to write with his/hers finger on the surface of the device. To do this, I use a graphic polygon (more about this here: http://forums.livecode.com/viewtopic.php?f=49&t=20581). Unfortunately, the basic quality of the polygons created by our cherished LC is really poor, and hardly I think it could be used for a commercial app. Is this something that could change in future? Anyone know if there are plans to get improvements in this field of the platform?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Freehand drawing quality

Post by dunbarx » Fri Jun 27, 2014 2:16 pm

Hi.

It looks like what you are after is a "smoothing" feature, common in many CAD drawing programs. A polyline can be massaged by adding several new points between each of the ones rendered with your finger. The process sees the trend of the adjacent points to determine the best location of the new ones to be added, so that they follow that trend with more resolution and, well, smoothness. The routine will ignore outliers, perhaps caused by a hiccup, when it decides which trends to follow.

I have no idea if this is something Runrev is interested in. I do know a person who is capable of doing this. He might be fooled (sorry, I meant persuaded) into writing a general purpose smoothing routine just for fun.

Hermann?

Craig

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Freehand drawing quality

Post by Mag » Fri Jun 27, 2014 2:48 pm

Hi Craig, Herman is very very talented and its work on this field is valuable.

The problem here, in my opinion, is the way LC creates, handles and display strokes. You can't go to the moon with a paper airplane, even if you are Neil Armstrong.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Freehand drawing quality

Post by dunbarx » Fri Jun 27, 2014 4:10 pm

There are curve fitting algorithms out there that can easily superimpose bezier or spline curves onto, say, three points, to create a "smooth" rendition between those points. The hard part to me is to integrate a longer string of points into a single optimal curve, since the tendency of each "section" must take into account the tendency of its neighbors.

I think the problem is not trivial, but eminently doable in LC. But it would be a labor of love. Probably academic, and not likely to be addressed...

Craig

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Freehand drawing quality

Post by Mag » Fri Jun 27, 2014 6:41 pm

Hi Craig,
Unfortunately, that's what I thought too, for this reason I went ahead with the project and I've invested days of work. Only now I discovered that the main functionality of the app is almost impossible to achieve with LC. In theory, LC can draw strokes with your finger, in practice the result is only suitable for the 90s. Believe me, I love LC, but unfortunately it is the second time that I can't finish a project because of some LC limitations that are not immediately apparent.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Freehand drawing quality

Post by dunbarx » Fri Jun 27, 2014 7:21 pm

Mag.

Good thing you did not try this with Hypercard.

LC is not a drawing program. It has limited power there, relying more on imported images and the like to provide artistic support. I guess just know this going forward.

I always wanted my favorite drafting program, MacDraft, to be able to support appleEvents to the extent that I could send drawing instructions to it from HC. I likely was the only one on the planet who wanted this, though.

Craig

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Freehand drawing quality

Post by Mag » Fri Jun 27, 2014 9:21 pm

:D

With a lot of emphasis, RunRev recently replaced the graphic engine of the platform with a more modern one, actually I don't know what this means. In my naivety, I was hoping to see also some improvements in the way LC manages the lines, unfortunately I do not see any visible change. Who knows, maybe the improvements has to be implemented yet.

Post Reply