CColorRef:ToGray
The ToGray method returns the gray equivalent luminance of a color triplet. The conversion is computed using the standard visual response weights (see Visual Response Equivalent Gray).
nGray = CColorRef:ToGray()
Returns the gray equivalent of the class member colors.
nGray = CColorRef:ToGray( CColorRef )
Returns the gray equivalent of the CColorRef passed as the argument.
nGray = CColorRef:ToGray( R, G, B )
Returns the gray equivalent of the specified R, G, and B values.
Three overloads are provided for this method; they compute the gray equivalent for the class members, a CColorRef object, or for 3 explicit color values. If you pass something other than a CColorRef or R, G, B values, such as a string or a number, this method defaults to using the class members.
The following script computes the equivalent gray intensity using all 3 of the overloads:
|
-- create a CColorRef with values |
|
-- result: Gray = 158.19 |
|
-- create a new copy of A |
|
-- invert the colors of B |
|
-- result: Gray = 96.81 |
|
-- result: Gray = 96.81 |
CColorRef, Visual Response Equivalent Gray
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.