Platforms to show: All Mac Windows Linux Cross-Platform
Back to CGContextMBS class.
CGContextMBS.fillRoundedRect(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.4 | ✅ 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 |
Like UpdateNow in the RB window class.
CGContextMBS.frameArc(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.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
angles are in degree.
CGContextMBS.frameOval(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.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.frameRect(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.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Some examples using this method:
CGContextMBS.GetClipBoundingBox as CGRectMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns the bounding box of the clipping path, specified in user space.
The bounding box is the smallest rectangle completely enclosing all points in the clipping path, including control points for any Bezier curves in the path.
Available in Mac OS X v10.3 and later.
CGContextMBS.GetCTM as CGAffineTransformMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 4.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns nil on any error.
CGContextMBS.GetPathBoundingBox as CGRectMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The bounding box is the smallest rectangle completely enclosing all points in the path, including control points for Bezier and quadratic curves.
CGContextMBS.GetPathCurrentPoint as CGPointMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.GetTextPosition as CGPointMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 4.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns nil on any problem.
CGContextMBS.IsPathEmpty as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.MoveToPoint(x as Double, y as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.paintArc(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.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
angles are in degree.
CGContextMBS.paintOval(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.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.paintRect(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.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.PathContainsPoint(point as CGPointMBS, mode as Integer) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
A point is contained within a contexts path if it is inside the painted region when the path is stroked or filled with opaque colors using the path drawing mode mode. point is specified is user space.
Requires Mac OS X 10.4.
CGContextMBS.ReplacePathWithStrokedPath
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The resulting path is created such that filling it with the appropriate color will produce the same results as stroking the original path. You can use this path in the same way you can use the path of any context; for example, you can clip to the stroked version of a path by calling this function followed by a call to "ClipPath".
Requires Mac OS X 10.4.
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:
- /GraphicsMagick/GraphicsMagick/SVG Test/SVG Rastor
- /MacCG/CG Ovals
- /MacCG/CG Ovals with PDF in memory
- /MacCG/CGGradient test
- /MacCG/CoreGraphics PDF/PDF Text
- /MacCG/CoreGraphics PDF/PDF using Save and Restore
- /MacCG/CoreText/CoreText Dynamic Text Height
- /MacCG/CoreText/CoreText Test
- /MacCG/Print PDF with CoreGraphics/Print PDF with CoreGraphics
- /MacCG/Quartz Gradients
CGContextMBS.RotateCTM(angle as Double)
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:
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:
- /GraphicsMagick/GraphicsMagick/SVG Test/SVG Rastor
- /MacCG/CG Ovals with PDF in memory
- /MacCG/CGGradient test
- /MacCG/CoreGraphics Bitmap
- /MacCG/CoreGraphics PDF/PDF Text
- /MacCG/CoreGraphics PDF/PDF using Save and Restore
- /MacCG/CoreText/CoreText Dynamic Text Height
- /MacCG/Print PDF with CoreGraphics/Print PDF with CoreGraphics
- /MacCG/Quartz Gradients
- /MacCG/Rotate PDF Page
CGContextMBS.ScaleCTM(sx as Double, sy as Double)
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.SelectFont(name as string, size as Double, fontencoding as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Name: string that contains the PostScript name of the font to set.
'textEncoding' specifies how to translate from bytes to glyphs.
kCGEncodingFontSpecific | 0 |
kCGEncodingMacRoman | 1 |
As "Comic Sans MS" works, but not ""Comic Sans ms" this functions seems to be case sensitive.
Matthias Buercher notes that sometimes a font is not selected if the RGBFillColor was not set before.
You may need to reset the textmatrix with some code like c.TextMatrix = CGAffineTransformMBS.Identity. If the text matrix is different, your text may be rotated, skewed or resized.
Some examples using this method:
CGContextMBS.SetAllowsAntialiasing(allowsAntialiasing as boolean)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 7.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Allow antialiasing in context if allowsAntialiasing is true; don't allow it otherwise. This parameter is not part of the graphics state. A context will perform antialiasing if both allowsAntialiasing and the graphics state parameter shouldAntialias are true.
Requires Mac OS X 10.4 to work.
CGContextMBS.SetBlendMode(BlendMode as Integer)
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.
CGContextMBS.SetFillColor(color as CGColorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 17.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.SetFillColorSpace(colorspace as CGColorSpaceMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 4.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.SetFont(font as CGFontMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.SetLineDash(phase as Double, lengths as memoryblock, count as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 7.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
phase:
A value that specifies how far into the dash pattern the line starts, in units of the user space. For example, passing a value of 3 means the line is drawn with the dash pattern starting at three units from its beginning. Passing a value of 0 draws a line starting with the beginning of a dash pattern.
lengths:
A memoryblock of float values that specify the lengths of the painted segments and unpainted segments, respectively, of the dash pattern—or nil for no dash pattern.
For example, passing a memoryblock with the values [2,3] sets a dash pattern that alternates between a 2-user-space-unit-long painted segment and a 3-user-space-unit-long unpainted segment. Passing the values [1,3,4,2] sets the pattern to a 1-unit painted segment, a 3-unit unpainted segment, a 4-unit painted segment, and a 2-unit unpainted segment.
count
If the lengths parameter specifies a memorybloc, pass the number of elements in the memoryblock. Otherwise, pass 0.
CGContextMBS.SetShadow(x as Double, y as Double, blur as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
x/y: Specifies a translation of the context's coordinate system, to establish an offset for the shadow ({0,0} specifies a light source immediately above the screen).
blur: A non-negative number specifying the amount of blur.
Shadow parameters are part of the graphics state in a context. After shadowing is set, all objects drawn are shadowed using a black color with 1/3 alpha (i.e., RGBA = {0, 0, 0, 1.0/3.0}) in the DeviceRGB color space.
To turn off shadowing:
- Use the standard save/restore mechanism for the graphics state.
- Use CGContextSetShadowWithColor to set the shadow color to a fully transparent color (or pass nil as the color).
CGContextMBS.SetShadowWithColor(x as Double, y as Double, blur as Double, colorvalue as CGColorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 8.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
x/y: Specifies a translation in base-space.
blur: A non-negative number specifying the amount of blur.
colorvalue: Specifies the color of the shadow, which may contain a non-opaque alpha value. If nil, then shadowing is disabled.
See also SetShadow.
CGContextMBS.SetShouldSmoothFonts(shouldSmoothFonts as boolean)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 7.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Turn on font smoothing if shouldSmoothFonts is true; turn it off otherwise. This parameter is part of the graphics state. Note that this doesn't guarantee that font smoothing will occur: not all destination contexts support font smoothing.
Requires Mac OS X 10.2.
CGContextMBS.SetStrokeColor(color as CGColorMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 17.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.SetStrokeColorSpace(colorspace as CGColorSpaceMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 4.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.ShowText(text as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Each byte of the string is mapped through the encoding vector of the current font to obtain the glyph to display.
This function is more for quick and dirty text output, but not for serious drawing as it does not do most unicode strings correctly. Use ATS for better drawing.
Some RB 5.x versions show a bug that the text is not displayed on a CGContext in while running the application in debug mode.
CGContextMBS.ShowTextAtPoint(text as string, x as Double, y as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Each byte of the string is mapped through the encoding vector of the current font to obtain the glyph to display.
This function is more for quick and dirty text output, but not for serious drawing as it does not do most unicode strings correctly. Use ATS for better drawing.
Some RB 5.x versions show a bug that the text is not displayed on a CGContext in while running the application in debug mode.
Some examples using this method:
CGContextMBS.StrokeEllipseInRect(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.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.StrokeRect(rect as CGRectMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.StrokeRectWithWidth(rect as CGRectMBS, width as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
CGContextMBS.strokeRoundedRect(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.4 | ✅ 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 |
CGContextMBS.TextMatrix as CGAffineTransformMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | CoreGraphics | MBS MacCG Plugin | 4.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns nil on any error.
(Read and Write computed property)
CGContextMBS.TextPosition as CGPointMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
(Read and Write computed property)
Some examples using this property:
The items on this page are in the following plugins: MBS MacCG Plugin.