• 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: Interpolating NSBezierPath parameters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interpolating NSBezierPath parameters


  • Subject: Re: Interpolating NSBezierPath parameters
  • From: Shaun Wexler <email@hidden>
  • Date: Wed, 9 Apr 2003 11:17:39 -0700

On Tuesday, April 8, 2003, at 08:43 PM, Mark Flider wrote:

Hi all. I'm writing a program that takes discrete samples of point positions with line thickness and draws them onscreen. Since I would like this to be resolution-independent, I'm using Bezier curves to do so. However, it appears that I can't change a parameter along a curve. For example, I'd like to do something like:

drawPath = [NSBezierPath bezierPath];
[drawPath setLineWidth:width1];
[drawPath moveToPoint:aPoint1];
[drawPath setLineWidth:width2];
[drawPath moveToPoint:aPoint2];
[drawPath stroke];

Where the line width smoothly interpolates between width1 and width2. Similarly with color, etc. Is there a way to do this that I'm not finding in the documentation?

Using NSBezierPath, you could draw the line as an elongated trapezoid, and fill it as a closed path. At aPoint1, center a perpendicular line of width1, connecting the end points to a perpendicular line of width2, centered at aPoint2. The same technique can be used with actual curved paths, with the appropriate math's applied to the control points.

To achieve the gradient, there is a new CoreGraphics API for that purpose, requiring you to use CG to perform the drawing, however, instead of NSBezierPath: file:///Developer/Documentation/CoreTechnologies/graphics/Quartz2D/ WhatsNewQuartz2D/New/CGShading/index.html
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Interpolating NSBezierPath parameters (From: Mark Flider <email@hidden>)

  • Prev by Date: Document file package looks like normal directory?
  • Next by Date: Newbie: Prompt Before Quitting
  • Previous by thread: Interpolating NSBezierPath parameters
  • Next by thread: NSProgressIndicator won't disappear!
  • Index(es):
    • Date
    • Thread