Platforms to show: All Mac Windows Linux Cross-Platform

NSBezierPathMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Drawing MBS MacBase Plugin 12.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The plugin class for a Cocoa NSBezierPath.

An NSBezierPath object allows you to create paths using PostScript-style commands. Paths consist of straight and curved line segments joined together. Paths can form recognizable shapes such as rectangles, ovals, arcs, and glyphs; they can also form complex polygons using either straight or curved line segments. A single path can be closed by connecting its two endpoints, or it can be left open.

An NSBezierPath object can contain multiple disconnected paths, whether they are closed or open. Each of these paths is referred to as a subpath. The subpaths of an NSBezierPath object must be manipulated as a group. The only way to manipulate subpaths individually is to create separate NSBezierPath objects for each.

For a given NSBezierPath object, you can stroke the path's outline or fill the region occupied by the path. You can also use the path as a clipping region for views or other regions. Using methods of NSBezierPath, you can also perform hit detection on the filled or stroked path. Hit detection is needed to implement interactive graphics, as in rubberbanding and dragging operations.

The current graphics context is automatically saved and restored for all drawing operations involving NSBezierPath objects, so your application does not need to worry about the graphics settings changing across invocations.

Line Joint Style Constants

Constant Value Description
NSBevelLineJoinStyle 2 Specifies a bevel line shape of the joints between connected segments of a stroked path.
See the setDefaultLineJoinStyle method for an example of the appearance.
NSMiterLineJoinStyle 0 Specifies a miter line shape of the joints between connected segments of a stroked path.
See the setDefaultLineJoinStyle method for an example of the appearance.
NSRoundLineJoinStyle 1 Specifies a round line shape of the joints between connected segments of a stroked path.
See the setDefaultLineJoinStyle method for an example of the appearance.

Line Cap Style Constants

Constant Value Description
NSButtLineCapStyle 0 Specifies a butt line cap style for endpoints for an open path when stroked.
See the setDefaultLineCapStyle method for an example of the appearance.
NSRoundLineCapStyle 1 Specifies a round line cap style for endpoints for an open path when stroked.
See the setDefaultLineCapStyle method for an example of the appearance.
NSSquareLineCapStyle 2 Specifies a square line cap style for endpoints for an open path when stroked.
See the setDefaultLineCapStyle method for an example of the appearance.

Path Element Command Constants

Constant Value Description
NSClosePathBezierPathElement 3 Marks the end of the current subpath at the specified point.
Note that the point specified for the Close Path element is essentially the same as the current point.
NSCurveToBezierPathElement 2 Creates a curved line segment from the current point to the specified endpoint using two control points to define the curve. more
NSLineToBezierPathElement 1 Creates a straight line from the current drawing point to the specified point.
Lines and rectangles are specified using this path element.
Contains 1 point.
NSMoveToBezierPathElement 0 Moves the path object's current drawing point to the specified point. more

Window Rule Constants

Constant Value Description
NSEvenOddWindingRule 1 Specifies the even-odd winding rule. more
NSNonZeroWindingRule 0 Specifies the non-zero winding rule. more

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries


The items on this page are in the following plugins: MBS MacBase Plugin.


NSAutoreleasePoolMBS   -   NSBitmapImageRepMBS


The biggest plugin in space...