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

NSColorMBS.blendedColorWithFraction(alpha as Double, c as NSColorMBS) as NSColorMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Creates and returns an NSColor object whose component values are a weighted sum of the receiver's and the specified color object's.
Example:
dim b as NSColorMBS = NSColorMBS.blueColor
dim r as NSColorMBS = NSColorMBS.redColor
dim c as NSColorMBS = b.blendedColorWithFraction(0.5, r)

MsgBox c.description
Notes:
fraction: The amount of the color to blend with the receiver's color. The method converts color and a copy of the receiver to RGB, and then sets each component of the returned color to fraction of color's value plus 1 – fraction of the receiver's.
color: The color to blend with the receiver's color.

The resulting color object or nil if the colors can't be converted.

Feedback, Comments & Corrections

NSColorMBS.CGColorHandle as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 12.3 Yes No No Yes, macOS only No
Function: Converts NSColor to CGColor.
Notes:
Return value may be an approximation in some cases, so there isn't guaranteed round-trip fidelity.
Available on Mac OS X 10.8.

Feedback, Comments & Corrections

NSColorMBS.colorSpace as NSColorSpaceMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns an object representing the color space of the receiver.
Example:
dim b as NSColorMBS = NSColorMBS.blueColor

MsgBox b.colorSpace.localizedName
Notes:
An object representing a color space. The returned NSColorSpace object may represent a custom color space.

Calling this method raises an exception if the receiver is not based on a color space represented by an NSColorSpace object—specifically, colors designated by NSNamedColorSpace and NSPatternColorSpace. If you are unsure about a color object, convert it to an equivalent NSColorSpace-based object before calling this method. Color objects created with color-space names NSCalibratedWhiteColorSpace, NSCalibratedBlackColorSpace, NSCalibratedRGBColorSpace, NSDeviceWhiteColorSpace, NSDeviceBlackColorSpace, NSDeviceRGBColorSpace, NSDeviceCMYKColorSpace, or NSCustomColorSpace—or with the NSColorSpace class methods corresponding to these names—are safe to use with this method. See "About Color Spaces" in Color Programming Topics for Cocoa for a list of these corresponding methods.

Feedback, Comments & Corrections

NSColorMBS.colorUsingColorSpace(colorSpace as NSColorSpaceMBS) as NSColorMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns a new color object representing the color of the receiver in the specified color space.
Example:
dim b as NSColorMBS = NSColorMBS.blueColor
dim c as NSColorMBS = b.colorUsingColorSpace(NSColorSpaceMBS.deviceRGBColorSpace)

MsgBox b.description
Notes:
space: The color space of the new NSColor object.

Returns the new NSColor object. This method converts the receiver's color to an equivalent one in the new color space. Although the new color might have different component values, it looks the same as the original. Returns nil if conversion is not possible.

If the receiver's color space is the same as that specified in space, this method returns the same NSColor object.

Feedback, Comments & Corrections

NSColorMBS.colorUsingColorSpaceName(colorSpace as string) as NSColorMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Creates and returns an NSColor whose color is the same as the receiver's, except that the new NSColor is in the specified color space.
Notes:
colorSpace: The name of the color space containing the new NSColor object. If colorSpace is "", the most appropriate color space is used.

The new NSColor object or nil if the specified conversion cannot be done.

Feedback, Comments & Corrections

NSColorMBS.colorWithAlphaComponent(alpha as Double) as NSColorMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Creates and returns an NSColor object that has the same color space and component values as the receiver, but the specified alpha component.
Example:
dim b as NSColorMBS = NSColorMBS.blueColor.colorWithAlphaComponent(0.5)
MsgBox b.description // shows "NSCalibratedRGBColorSpace 0 0 1 0.5"
Notes:
alpha: The opacity value of the new NSColor object.

Returns a new NSColor object. If the receiver's color space doesn't include an alpha component, the receiver is returned.

A subclass with explicit opacity components should override this method to return a color with the specified alpha.

Feedback, Comments & Corrections

NSColorMBS.Components as Double()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the components of the receiver as an array.
Example:
dim b as NSColorMBS = NSColorMBS.blueColor
dim c(-1) as Double = b.Components
dim lines(-1) as string

for each d as Double in c
lines.Append str(d)
next

