Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items

NSGraphicsMBS.highlightRect(x as Double, y as Double, w as Double, h as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 7.7 Yes No No Yes, macOS only No
Function: Highlights the rectangle.
Notes: In the Cocoa world the y axis is reversed. y=0 is on the bottom.

Feedback, Comments & Corrections

NSGraphicsMBS.imageInterpolation as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Drawing MBS MacCocoa Plugin 10.3 Yes No No Yes, macOS only No
Function: The interpolation behavior.
Notes:
Note that this value is not part of the graphics state, so it cannot be reset using restoreGraphicsState.
(Read and Write computed property)

Feedback, Comments & Corrections

NSGraphicsMBS.invalidate
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 10.3 Yes No No Yes, macOS only No
Function: Invalides the graphics object.

Feedback, Comments & Corrections

NSGraphicsMBS.isDrawingToScreen as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 10.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the drawing destination is the screen.
Notes:
True if the drawing destination is the screen, otherwise false.

A return value of false may mean that the drawing destination is a printer, but the destination may also be a PDF or EPS file. If this method returns false, you can call attributes to see if additional information is available about the drawing destination.

Feedback, Comments & Corrections

NSGraphicsMBS.isFlipped as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 10.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates the receiver's flipped state.
Notes:
True if the receiver is flipped, otherwise false.

The state is determined by sending isFlipped to the receiver's view that has focus. If no view has focus, returns false unless the receiver is instantiated using graphicsContextWithGraphicsPort:flipped: specifying true as the flipped parameter.

Available in Mac OS X v10.4 and later.

Feedback, Comments & Corrections

NSGraphicsMBS.restoreGraphicsState
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 10.3 Yes No No Yes, macOS only No
Function: Removes the receiver's graphics state from the top of the graphics state stack and makes the next graphics state the current graphics state.
Notes:
This method must have been preceded with a saveGraphicsState message to add the graphics state to the stack. Invocations of saveGraphicsState and restoreGraphicsState methods may be nested.

Restoring the graphics state restores such attributes as the current drawing style, transformation matrix, color, and font of the original graphics state.

Feedback, Comments & Corrections

NSGraphicsMBS.saveGraphicsState
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 10.3 Yes No No Yes, macOS only No
Function: Saves the graphics state of the current graphics context.
Notes: This method pushes the context onto the per-thread stack.

Feedback, Comments & Corrections

NSGraphicsMBS.ScaleCoordinates(x as Double, y as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.1 Yes No No Yes, macOS only No
Function: Scales coordinate system so the next drawing commands will use different scaling.
Notes: Use saveGraphicsState and restoreGraphicsState so you can restore the old state.

Feedback, Comments & Corrections

NSGraphicsMBS.set(transform as NSAffineTransformMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 15.1 Yes No No Yes, macOS only No
Function: Sets the current transform of the graphics environment.

Feedback, Comments & Corrections

NSGraphicsMBS.setClip(path as NSBezierPathMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.5 Yes No No Yes, macOS only No
Function: Replaces the clipping path of the current graphics context with the area inside the receiver's path.
Notes:
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.

Feedback, Comments & Corrections

NSGraphicsMBS.setColor(c as NSColorMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 9.8 Yes No No Yes, macOS only No
Function: Sets the color of subsequent drawing to the color that the receiver represents.

Feedback, Comments & Corrections

NSGraphicsMBS.SetColorBW(white as Double, alpha as Double = 1.0)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 7.7 Yes No No Yes, macOS only No
Function: Sets the color to a BW color.
Notes:
Values range is from 0.0 to 1.0.
Alpha 0.0 is invisible and alpha 1.0 is visible.

Feedback, Comments & Corrections

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 Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 7.7 Yes No No Yes, macOS only No
Function: Sets the color to a CMYK color.
Notes:
Values range is from 0.0 to 1.0.
Alpha 0.0 is invisible and alpha 1.0 is visible.

Feedback, Comments & Corrections

NSGraphicsMBS.SetColorHSV(hue as Double, saturation as Double, brightness as Double, alpha as Double = 1.0)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 7.7 Yes No No Yes, macOS only No
Function: Sets the color to an HSV color.
Notes: Values range is from 0.0 to 1.0.

Feedback, Comments & Corrections

NSGraphicsMBS.SetColorRGB(red as Double, green as Double, blue as Double, alpha as Double = 1.0)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 7.7 Yes No No Yes, macOS only No
Function: Sets the color to a RGB color.
Notes:
Values range is from 0.0 to 1.0.
Alpha 0.0 is invisible and alpha 1.0 is visible.

Feedback, Comments & Corrections

NSGraphicsMBS.setCurrentContext
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 14.2 Yes No No Yes, macOS only No
Function: Sets this context to be the current.

Feedback, Comments & Corrections

NSGraphicsMBS.setFillColor(c as NSColorMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 9.8 Yes No No Yes, macOS only No
Function: Sets the fill color of subsequent drawing to the receiver's color.

Feedback, Comments & Corrections

NSGraphicsMBS.setStrokeColor(c as NSColorMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 9.8 Yes No No Yes, macOS only No
Function: Sets the stroke color of subsequent drawing to the receiver's color.

Feedback, Comments & Corrections

NSGraphicsMBS.SetTransform(NSAffineTransform as Variant)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.2 Yes No No Yes, macOS only No
Function: Sets the current transformation matrix to the receiver's transformation matrix.
Notes:
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.

Feedback, Comments & Corrections

NSGraphicsMBS.shouldAntialias as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Drawing MBS MacCocoa Plugin 10.3 Yes No No Yes, macOS only No
Function: Whether the receiver should use antialiasing.
Notes:
This value is part of the graphics state and is restored by restoreGraphicsState.
(Read and Write computed property)

Feedback, Comments & Corrections

NSGraphicsMBS.sizeWithAttributes(text as string, DicAttributes as dictionary = nil) as NSSizeMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns the bounding box size the text occupies when drawn with the given attributes.
Example:
Dim NSGraphics as New NSGraphicsMBS()
Dim NSStringWidth as Double = NSGraphics.sizeWithAttributes("Hello World").Width

MsgBox("StringWidth from NSGraphicsMBS: " + Str(NSStringWidth))

Dim REALGraphics as Graphics = window1.Graphics
Dim REALStringWidth as Double = REALGraphics.StringWidth("Hello World")

MsgBox("StringWidth from REAL Graphics: " + Str(REALStringWidth))
Notes:
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.

Feedback, Comments & Corrections

NSGraphicsMBS.stroke(path as NSBezierPathMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.5 Yes No No Yes, macOS only No
Function: Draws a line along the receiver's path using the current stroke color and drawing attributes.
Example:
dim n as new NSImageMBS(300, 300)
dim g as new NSGraphicsMBS(n)

g.setStrokeColor NSColorMBS.redColor

dim r as NSRectMBS = NSMakeRectMBS(50, 50, 100, 100)
dim b as NSBezierPathMBS = NSBezierPathMBS.bezierPathWithRect(r)
b.lineWidth = 5
g.stroke(b)

g = nil

window1.Backdrop = n.CopyPicture // black image with red color rect
Notes: 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.

Feedback, Comments & Corrections

NSGraphicsMBS.strokeLine(point1 as NSPointMBS, point2 as NSPointMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.1 Yes No No Yes, macOS only No
Function: Strokes a line between two points using the current stroke color and the default drawing attributes.
Example:
dim n as new NSImageMBS(300, 300)
dim g as new NSGraphicsMBS(n)

g.setStrokeColor NSColorMBS.redColor

dim p1 as new NSPointMBS(10,10)
dim p2 as new NSPointMBS(50,50)
g.strokeLine(p1,p2)

g = nil

window1.Backdrop = n.CopyPicture // black image with red color line
Notes:
point1: The starting point of the line.
point2: The ending point of the line.

This method strokes the specified path immediately.

See also:

Feedback, Comments & Corrections

NSGraphicsMBS.strokeLine(x1 as Double, y1 as Double, x2 as Double, y2 as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.1 Yes No No Yes, macOS only No
Function: Strokes a line.

See also:

Feedback, Comments & Corrections

NSGraphicsMBS.strokeRect(r as NSRectMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.5 Yes No No Yes, macOS only No
Function: Strokes the path of the specified rectangle using the current stroke color and the default drawing attributes.
Example:
dim n as new NSImageMBS(300, 300)
dim g as new NSGraphicsMBS(n)

g.setStrokeColor NSColorMBS.redColor

dim r as NSRectMBS = NSMakeRectMBS(50, 50, 100, 100)
g.strokeRect(r)

g = nil

window1.Backdrop = n.CopyPicture // black image with red color rect
Notes:
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.

Feedback, Comments & Corrections

NSGraphicsMBS.TranslateCoordinates(x as Double, y as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacCocoa Plugin 12.1 Yes No No Yes, macOS only No
Function: Moves coordinate system so the next drawing commands will use different starting point.
Notes: Use saveGraphicsState and restoreGraphicsState so you can restore the old state.

Feedback, Comments & Corrections

Previous items

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




Links
MBS Xojo Chart Plugins