On 20 Oct 2008, at 12:06 pm, Ian was here wrote:

I turned off mouse coalescing with a call to SetMouseCoalescingEnabled( false, NULL ). This gave me beautiful drawing. Only problem is that it's slow and takes a while to catch up after the mouse up event.

This is kind of an off the wall question, but is there another way to do this? I feel my only other option may be to use OPenGL, where the drawing would happen much faster.


I suspect the problem isn't the number of mouse events, but the number of points on the path this leads to. A path with more than a thousand or so points will become slow to draw.

Instead of using many points with straight line segments, how about using fewer points but calculating where the bezier control points should be and use curve segments? It will still be smooth but have much fewer "waypoints" and thus draw a lot faster.

Control points can be placed by using the fact that the line between the control point and the end (or start) point of the curve is the tangent to the curve, and this can be found by detecting the direction the mouse was travelling in. You can obtain this from the deltaX and deltaY parameters of the mouse event.

hth,

Graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to