MsgBox Join(lines) // shows 0 0 1 1
Notes: You can invoke this method on NSColor objects created from custom color spaces to get the individual floating point components, including alpha. Raises an exception if the receiver doesn't have floating-point components. To find out how many components are in the components array, send the receiver a numberOfComponents message.

Feedback, Comments & Corrections

NSColorMBS.Constructor(c as color)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 17.1 Yes No No Yes, macOS only No
Function: Initializes the color with generic colorspace.
Example:
dim r as NSColorMBS = NSColorMBS.redColor
dim c as color = &cFF0000
dim n as new NSColorMBS(c)

Break // check debugger

See also:

Feedback, Comments & Corrections

NSColorMBS.Constructor(red as Double, green as Double, blue as Double, alpha as Double = 1.0)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 17.1 Yes No No Yes, macOS only No
Function: Initializes the color with generic colorspace.
Notes: Pass values in range from 0.0 to 1.0.

See also:

Feedback, Comments & Corrections

NSColorMBS.getCMYK(byref cyan as Double, byref magenta as Double, byref yellow as Double, byref black as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's CMYK and opacity values.
Example:
dim co as NSColorMBS = NSColorMBS.colorWithDeviceCMYK(1.0, 0.5, 1.0, 0.8)
dim c,m,y,k as Double

co.getCMYK(c,m,y,k)

MsgBox str(c)+" "+str(m)+" "+str(y)+" "+str(k)
Notes:
cyan: Upon return, contains the cyan component of the color object.
magenta: Upon return, contains the magenta component of the color object.
yellow: Upon return, contains the yellow component of the color object.
black: Upon return, contains the black component of the color object.
alpha: Upon return, contains opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSDeviceCMYKColorSpace. Sending it to other objects raises an exception.

See also:

Feedback, Comments & Corrections

NSColorMBS.getCMYK(byref cyan as Double, byref magenta as Double, byref yellow as Double, byref black as Double, byref alpha as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's CMYK and opacity values.
Example:
dim co as NSColorMBS = NSColorMBS.colorWithDeviceCMYK(1.0, 0.5, 1.0, 0.8, 0.4)
dim c,m,y,k,a as Double

co.getCMYK(c,m,y,k,a)

MsgBox str(c)+" "+str(m)+" "+str(y)+" "+str(k)+" "+str(a)
Notes:
cyan: Upon return, contains the cyan component of the color object.
magenta: Upon return, contains the magenta component of the color object.
yellow: Upon return, contains the yellow component of the color object.
black: Upon return, contains the black component of the color object.
alpha: Upon return, contains opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSDeviceCMYKColorSpace. Sending it to other objects raises an exception.

See also:

Feedback, Comments & Corrections

NSColorMBS.getHSV(byref hue as Double, byref saturation as Double, byref brightness as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's HSB component and opacity values in the respective arguments.
Example:
dim c as NSColorMBS = NSColorMBS.colorWithCalibratedHSV(1.0, 0.5, 1.0, 0.4)
dim h,s,v,a as Double

c.getHSV(h,s,v,a)

MsgBox str(h)+" "+str(s)+" "+str(v)+" "+str(a)
Notes:
hue: Upon return, contains the hue component of the color object.
saturation: Upon return, contains the saturation component of the color object.
brightness: Upon return, contains the brightness component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

See also:

Feedback, Comments & Corrections

NSColorMBS.getHSV(byref hue as Double, byref saturation as Double, byref brightness as Double, byref alpha as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's HSB component and opacity values in the respective arguments.
Notes:
hue: Upon return, contains the hue component of the color object.
saturation: Upon return, contains the saturation component of the color object.
brightness: Upon return, contains the brightness component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

See also:

Feedback, Comments & Corrections

NSColorMBS.getRGB(byref red as Double, byref green as Double, byref blue as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's RGB component and opacity values in the respective arguments.
Example:
dim c as NSColorMBS = NSColorMBS.blueColor
dim r,g,b as Double

c.getRGB(r,g,b)

MsgBox str(r)+" "+str(g)+" "+str(b) // shows "0 0 1"
Notes:
red: Upon return, contains the red component of the color object.
green: Upon return, contains the green component of the color object.
blue: Upon return, contains the blue component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

Plugin converts color to calibrated RGB if needed.

See also:

Feedback, Comments & Corrections

NSColorMBS.getRGB(byref red as Double, byref green as Double, byref blue as Double, byref alpha as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's RGB component and opacity values in the respective arguments.
Example:
dim c as NSColorMBS = NSColorMBS.blueColor
dim r,g,b,a as Double

c.getRGB(r,g,b,a)

MsgBox str(r)+" "+str(g)+" "+str(b)+" "+str(a) // shows "0 0 1 1"
Notes:
red: Upon return, contains the red component of the color object.
green: Upon return, contains the green component of the color object.
blue: Upon return, contains the blue component of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace color space. Sending it to other objects raises an exception.

Plugin converts color to calibrated RGB if needed.

See also:

Feedback, Comments & Corrections

NSColorMBS.getWhite(byref white as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's grayscale value and alpha values.
Example:
dim c as NSColorMBS = NSColorMBS.colorWithDeviceWhite(1.0, 1.0)
dim w as Double

c.getWhite(w)

MsgBox str(w)
Notes:
white: Upon return, contains the grayscale value of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedWhiteColorSpace, NSCalibratedBlackColorSpace, NSDeviceBlackColorSpace, or NSDeviceWhiteColorSpace color space. Sending it to other objects raises an exception.

See also:

Feedback, Comments & Corrections

NSColorMBS.getWhite(byref white as Double, byref alpha as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the receiver's grayscale value and alpha values.
Example:
dim c as NSColorMBS = NSColorMBS.colorWithDeviceWhite(1.0, 1.0)
dim w,a as Double

c.getWhite(w,a)

MsgBox str(w)+" "+str(a)
Notes:
white: Upon return, contains the grayscale value of the color object.
alpha: Upon return, contains the opacity value of the color object. (optionally)

This method works only with objects representing colors in the NSCalibratedWhiteColorSpace, NSCalibratedBlackColorSpace, NSDeviceBlackColorSpace, or NSDeviceWhiteColorSpace color space. Sending it to other objects raises an exception.

See also:

Feedback, Comments & Corrections

NSColorMBS.highlightWithLevel(level as Double) as NSColorMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns an NSColor object that represents a blend between the receiver and the highlight color returned by highlightColor.
Example:
dim c as NSColorMBS = NSColorMBS.blueColor
dim h as NSColorMBS = c.highlightWithLevel(0.5)
MsgBox h.description
Notes:
level: The amount of the highlight color that is blended with the receiver's color. This should be a number from 0.0 through 1.0. A highlightLevel below 0.0 is interpreted as 0.0; a highlightLevel above 1.0 is interpreted as 1.0.

Returns the new NSColor object. Returns nil if the colors can't be converted.

Invoke this method when you want to brighten the receiving NSColor for use in highlights.

Feedback, Comments & Corrections

NSColorMBS.patternImage as Variant
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns the image that the receiver is using as a pattern.
Example:
dim p as Picture = LogoMBS(100)
dim n as new NSImageMBS(p)
dim c as NSColorMBS = NSColorMBS.colorWithPatternImage(n)
dim x as NSImageMBS = c.patternImage

Backdrop=x.CopyPictureWithMask
Notes:
The image used by the color object. If the receiver doesn't have an image, this method raises an exception.

Declared a variant instead of NSImageMBS to reduce plugin dependencies.

Feedback, Comments & Corrections

NSColorMBS.shadowWithLevel(level as Double) as NSColorMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Returns an NSColor object that represents a blend between the receiver and the shadow color returned by shadowColor.
Example:
dim c as NSColorMBS = NSColorMBS.blueColor
dim h as NSColorMBS = c.shadowWithLevel(0.5)
MsgBox h.description
Notes:
level: The amount of the shadow color used for the blend. This should be a number from 0.0 through 1.0. A shadowLevel below 0.0 is interpreted as 0.0; a shadowLevel above 1.0 is interpreted as 1.0.

Returns the new NSColor object. Returns nil if the colors can't be converted.

Invoke this method when you want to darken the receiving NSColor for use in shadows.

Feedback, Comments & Corrections

NSColorMBS.writeToPasteboard
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Drawing MBS MacBase Plugin 9.8 Yes No No Yes, macOS only No
Function: Writes the receiver's data to the specified pasteboard.

Feedback, Comments & Corrections

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




Links
MBS FileMaker tutorial videos