Platforms to show: All Mac Windows Linux Cross-Platform

CGBitmapContextMBS class

Super class: CGContextMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
class CoreGraphics MBS MacCG Plugin 3.4 ✅ Yes ❌ No ❌ No ✅ Yes All
A class to hold a CoreGraphics bitmap context.
Example
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)
w.Flush

// Draw using RB picture, so we can see whether it looks equal.
m=c.CopyPictureMask
p=New Picture(m.Width,m.Height,32)
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.

Super class CGContextMBS

This class has no sub classes.

Some useful global functions for this class:

  • CGBitmapContextCreateMBS(data as memoryblock, width as Integer, height as Integer, bitsPerComponent as Integer, bytesPerRow as Integer, colorspace as CGColorSpaceMBS, alphaInfo as Integer) as CGBitmapContextMBS

Some examples using this class:

Blog Entries


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


CGAffineTransformMBS   -   CGColorMBS


The biggest plugin in space...