Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSGraphicsMBS class.
NSGraphicsMBS.setClip(path as NSBezierPathMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 12.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You should avoid using this method as a way of adjusting the clipping path, as it may expand the clipping path beyond the bounds set by the enclosing view. If you do use this method, be sure to save the graphics state prior to modifying the clipping path and restore the graphics state when you are done.
This method uses the current winding rule to determine the clipping shape of the receiver. This method does not affect the receiver's path.
Some examples using this method:
NSGraphicsMBS.setColor(c as NSColorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSGraphicsMBS.SetColorBW(white as Double, alpha as Double = 1.0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 7.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Values range is from 0.0 to 1.0.
Alpha 0.0 is invisible and alpha 1.0 is visible.
NSGraphicsMBS.SetColorCMYK(cyan as Double, magenta as Double, yellow as Double, black as Double, alpha as Double = 1.0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 7.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Values range is from 0.0 to 1.0.
Alpha 0.0 is invisible and alpha 1.0 is visible.
NSGraphicsMBS.SetColorHSV(hue as Double, saturation as Double, brightness as Double, alpha as Double = 1.0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 7.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Values range is from 0.0 to 1.0.
NSGraphicsMBS.SetColorRGB(red as Double, green as Double, blue as Double, alpha as Double = 1.0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 7.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Values range is from 0.0 to 1.0.
Alpha 0.0 is invisible and alpha 1.0 is visible.
Some examples using this method:
- /MacBase/NSGraphicsMBS draw to view
- /MacCocoa/Custom NSViewControl Drag
- /MacCocoa/NSSavePanel
- /MacCocoa/NSStatusItem/StatusItem with NSView
- /MacControls/Custom NSView Drag
- /MacControls/Custom NSView Drop
- /MacControls/Custom NSView without CocoaControl
- /PDFKit/Create Page with custom stamp annotation
- /PDFKit/Create Page with Page
- /PDFKit/PDFView/PDFView customized with picture overlay
NSGraphicsMBS.setCurrentContext
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Some examples using this method:
NSGraphicsMBS.setFillColor(c as NSColorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSGraphicsMBS.setStrokeColor(c as NSColorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 9.8 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSGraphicsMBS.SetTransform(NSAffineTransform as Variant)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 12.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Please use saveGraphicsState so you can restore the state before applying matrix for other drawings.
The current transformation is stored in the current graphics context and is applied to subsequent drawing operations. You should use this method sparingly because it removes the existing transformation matrix, which is an accumulation of transformation matrices for the screen, window, and any superviews. Instead use the concat method to add this transformation matrix to the current transformation matrix.
NSAffineTransform must be a NSAffineTransformMBS object.
NSGraphicsMBS.shouldAntialias as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | Cocoa Drawing | MBS MacCocoa Plugin | 10.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This value is part of the graphics state and is restored by restoreGraphicsState.
(Read and Write computed property)
NSGraphicsMBS.sizeWithAttributes(text as string, DicAttributes as dictionary = nil) as NSSizeMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
attributes: A dictionary of text attributes to be applied to the string. These are the same attributes that can be applied to an NSAttributedString object, but in the case of strings, the attributes apply to the entire string, rather than ranges within the string.
Returns the bounding box size the receiver occupies when drawn with attributes.
Some examples using this method:
NSGraphicsMBS.stroke(path as NSBezierPathMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 12.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The drawn line is centered on the path with its sides parallel to the path segment. This method uses the current drawing attributes associated with the receiver. If a particular attribute is not set for the receiver, this method uses the corresponding default attribute.
NSGraphicsMBS.strokeLine(point1 as NSPointMBS, point2 as NSPointMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 12.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
point1: The starting point of the line.
point2: The ending point of the line.
This method strokes the specified path immediately.
See also:
NSGraphicsMBS.strokeLine(x1 as Double, y1 as Double, x2 as Double, y2 as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 12.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
See also:
NSGraphicsMBS.strokeRect(r as NSRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 12.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
r: A rectangle in the current coordinate system.
The path is drawn beginning at the rectangle's origin and proceeding in a counterclockwise direction. This method strokes the specified path immediately.
NSGraphicsMBS.TranslateCoordinates(x as Double, y as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Drawing | MBS MacCocoa Plugin | 12.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Use saveGraphicsState and restoreGraphicsState so you can restore the old state.
Some examples using this method:
The items on this page are in the following plugins: MBS MacCocoa Plugin.