Platforms to show: All Mac Windows Linux Cross-Platform
Back to CGContextMBS class.
CGContextMBS.addArcToPath(x as Double, y as Double, w as Double, h as Double, startAngle as Integer, arcAngle as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.AddEllipseInRect(r as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
See the function CGPathMBS.AddEllipseInRect for more information on how the path for the ellipse is constructed.
Requires Mac OS X 10.4.
CGContextMBS.addOvalToPath(x as Double, y as Double, w as Double, h as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.AddPath(path as CGPathMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The points in path are transformed by the CTM of context before they are added.
Requires Mac OS X 10.2.
CGContextMBS.addRoundedRectToPath(x as Double, y as Double, w as Double, h as Double, arcWidth as Double, arcHeight as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.BeginPage(mediabox as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Note that a context has a double path in use at any time: a path is not part of the graphics state.
Some examples using this method:
CGContextMBS.BeginTransparencyLayer(auxiliaryInfo as Dictionary = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 12.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
All subsequent drawing operations until a corresponding EndTransparencyLayer are composited into a fully transparent backdrop (which is treated as a separate destination buffer from the context). After the transparency layer is ended, the result is composited into the context using the global alpha and shadow state of the context. This operation respects the clipping region of the context. After a call to this function, all of the parameters in the graphics state remain unchanged with the exception of the following:
- The global alpha is set to 1.
- The shadow is turned off.
- The blend mode is set to 'kCGBlendModeNormal'.
Ending the transparency layer restores these parameters to the values they had before BeginTransparencyLayer was called. Transparency layers may be nested.
CGContextMBS.BeginTransparencyLayerWithRect(r as CGRectMBS, auxiliaryInfo as Dictionary = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 12.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This function is identical to BeginTransparencyLayer except that the content of the transparency layer will be bounded by rect (specified in user space).
CGContextMBS.clearRect(rect as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Remeber that in CoreGraphics the position 0/0 is in the bottom left corner. In Xojo 0/0 is in the top left corner.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Intersect the context's path with the current clip path and use the resulting path as the clip path for subsequent rendering operations. Use the winding-number fill rule for deciding what's inside the path.
CGContextMBS.ClipToMask(rect as CGRectMBS, mask as CGImageMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
rect: The rectangle to map the mask parameter to.
mask: An image or an image mask. If mask is an image, then it must be in the DeviceGray color space, may not have an alpha component, and may not be masked by an image mask or masking color.
If the mask parameter is an image mask, then Quartz clips in a manner identical to the behavior seen with the function DrawImage—the mask indicates an area to be left unchanged when drawing. The source samples of the image mask determine which points of the clipping area are changed, acting as an "inverse alpha" value. If the value of a source sample in the image mask is S, then the corresponding point in the current clipping area is multiplied by an alpha value of (1–S). For example, if S is 1 then the point in the clipping area becomes transparent. If S is 0, the point in the clipping area is unchanged.
If the mask parameter is an image, then mask acts like an alpha mask and is blended with the current clipping area. The source samples of mask determine which points of the clipping area are changed. If the value of the source sample in mask is S, then the corresponding point in the current clipping area is multiplied by an alpha of S. For example, if S is 0, then the point in the clipping area becomes transparent. If S is 1, the point in the clipping area is unchanged.
Available in Mac OS X v10.4 and later.
CGContextMBS.clipToRect(rect as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Intersect the current clipping path with 'rect'. Note that this function resets the context's path to the empty path.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Same as destructor later, but running now when you call method.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.ConcatCTM(transform as CGAffineTransformMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 4.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.Constructor(g as graphics)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Raises exception if we fail to get the CGContext from Xojo.
Works on macOS and iOS.
See also:
CGContextMBS.Constructor(handle as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The CGContext is retained.
See also:
CGContextMBS.Constructor(pic as Picture)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 20.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Raises exception, if the picture is not a bitmap picture.
Works on macOS and iOS.
See also:
CGContextMBS.CopyPath as CGPathMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Available in Mac OS X v10.6 and later.
CGContextMBS.DrawCGPDFDocument(pdf as Variant, rect as CGRectMBS, page as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Pass a CGPDFDocumentMBS object for the pdf argument.
The media box of the page is scaled, if necessary, to fit into 'rect'.
Some examples using this method:
CGContextMBS.DrawLayerAtPoint(Point as CGPointMBS, layer as CGLayerMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 12.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
context: The graphics context associated with the layer.
point: The location, in current user space coordinates, to use as the origin for the drawing.
layer: The layer whose contents you want to draw.
Calling the function DrawLayerAtPoint is equivalent to calling the function DrawLayerInRect with a rectangle that has its origin at point and its size equal to the size of the layer.
Available in Mac OS X version 10.4 and later.
CGContextMBS.DrawLayerInRect(rect as CGRectMBS, layer as CGLayerMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 12.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
context: The graphics context associated with the layer.
rect: The rectangle, in current user space coordinates, to draw to.
layer: The layer whose contents you want to draw.
The contents are scaled, if necessary, to fit into the rectangle.
Available in Mac OS X version 10.4 and later.
CGContextMBS.DrawLinearGradient(gradient as CGGradientMBS, startPoint as CGPointMBS, endPoint as CGPointMBS, options as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
gradient: A CGGradient object.
startPoint: The coordinate that defines the starting point of the gradient.
endPoint: The coordinate that defines the ending point of the gradient.
options: Option flags (kCGGradientDrawsBeforeStartLocation or kCGGradientDrawsAfterEndLocation) that control whether the fill is extended beyond the starting or ending point.
The color at location 0 in the CGGradient object is mapped to the starting point. The color at location 1 in the CGGradient object is mapped to the ending point. Colors are linearly interpolated between these two points based on the location values of the gradient. The option flags control whether the gradient is drawn before the start point or after the end point.
Available in Mac OS X v10.5 and later.
Some examples using this method:
CGContextMBS.DrawPath(mode as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.DrawPicture(pic as CGImageMBS, rect as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Remeber that in CoreGraphics the position 0/0 is in the bottom left corner. In Xojo 0/0 is in the top left corner.
CGContextMBS.DrawRadialGradient(gradient as CGGradientMBS, startCenter as CGPointMBS, startRadius as Double, endCenter as CGPointMBS, endRadius as Double, options as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
gradient: A CGGradient object.
startCenter: The coordinate that defines the center of the starting circle.
startRadius: The radius of the starting circle.
endCenter: The coordinate that defines the center of the ending circle.
endRadius: The radius of the ending circle.
options: Option flags (kCGGradientDrawsBeforeStartLocation or kCGGradientDrawsAfterEndLocation) that control whether the gradient is drawn before the starting circle or after the ending circle.
The color at location 0 in the CGGradient object is mapped to the circle defined by startCenter and startRadius. The color at location 1 in the CGGradient object is mapped to the circle defined by endCenter and endRadius. Colors are linearly interpolated between the starting and ending circles based on the location values of the gradient. The option flags control whether the gradient is drawn before the start point or after the end point.
Available in Mac OS X v10.5 and later.
Some examples using this method:
CGContextMBS.DrawShading(shading as CGShadingMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 6.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
shading: A Quartz shading. Quartz retains this object; upon return, you may safely release it.
Available in Mac OS X version 10.2 and later.
CGContextMBS.DrawTiledImage(pic as CGImageMBS, rect as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
rect: A rectangle that specifies the origin and size of the destination tile. Quartz scales the image—disproportionately, if necessary—to fit the bounds specified by the rect parameter.
image: The image to draw.
Quartz draws the scaled image starting at the origin of the rectangle in user space, then moves to a new point (horizontally by the width of the tile and/or vertically by the height of the tile), draws the scaled image, moves again, draws again, and so on, until the current clip region is tiled with copies of the image. Unlike patterns, the image is tiled in user space, so transformations applied to the CTM affect the final result.
Available in Mac OS X v10.5 and later.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.EndTransparencyLayer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Intersect the context's path with the current clip path and use the resulting path as the clip path for subsequent rendering operations. Use the even-odd fill rule for deciding what's inside the path.
Some examples using this method:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Some examples using this method:
CGContextMBS.FillEllipseInRect(rect as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Requires Mac OS X 10.4.
Some examples using this method:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.FillRect(rect as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Remeber that in CoreGraphics the position 0/0 is in the bottom left corner. In Xojo 0/0 is in the top left corner.
The items on this page are in the following plugins: MBS MacCG Plugin.