• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: event pressure:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: event pressure:


  • Subject: Re: event pressure:
  • From: Jonathan Chetwynd <email@hidden>
  • Date: Sun, 11 Dec 2005 22:21:33 +0000

Mike,

thanks for that, %f certainly works. however I'm having difficulty interpreting the documentation...

how does one use this value?

[path setLineWidth:%f*255]; //obviously isn't right...

cheers

Jonathan Chetwynd
Accessible Solutions
http://www.eas-i.co.uk



On 11 Dec 2005, at 20:41, Mike Paquette wrote:


On Dec 11, 2005, at 12:31 PM, Jonathan Chetwynd wrote:

NSLog(@"pressure: %d ", [event pressure]);

the output values are far too high: ~ 1080795136 or 1072693248

supposedly between 0 & 1

The "%d" format token expects an integer value. -pressure returns a float value, which in many architectures (ahem) is returned in a different register and with a different bitwise representation than an integer. Try:

NSLog(@"pressure: %f ", [event pressure]);

The float will be promoted to a double per the standard C calling conventions, and the format string %f will see a double and process it properly.

See also:

http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/ObjC_classic/Classes/NSEvent.html

pressure
Returns a value from 0.0 through 1.0 indicating the pressure applied to the input device (used for appropriate devices).

- (float)pressure

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: event pressure:
      • From: Mike Paquette <email@hidden>
    • Re: event pressure:
      • From: Shawn Erickson <email@hidden>
References: 
 >event pressure: (From: Jonathan Chetwynd <email@hidden>)

  • Prev by Date: Re: Setters, Getters and efficiency
  • Next by Date: Re: event pressure:
  • Previous by thread: Re: event pressure:
  • Next by thread: Re: event pressure:
  • Index(es):
    • Date
    • Thread