Gami,

I assume that you have some way of knowing which device any given set of coordinates are from. You need to combine this information with your previous location data.

It sounds like you are doing this:
xy = coordinateFromSomeDevice()
draw line from prevXY to xy
prevXY = xy

With multiple devices you will get very weird results as xy keeps jumping from one device to another. Instead do something along these lines:
deviceIdx = indexOfSomeDevice()
xy = coordinateFromSomeDevice()
draw line from prevXY[deviceIdx] to xy
prevXY[deviceIdx] = xy

Exactly how you want to store each devices prev location is up to you and my pseudo code above makes many assumptions for simplicity.

Note: Do not draw outside of your view's drawRect: method. Use the setNeedsDisplayInRect: and drawRect: methods as intended and described here:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/chapter_1_section_1.html

-raleigh

On Jan 19, 2009, at 10:35 PM, Gami Ravi wrote:

Hi Graham,
Thanks for your answer.
Let me explain current scenario.
I have two input device from which i am getting raw coordinates(x,y).
When there is only one device i can draw paths using x,y coordinates. All things are working fine. Now if user writes using two input device on one surface simultaeously then it should draw two individual path depending on (x,y) coordinates from different input device.
so what is your inputs on this situation?

Thanks & Regards,
Ravi.

----- Original Message ----- From: "Graham Cox" <graham....@bigpond.com >
To: "Gami Ravi" <ravi.g...@einfochips.com>
Cc: <cocoa-dev@lists.apple.com>
Sent: Tuesday, January 20, 2009 11:56 AM
Subject: Re: draw two strokes(lines) simultaneousy on NSView



On 20 Jan 2009, at 5:12 pm, Gami Ravi wrote:

I want to create an application that will draws two strokes simultaneously on NSView. How can i draw two strokes simultaneously ?
Any help would be appreciated.

You don't say what you want to stroke, but let's assume a NSBezierPath.

// ...set up stroke parameters for stroke 1 here ...

[path stroke];

// ...set up stroke parameters for stroke 2 here...

[path stroke];



In other words, you just draw one stroke then the other.

If you really want to stroke two lines or other paths "simultaneously" (not sure what you mean by that either - nothing is truly simultaneous), then you can combine paths into one bezier path object and stroke it all at once. However, you can't apply separate stroke parameters to different parts of the path this way.

--Graham




Email Scanned for Virus & Dangerous Content by : www.CleanMailGateway.com

--
_____________________________________________________________________
Disclaimer: This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally
privileged and confidential information. If the reader of this message
is not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution, copying, or other use of
this message or its attachments is strictly prohibited. If you have
received this message in error, please notify the sender immediately by
replying to this message and please delete it from your computer. Any
views expressed in this message are those of the individual sender
unless otherwise stated.Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any
damage caused by any virus transmitted by this email.
__________________________________________________________________________
_______________________________________________

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/ledet%40apple.com

This email sent to le...@apple.com

_______________________________________________

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 arch...@mail-archive.com

Reply via email to