Platforms to show: All Mac Windows Linux Cross-Platform

Back to CIContextMBS class.

CIContextMBS.ClearCaches

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 7.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Frees any cached data (such as temporary images) associated with the context.

This also runs the garbage collector.

CIContextMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new CIContext without a specific target.

Great to create a context and render something inside.

See also:

CIContextMBS.Constructor(cgcontext as CGContextMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 7.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a new CoreImage context object, all output will be drawn into the CG context.

On success, the handle is not zero.

See also:

CIContextMBS.Constructor(cgcontext as CGContextMBS, OutputColorSpace as CGColorSpaceMBS, WorkingColorSpace as CGColorSpaceMBS, UseSoftwareRenderer as Boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 7.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Create a new CoreImage context object with options, all output will be drawn into the CG context.

OutputColorSpace: A CGColorSpaceMBS object defining the color space in which all intermediate operations are performed.
WorkingColorSpace: A CGColorSpaceRef object defining the color space that images are converted to before rendering into the context.
UseSoftwareRenderer: Whether you want software renderer only.

On success, the handle is not zero.

See also:

CIContextMBS.Constructor(Handle as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 12.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes object with given object reference.

ref should be a CIContext* and the object is retained.
Raises UnsupportedOperationException if object is not a CIContext.

See also:

CIContextMBS.CreateCGImage(image as CIImageMBS, r as CGRectMBS = nil) as CGImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 7.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new image with the content of the CIImage.

Render the region 'r' of image 'im' into a temporary buffer using the context, then create and return a new CoreGraphics image with the results.
If r is nil, the whole image extent is used.

See also:

CIContextMBS.CreateCGImage(image as CIImageMBS, r as CGRectMBS, ColorSpace as CGColorSpaceMBS) as CGImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new image with the content of the CIImage.

Render the region 'r' of image 'im' into a temporary buffer using the context, then create and return a new CoreGraphics image with the results.
If r is nil, the whole image extent is used.

See also:

CIContextMBS.createCGLayer(size as CGSizeMBS, info as dictionary = nil) as CGLayerMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 14.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a CGLayer object from the provided parameters.

size: The size, in default user space units, of the layer relative to the graphics context.
ifno: A dictionary, which is passed to CGLayerCreateWithContext as the auxiliaryInfo parameter. Pass nil because this parameter is reserved for future use.

Returns a CGLayer object.

After calling this method, Core Image draws content into the CGLayer object. Core Image creates a CGLayer object by calling the Quartz 2D function CGLayerCreateWithContext, whose prototype is:

CGLayerRef CGLayerCreateWithContext (
CGContextRef context,
CGSize size,
CFDictionaryRef auxiliaryInfo
);
Core Image passes the CIContext object as the context parameter, the size as the size parameter, and the dictionary as the auxiliaryInfo parameter. For more information on CGLayer objects, see Quartz 2D Programming Guide and CGLayer Reference.

Available in OS X v10.4 and later.

CIContextMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The destructor.

CIContextMBS.DrawImage(ciImage as CIImageMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Render the ciImage to the the context's destination.

Rendering the image will cause the calculations to be done so this call is quite expensive.

CIContextMBS.DrawImagePoint(ciImage as CIImageMBS, DestPoint as CGPointMBS, SourceRect as CGRectMBS = nil)   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 7.3 ✅ Yes ❌ No ❌ No ✅ Yes All
This item is deprecated and should no longer be used. You can use DrawImageRect instead.
Render the subregion 'SourceRect' of 'ciImage' to point 'DestPoint' in the context's destination.

Rendering the image will cause the calculations to be done so this call is quite expensive.
If SourceRect is nil, we use the extent from image.

CIContextMBS.DrawImageRect(ciImage as CIImageMBS, DestRect as CGRectMBS, SourceRect as CGRectMBS = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 7.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Render the rectangle 'SourceRect' of 'ciImage' to the rectangle 'DestRect' in the context's destination.

Rendering the image will cause the calculations to be done so this call is quite expensive.
If SourceRect is nil, we use the extent from image.

Some examples using this method:

CIContextMBS.Flush

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Flushes drawings to CGContext and target picture (if any).

CIContextMBS.HEIFRepresentationOfImage(Image as CIImageMBS, format as Integer = 24, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 19.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to HEIF data.
Example
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.jpg")
Dim i As New CIImageMBS(f)
Dim c As New CIContextMBS

Dim heifData As MemoryBlock = c.HEIFRepresentationOfImage(i)

Break // see debugger

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome and must match the specified format.
No options keys are supported at this time.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.13 or later.

CIContextMBS.JPEGRepresentationOfImage(Image as CIImageMBS, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to JPEG data.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.png")
dim i as new CIImageMBS(f)
dim c as new CIContextMBS

dim jpegData as MemoryBlock = c.JPEGRepresentationOfImage(i)

Break // see debugger

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome.
Supported options keys are kCGImageDestinationLossyCompressionQuality, kCIImageRepresentationAVDepthData, kCIImageRepresentationDepthImage, kCIImageRepresentationDisparityImage.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.12 or later.

CIContextMBS.PNGRepresentationOfImage(Image as CIImageMBS, format as Integer = 24, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to PNG data.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.png")
dim i as new CIImageMBS(f)
dim c as new CIContextMBS

dim pngData as MemoryBlock = c.PNGRepresentationOfImage(i)

Break // see debugger

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome and must match the specified format.
No options keys are supported at this time.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.13 or later.

CIContextMBS.ReclaimResources

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 7.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Frees temporary memory.

Runs the context's garbage collector to reclaim any resources that are no longer required (e.g. removes textures from the texture cache that reference deleted images.) This method is called automatically after every rendering operation.

CIContextMBS.TIFFRepresentationOfImage(Image as CIImageMBS, format as Integer = 24, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to TIFF data.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.png")
dim i as new CIImageMBS(f)
dim c as new CIContextMBS

dim tiffData as MemoryBlock = c.TIFFRepresentationOfImage(i)

Break // see debugger

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome and must match the specified format.
No options keys are supported at this time.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.12 or later.

CIContextMBS.writeHEIFRepresentationOfImage(Image as CIImageMBS, file as FolderItem, format as Integer = 24, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil, byref error as NSErrorMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 19.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to HEIF file.
Example
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.jpg")
Dim i As New CIImageMBS(f)
Dim c As New CIContextMBS
Dim d As FolderItem = SpecialFolder.Desktop.Child("output.heif")

Dim e As NSErrorMBS
Dim b As Boolean = c.writePNGRepresentationOfImage(i, d, e)
If b Then
MsgBox "OK"
Else
MsgBox "Failed"+EndOfLine+e.LocalizedDescription
End If

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome and must match the specified format.
No options keys are supported at this time.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.13 or later.

CIContextMBS.writeJPEGRepresentationOfImage(Image as CIImageMBS, file as FolderItem, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil, byref error as NSErrorMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to JPEG file.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.png")
dim i as new CIImageMBS(f)
dim c as new CIContextMBS
dim d as FolderItem = SpecialFolder.Desktop.Child("output.jpg")

dim e as NSErrorMBS
dim b as Boolean = c.writeJPEGRepresentationOfImage(i, d, e)
if b then
MsgBox "OK"
else
MsgBox "Failed"+EndOfLine+e.LocalizedDescription
end if

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome.
Supported options keys are kCGImageDestinationLossyCompressionQuality, kCIImageRepresentationAVDepthData, kCIImageRepresentationDepthImage, kCIImageRepresentationDisparityImage.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.12 or later.

CIContextMBS.writePNGRepresentationOfImage(Image as CIImageMBS, file as FolderItem, format as Integer = 24, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil, byref error as NSErrorMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to PNG file.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.png")
dim i as new CIImageMBS(f)
dim c as new CIContextMBS
dim d as FolderItem = SpecialFolder.Desktop.Child("output.png")

dim e as NSErrorMBS
dim b as Boolean = c.writePNGRepresentationOfImage(i, d, e)
if b then
MsgBox "OK"
else
MsgBox "Failed"+EndOfLine+e.LocalizedDescription
end if

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome and must match the specified format.
No options keys are supported at this time.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.13 or later.

CIContextMBS.writeTIFFRepresentationOfImage(Image as CIImageMBS, file as FolderItem, format as Integer = 24, colorSpace as CGColorSpaceMBS = nil, options as dictionary = nil, byref error as NSErrorMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreImage MBS MacCI Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Render a CIImage to TIFF file.
Example
dim f as FolderItem = SpecialFolder.Desktop.Child("test.png")
dim i as new CIImageMBS(f)
dim c as new CIContextMBS
dim d as FolderItem = SpecialFolder.Desktop.Child("output.tif")

dim e as NSErrorMBS
dim b as Boolean = c.writeTIFFRepresentationOfImage(i, d, e)
if b then
MsgBox "OK"
else
MsgBox "Failed"+EndOfLine+e.LocalizedDescription
end if

Image must have a finite non-empty extent.
The CGColorSpace must be kCGColorSpaceModelRGB or kCGColorSpaceModelMonochrome and must match the specified format.
No options keys are supported at this time.
If colorspace is nil, we use generic RGB colorspace.
Available on macOS 10.12 or later.

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


The biggest plugin in space...