Re: event pressure:
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