CColorRef:new
The new method creates an instance of the CColorRef class. You must call new before using any class methods or properties. Note that this object can also be created using the new_colorref function. The CColorRef class includes 3 properties for R, G, and B color intensities.
C = CColorRef:new() Creates a new object with color initialized to (0,0,0). C = CColorRef:new( CColorRef_old ) This is a copy constructor. It creates a new CColorRef C initialized to the color of the CColorRef_old argument. C = CColorRef:new( R, G, B ) Creates a new CColorRef with members initialized to the R, G, and B values. |
Three overloads are provided for this method. They create a default CColorRef, a copy of a CColorRef, or an initialized CColorRef. If you pass something other than nil, a CColorRef, or data member values—such as a string—the default constructor is used.
The following script computes the equivalent gray intensity using 2 different constructors:
|
-- create CColorRef A with values |
|
-- copy A to a new CColorRef B |
|
-- complement the color |
|
-- result: 255,140,5 -> 158.19 |
|
-- result: 255,140,5 -> 158.19 |
CColorRef, delete, new_colorref
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.