Platforms to show: All Mac Windows Linux Cross-Platform
CGImageMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | CoreGraphics | MBS MacCG Plugin | 2.7 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
If the release property is true, the destructor of this class will release the image reference.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- 13 properties
- property AlphaInfo as Integer
- property BitmapInfo as Integer
- property BitsPerComponent as Integer
- property BitsPerPixel as Integer
- property BytesPerRow as Integer
- property ColorSpace as CGColorSpaceMBS
- property handle as Integer
- property height as Integer
- property ImageIsMask as boolean
- property RenderingIntent as Integer
- property RetainCount as Integer
- property ShouldInterpolate as boolean
- property width as Integer
- 14 methods
- method AsNSImageMBS as variant New in 24.3
- method Constructor Private
- method Copy as CGImageMBS
- method Copy(r as CGRectMBS) as CGImageMBS
- method CopyWithColorSpace(profile as CGColorSpaceMBS) as CGImageMBS
- method CopyWithMask(mask as CGImageMBS) as CGImageMBS
- method DataProvider as Variant
- method DecodeArray as memoryblock
- method JPEGData(Compression as Integer = 90) as MemoryBlock
- method Picture(ColorSpace as CGColorSpaceMBS = nil) as Picture
- method PictureScaled(OutputWidth as Integer, OutputHeight as Integer, ColorSpace as CGColorSpaceMBS = nil) as Picture
- method PNGData as MemoryBlock
- method ReleaseHandle
- method RetainHandle
- 6 shared methods
- shared method CreateImage(pic as picture) as CGImageMBS
- shared method CreateImage(pic as picture, mask as picture) as CGImageMBS
- shared method CreateImageFromJPEGDataProvider(dataprovider as Variant, decode as memoryblock, shouldInterpolate as boolean, intent as Integer) as CGImageMBS
- shared method CreateImageFromPNGDataProvider(dataprovider as Variant, decode as memoryblock, shouldInterpolate as boolean, intent as Integer) as CGImageMBS
- shared method CreateImageWithFile(file as folderitem) as CGImageMBS
- shared method CreateImageWithHandle(handle as Integer) as CGImageMBS
- 16 constants
Bitmap Info
Constant | Value | Description |
---|---|---|
kCGBitmapAlphaInfoMask | &h1F |
The alpha information mask. Use this to extract alpha information that specifies whether a bitmap contains an alpha channel and how the alpha channel is generated. |
kCGBitmapByteOrder16Big | 12288 |
16-bit, big endian format. |
kCGBitmapByteOrder16Little | 4096 |
16-bit, little endian format. |
kCGBitmapByteOrder32Big | 16384 |
32-bit, big endian format. |
kCGBitmapByteOrder32Little | 8192 |
32-bit, little endian format. |
kCGBitmapByteOrderDefault | 0 |
The default byte order. |
kCGBitmapByteOrderMask | &h7000 |
The byte ordering of pixel formats. |
kCGBitmapFloatComponents | 256 |
The components of a bitmap are floating-point values. |
Alpha Info
Constant | Value | Description |
---|---|---|
kCGImageAlphaFirst | 4 |
The alpha component is stored in the most significant bits of each pixel. For example, non-premultiplied ARGB. |
kCGImageAlphaLast | 3 |
The alpha component is stored in the least significant bits of each pixel. For example, non-premultiplied RGBA. |
kCGImageAlphaNone | 0 |
There is no alpha channel. If the total size of the pixel is greater than the space required for the number of color components in the color space, the least significant bits are ignored. This value is equivalent to kCGImageAlphaNoneSkipLast. |
kCGImageAlphaNoneSkipFirst | 6 |
There is no alpha channel. If the total size of the pixel is greater than the space required for the number of color components in the color space, the most significant bits are ignored. |
kCGImageAlphaNoneSkipLast | 5 |
There is no alpha channel. If the total size of the pixel is greater than the space required for the number of color components in the color space, the least significant bits are ignored. This value is equivalent to kCGImageAlphaNone. |
kCGImageAlphaOnly | 7 |
There is no color data, only an alpha channel. |
kCGImageAlphaPremultipliedFirst | 2 |
The alpha component is stored in the most significant bits of each pixel and the color components have already been multiplied by this alpha value. For example, premultiplied ARGB. |
kCGImageAlphaPremultipliedLast | 1 |
The alpha component is stored in the least significant bits of each pixel and the color components have already been multiplied by this alpha value. For example, premultiplied RGBA. |
This class has no sub classes.
Some useful global functions for this class:
- CGCreateImageFromJPEGDataProviderMBS(dataprovider as Variant, decode as memoryblock, shouldInterpolate as boolean, intent as Integer) as CGImageMBS
- CGCreateImageFromPNGDataProviderMBS(dataprovider as Variant, decode as memoryblock, shouldInterpolate as boolean, intent as Integer) as CGImageMBS
- CGCreateImageMBS(pic as picture) as CGImageMBS
- CGCreateImageMBS(pic as picture, mask as picture) as CGImageMBS
- NewCIImagewithCGImageMBS(cgimage as CGImageMBS, cgcolorspace as CGColorSpaceMBS) as CIImageMBS
- NewCIImagewithCGImageMBS(cgimage as CGImageMBS, options as dictionary = nil) as CIImageMBS
Some methods using this class:
- Application.OverlayApplicationDockTileImageMBS(pic as CGImageMBS) as boolean
- CGContextMBS.DrawTiledImage(pic as CGImageMBS, rect as CGRectMBS)
- CGDisplayMBS.CreateImageForRect(rect as CGRectMBS) as CGImageMBS
- CGImageSourceMBS.CreateThumbnailAtIndex(index as Integer, options as dictionary = nil) as CGImageMBS
- CGImageSourceMBS.CreateThumbnailMT(file as FolderItem, ImageIndex as integer = 0, Options as dictionary = nil) as CGImageMBS
- CIContextMBS.CreateCGImage(image as CIImageMBS, r as CGRectMBS = nil) as CGImageMBS
- CIImageMBS.Constructor(cgimage as CGImageMBS, options as Dictionary = nil)
- CIImageMBS.imageWithCGImage(CGImage as CGImageMBS, colorspace as CGColorSpaceMBS) as CIImageMBS
- VNImageRequestHandlerMBS.RequestWithCGImage(CGImage as CGImageMBS, orientation as Integer = 0, Options as Dictionary = nil) as VNImageRequestHandlerMBS
- VNTargetedImageRequestMBS.TargetedImageRequestWithCGImage(CGImage as CGImageMBS, orientation as Integer = 0, options as Dictionary, DelegateHandler as VNRequestCompletedMBS = nil, tag as variant = nil) as VNTargetedImageRequestMBS
Some properties using for this class:
- ICScannerBandDataMBS.CGImage as CGImageMBS
- IKImageViewMBS.Image as CGImageMBS
Some examples using this class:
- /AVFoundation/Donut Video Player
- /AVFoundation/Donut Video Player Overlay
- /AVFoundation/Overlay video track with picture
- /AVFoundation/Thumbnail sync
- /Images/LCMS2/Drawing on Mac with Colorspaces/Drawing on Mac with Colorspaces
- /iOS/Photo Picker Desktop
- /MacCG/CoreGraphics DirectDisplay/CGDisplayMBS CreateImageAsync
- /MacCG/CoreImage/Ripple Transition filter/Ripple Transition filter
- /MacCG/Mac ColorSpace tests
- /MacFrameworks/Image Capture/Scanner Browser
Blog Entries
- MBS Xojo Plugins, version 24.3pr7
- Picking picture on macOS
- Four ways to save picture as Tiff in Xojo
- CGImageSourceMBS CreateThumbnailMT method for Xojo
- MBS Xojo Plugins in version 19.0
- Colorspaces in MacOS with Xojo
- Tip of day: Load ICC profile on OS X for any image format with CGImageSource
- Notes from this week
- MBS Plugins 11.1 Release notes
- MBS REALbasic plug-ins version 9.5
Xojo Developer Magazine
- 17.2, page 11: News
- 12.2, page 45: Moving to AVFoundation, Leaving QuickTime behind by Christian Schmitz
Release notes
- Version 24.3
- Added AsNSImageMBS function to CGImageMBS class.
- Version 22.5
- Fixed problem with CIImageMBS not return a CGImageMBS object.
- Version 19.0
- Added VLCMediaPlayerMBS.CopyCGImage to return the CGImageMBS object for current image.
- Version 18.4
- Changed CVImageBufferMBS to cache NSImageMBS and CGImageMBS objects and jpeg data Memoryblock.
- Version 17.1
- Added CGImageMBS.PictureScaled to get picture scaled down faster.
The items on this page are in the following plugins: MBS MacCG Plugin.
CGImageDestinationMBS - CGImageMetadataMBS