Platforms to show: All Mac Windows Linux Cross-Platform

Back to CGColorMBS class.

CGColorMBS.Black as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The black color in the Generic gray color space.

CGColorMBS.Clear as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The clear color in the Generic gray color space.

CGColorMBS.Create(colorspace as CGColorSpaceMBS, components as memoryblock) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new color with the given components.
Example
dim c as color = &cFF0000

Dim m As MemoryBlock

m=NewMemoryBlock(16)
m.SingleValue(0)=c.Red/256
m.SingleValue(4)=c.Green/256
m.SingleValue(8)=c.Blue/256
m.SingleValue(12)=1.0

dim colorspace as CGColorSpaceMBS

colorspace=CGColorSpaceMBS.CreateDeviceRGB

if colorspace=nil or colorspace.Handle=0 then
MsgBox "Failed to get RGB color space!"
Return
end if

Dim col As CGColorMBS

col=CGColorMBS.Create(colorspace, m)

if col=nil or col.Handle=0 then
MsgBox "Failed to create color."
Return
end if

MsgBox str(Col.NumberOfComponents)

This method was called NewCGColorMBS in earlier MBS Plugins.

See also:

CGColorMBS.Create(colorspace as CGColorSpaceMBS, components() as Double) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new color with the given components.

Supports up to 32 components.
Returns nil on any error.

See also:

CGColorMBS.CreateDeviceCMYK(cyan as Double, magenta as Double, yellow as Double, black as Double, alpha as Double = 1.0) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a color in the device CMYK color space.

cyan: A cyan value (0.0 - 1.0).
magenta: A magenta value (0.0 - 1.0).
yellow: A yellow value (0.0 - 1.0).
black: A black value (0.0 - 1.0).
alpha: An alpha value (0.0 - 1.0).

Returns a color object.

CGColorMBS.CreateDeviceGray(gray as Double, alpha as Double = 1.0) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a color in the device gray color space.

gray: A grayscale value (0.0 - 1.0).
alpha: An alpha value (0.0 - 1.0).

Returns a color object.

CGColorMBS.CreateDeviceRGB(red as Double, green as Double, blue as Double, alpha as Double = 1.0) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a color in the device RGB color space.

red: A red component value (0.0 - 1.0).
green: A green component value (0.0 - 1.0).
blue: A blue component value (0.0 - 1.0).
alpha: An alpha value (0.0 - 1.0).

Returns a new color object.

CGColorMBS.CreateGenericCMYK(cyan as Double, magenta as Double, yellow as Double, black as Double, alpha as Double = 1.0) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a color in the Generic CMYK color space.

cyan: A cyan value (0.0 - 1.0).
magenta: A magenta value (0.0 - 1.0).
yellow: A yellow value (0.0 - 1.0).
black: A black value (0.0 - 1.0).
alpha: An alpha value (0.0 - 1.0).

Returns a color object.
Available in Mac OS X v10.5 and later.

CGColorMBS.CreateGenericGray(gray as Double, alpha as Double = 1.0) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a color in the Generic gray color space.

gray: A grayscale value (0.0 - 1.0).
alpha: An alpha value (0.0 - 1.0).

Returns a color object.
Available in Mac OS X v10.5 and later.

Some examples using this method:

CGColorMBS.CreateGenericRGB(red as Double, green as Double, blue as Double, alpha as Double = 1.0) as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a color in the Generic RGB color space.

red: A red component value (0.0 - 1.0).
green: A green component value (0.0 - 1.0).
blue: A blue component value (0.0 - 1.0).
alpha: An alpha value (0.0 - 1.0).

Returns a new color object.
Available in Mac OS X v10.5 and later.

Some examples using this method:

CGColorMBS.White as CGColorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The white color in the Generic gray color space.

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


The biggest plugin in space...