Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

NSBezierPathMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa Drawing MBS MacBase Plugin 12.5 Yes No No Yes, macOS only No
Function: The plugin class for a Cocoa NSBezierPath.
Notes:
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.

Feedback, Comments & Corrections

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.
The points are stored in the following order: controlPoint1, controlPoint2, endPoint. Ovals, arcs, and Bezier curves all use curve elements to specify their geometry.
Contains 3 points.
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.
This path element does not result in any drawing. Using this command in the middle of a path results in a disconnected line segment.
Contains 1 point.

Window Rule Constants

Constant Value Description
NSEvenOddWindingRule 1 Specifies the even-odd winding rule.
Count the total number of path crossings. If the number of crossings is even, the point is outside the path. If the number of crossings is odd, the point is inside the path and the region containing it should be filled.
NSNonZeroWindingRule 0 Specifies the non-zero winding rule.
Count each left-to-right path as +1 and each right-to-left path as -1. If the sum of all crossings is 0, the point is outside the path. If the sum is nonzero, the point is inside the path and the region containing it is filled. This is the default winding rule.

This class has no sub classes.

Some methods using this class:

Some examples which use this class:


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


NSAutoreleasePoolMBS   -   NSBitmapImageRepMBS




Links
MBS FileMaker Plugins