Platforms to show: All Mac Windows Linux Cross-Platform

Back to CGContextMBS class.

CGContextMBS.SetAlpha(alpha as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the alpha value in the current graphics state to alpha.

Some examples using this method:

CGContextMBS.SetCharacterSpacing(spacing as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the current character spacing to 'spacing'.

The character spacing is added to the displacement between the origin of one character and the origin of the next.

CGContextMBS.SetCMYKFillColor(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 CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the fill color to a CMYK color.

colors are from 0 to 1 and alpha is from 0 (transparent) to 1 (solid).

CGContextMBS.SetCMYKStrokeColor(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 CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the stroke color to a CMYK color.

colors are from 0 to 1 and alpha is from 0 (transparent) to 1 (solid).

CGContextMBS.SetFlatness(flatness as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the path flatness parameter in the current graphics state to flatness.

CGContextMBS.SetFontSize(size as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the current font size to 'size'.

CGContextMBS.SetGrayFillColor(gray as Double, alpha as Double = 1.0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the fill color to a gray color.

gray is from 0 to 1 and alpha is from 0 (transparent) to 1 (solid).

Some examples using this method:

CGContextMBS.SetGrayStrokeColor(gray as Double, alpha as Double = 1.0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the stroke color to a gray color.

gray is from 0 to 1 and alpha is from 0 (transparent) to 1 (solid).

Some examples using this method:

CGContextMBS.SetLineCap(cap as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the line cap in the current graphics state to cap.

CGContextMBS.SetLineJoin(join as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the line join in the current graphics state to join.

CGContextMBS.SetLineWidth(width as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the line width in the current graphics state to width.
Example
#If XojoVersion >= 2019.02 Then
Dim p As ptr = g.Handle(Graphics.HandleTypes.CGContextRef)
Dim c As CGContextMBS = CGContextMBS.contextWithCGContext(p)
#Else
Dim h As Integer = g.Handle(g.HandleTypeCGContextRef)
Dim c As CGContextMBS = CGContextMBS.contextWithCGContext(h)
#EndIf

c.SetGrayStrokeColor(0,1)
c.SetGrayFillColor(0,1)
c.BeginPath
c.SetLineWidth 0.5
c.MoveToPoint 50, 550
c.AddLineToPoint 100, 600
c.StrokePath
c.Flush
c = nil

CGContextMBS.SetMiterLimit(limit as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the miter limit in the current graphics state to limit.

CGContextMBS.SetRenderingIntent(intent as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the rendering intent in the graphics state to 'intent'.

Possible values for intent:

kCGRenderingIntentDefault0
kCGRenderingIntentAbsoluteColorimetric1
kCGRenderingIntentRelativeColorimetric2
kCGRenderingIntentPerceptual3
kCGRenderingIntentSaturation4

CGContextMBS.SetRGBStrokeColor(red as Double, green as Double, blue as Double, alpha as Double = 1.0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the stroke color to a RGB color.

colors are from 0 to 1 and alpha is from 0 (transparent) to 1 (solid).

Some examples using this method:

CGContextMBS.SetShouldAntialias(shouldAntialias as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Turn off antialiasing if 'shouldAntialias' is zero; turn it on otherwise.

This parameter is part of the graphics state.

CGContextMBS.SetTextDrawingMode(mode as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Set the text drawing mode to 'mode'.

Possible values:

kCGTextFill 0
kCGTextStroke 1
kCGTextFillStroke 2
kCGTextInvisible 3
kCGTextFillClip 4
kCGTextStrokeClip 5
kCGTextFillStrokeClip6
kCGTextClip 7

Some examples using this method:

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


The biggest plugin in space...