Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

CGBitmapContextMBS class

Super class: CGContextMBS

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class CoreGraphics MBS MacCG Plugin 3.4 Yes No No Yes, macOS only No
Function: A class to hold a CoreGraphics bitmap context.
Sub Paint(g As Graphics)
dim c as CGPictureContextMBS
dim w as CGContextMBS // of window
dim p,m as Picture

c=new CGPictureContextMBS(100,100)

c.ClearRect CGMakeRectMBS(0,0,100,100)
c.SetRGBFillColor 1,0,0,1
c.FillRect CGMakeRectMBS(0,0,50,50)

w=window1.CGContextMBS // we are inside paint event!
// Draw using CGImage
w.DrawPicture c.CGImage(false,0),CGMakeRectMBS(0,0,c.BitmapWidth,c.BitmapHeight)

// Draw using RB picture, so we can see whether it looks equal.
p.Graphics.DrawPicture c.CopyPicture,0,0
p.Mask.Graphics.DrawPicture m,0,0
g.DrawPicture p,0,0

End Sub
If the RB graphics class is like a CGContext, the RB picture class (created using NewPicture) is something like a CGBitmapContext.
Subclass of the CGContextMBS class.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

Feedback, Comments & Corrections

Super class CGContextMBS

Sub classes:

Some useful global functions for this class:

Some examples which use this class:

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

CGAffineTransformMBS   -   CGColorMBS

MBS Xojo tutorial videos