• 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: Mike Paquette <email@hidden>
  • Date: Sun, 11 Dec 2005 14:42:19 -0800

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...


%f is a formatting token used within string formatting functions, and is not an appropriate variable name.

You'll want to pass the pressure value in a properly scaled form to the setLineWidth: method.

Since -pressure returns a float value, and -setLineWidth takes a float value, declare a float and operate on the pressure value as a float:


- (void) setLineWidth: (NSBezierPath *)path fromEvent:(NSEvent *)event
{
float pressureValue;

pressureValue = [event pressure];

// Scale the pressure to get a width from 0 to 255, for this example
pressureValue *= 255.0;

// Set the line width that 'path' will be using
[path setLineWidth:pressureValue];

// void method, so no explicit return is needed
}



_______________________________________________
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: Jonathan Chetwynd <email@hidden>
    • Re: event pressure:
      • From: Jonathan Chetwynd <email@hidden>
References: 
 >event pressure: (From: Jonathan Chetwynd <email@hidden>)
 >Re: event pressure: (From: Jonathan Chetwynd <email@hidden>)

  • Prev by Date: Re: event pressure:
  • Next by Date: socket spy
  • Previous by thread: Re: event pressure:
  • Next by thread: Re: event pressure:
  • Index(es):
    • Date
    • Thread