Enfusion Script API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Color Interface Reference
Inheritance diagram for Color:
[legend]

Public Member Functions

void Color (float red=0.0, float green=0.0, float blue=0.0, float alpha=0.0)
 
proto external float R ()
 Returns Red component.
 
proto external float G ()
 Returns Green component.
 
proto external float B ()
 Returns Blue component.
 
proto external float A ()
 Returns Alpha component.
 
proto external void SetR (float red)
 Sets the Red component.
 
proto external void SetG (float green)
 Sets the Green component.
 
proto external void SetB (float blue)
 Sets the Blue component.
 
proto external void SetA (float alpha)
 Sets the Alpha component.
 
proto external void SetFromInt (int color)
 Sets the color to color given in packed ARGB integer.
 
proto external void Add (Color other)
 Component-wise addition-assignment.
 
proto ref Color AddNew (Color other)
 Component-wise addition returns result as a new color.
 
proto external void Sub (Color other)
 Component-wise subtraction-assignment.
 
proto ref Color SubNew (Color other)
 Component-wise subtraction returns result as a new color.
 
proto external void Mul (Color other)
 Component-wise multiplication-assignment.
 
proto ref Color MulNew (Color other)
 Component-wise multiplication returns result as a new color.
 
proto external void Div (Color other)
 Component-wise division-assignment.
 
proto ref Color DivNew (Color other)
 Component-wise division returns result as a new color.
 
proto external void Scale (float scale)
 Multiplies each component by scale
 
proto external float GetLuminance ()
 Returns perceptual brightness.
 
proto external void Saturate ()
 Clamps each component to [0, 1] range.
 
proto external void Clamp (float min, float max)
 Clamps each component to [min, max] range.
 
proto external void Lerp (Color other, float t)
 Linear interpolation with other based on t.
 
proto ref Color LerpNew (Color other, float t)
 
proto external int PackToInt ()
 Returs this color as integer with 8 bits per channel.
 
proto external void SRGBToLinear ()
 Converts this color from sRGB color space to linear RGB color space.
 
proto external void LinearToSRGB ()
 Converts this color from linear RGB color space to sRGB color space.
 
proto external bool IsZero ()
 Returns true if all the components are zero.
 
proto external bool IsEqual (Color other, float epsilon=0.0)
 Returns true if the colors differ by at most epsilon in each component.
 
- Public Member Functions inherited from Managed
proto external ref Managed Clone ()
 Return shallow copy of object, or null if it is not allowed (not public constructor)
 

Static Public Member Functions

static proto ref Color FromInt (int color)
 Creates a new color instance from ARGB color packed in int.
 
static proto ref Color FromVector (vector color)
 Creates a new color instance from RGB vector.
 
static proto ref Color FromRGBA (int r, int g, int b, int a)
 Creates a new color instance from RGBA integers in range 0-255.
 
static proto ref Color FromIntSRGB (int color)
 Creates a new color instance in linear color space from ARGB color packed in int which is in sRGB color space.
 
static proto ref Color FromSRGBA (int r, int g, int b, int a)
 Creates a new color instance in linear color space from RGBA integers in range 0-255 which are in sRGB color space.
 
static proto void UnpackInt (int argb, out int a, out int r, out int g, out int b)
 Unpack color data from packed integer, see PackToInt().
 

Static Public Attributes

static const int BLACK = 0xff000000
 color constants - hex codes
 
static const int GRAY_25 = 0xff404040
 
static const int GRAY = 0xff808080
 
static const int GRAY_75 = 0xffc0c0c0
 
static const int WHITE = 0xffffffff
 
static const int RED = 0xffff0000
 
static const int GREEN = 0xff00ff00
 
static const int BLUE = 0xff0000ff
 
static const int DARK_RED = 0xff800000
 
static const int DARK_GREEN = 0xff008000
 
static const int DARK_BLUE = 0xff000080
 
static const int CYAN = 0xff00ffff
 
static const int MAGENTA = 0xffff00ff
 
static const int YELLOW = 0xffffff00
 
static const int DARK_CYAN = 0xff008080
 
static const int DARK_MAGENTA = 0xff800080
 
static const int DARK_YELLOW = 0xff808000
 
static const int ORANGE = 0xffff8000
 
static const int CHARTREUSE = 0xff80ff00
 
static const int SPRING_GREEN = 0xff00ff80
 
static const int DODGER_BLUE = 0xff0080ff
 
static const int VIOLET = 0xff8000ff
 
static const int PINK = 0xffff0080
 
static const ref Color Black = new Color(0.0, 0.0, 0.0, 1.0)
 color constants - color objects
 
static const ref Color Gray25 = new Color(0.25, 0.25, 0.25, 1.0)
 
static const ref Color Gray = new Color(0.5, 0.5, 0.5, 1.0)
 
static const ref Color Gray75 = new Color(0.75, 0.75, 0.75, 1.0)
 
static const ref Color White = new Color(1.0, 1.0, 1.0, 1.0)
 
static const ref Color Red = new Color(1.0, 0.0, 0.0, 1.0)
 
static const ref Color Green = new Color(0.0, 1.0, 0.0, 1.0)
 
static const ref Color Blue = new Color(0.0, 0.0, 1.0, 1.0)
 
static const ref Color DarkRed = new Color(0.5, 0.0, 0.0, 1.0)
 
static const ref Color DarkGreen = new Color(0.0, 0.5, 0.0, 1.0)
 
static const ref Color DarkBlue = new Color(0.0, 0.0, 0.5, 1.0)
 
static const ref Color Cyan = new Color(0.0, 1.0, 1.0, 1.0)
 
static const ref Color Magenta = new Color(1.0, 0.0, 1.0, 1.0)
 
static const ref Color Yellow = new Color(1.0, 1.0, 0.0, 1.0)
 
static const ref Color DarkCyan = new Color(0.0, 0.5, 0.5, 1.0)
 
static const ref Color DarkMagenta = new Color(0.5, 0.0, 0.5, 1.0)
 
static const ref Color DarkYellow = new Color(0.5, 0.5, 0.0, 1.0)
 
static const ref Color Orange = new Color(1.0, 0.5, 0.0, 1.0)
 
static const ref Color Chartreuse = new Color(0.5, 1.0, 0.0, 1.0)
 
static const ref Color SpringGreen = new Color(0.0, 1.0, 0.5, 1.0)
 
static const ref Color DodgerBlue = new Color(0.0, 0.5, 1.0, 1.0)
 
static const ref Color Violet = new Color(0.5, 0.0, 1.0, 1.0)
 
static const ref Color Pink = new Color(1.0, 0.0, 0.5, 1.0)
 

Constructor & Destructor Documentation

◆ Color()

void Color.Color ( float  red = 0.0,
float  green = 0.0,
float  blue = 0.0,
float  alpha = 0.0 
)

Member Function Documentation

◆ A()

proto external float Color.A ( )

Returns Alpha component.

◆ Add()

proto external void Color.Add ( Color  other)

Component-wise addition-assignment.

◆ AddNew()

proto ref Color Color.AddNew ( Color  other)

Component-wise addition returns result as a new color.

◆ B()

proto external float Color.B ( )

Returns Blue component.

◆ Clamp()

proto external void Color.Clamp ( float  min,
float  max 
)

Clamps each component to [min, max] range.

◆ Div()

proto external void Color.Div ( Color  other)

Component-wise division-assignment.

◆ DivNew()

proto ref Color Color.DivNew ( Color  other)

Component-wise division returns result as a new color.

◆ FromInt()

static proto ref Color Color.FromInt ( int  color)
static

Creates a new color instance from ARGB color packed in int.

◆ FromIntSRGB()

static proto ref Color Color.FromIntSRGB ( int  color)
static

Creates a new color instance in linear color space from ARGB color packed in int which is in sRGB color space.

◆ FromRGBA()

static proto ref Color Color.FromRGBA ( int  r,
int  g,
int  b,
int  a 
)
static

Creates a new color instance from RGBA integers in range 0-255.

◆ FromSRGBA()

static proto ref Color Color.FromSRGBA ( int  r,
int  g,
int  b,
int  a 
)
static

Creates a new color instance in linear color space from RGBA integers in range 0-255 which are in sRGB color space.

◆ FromVector()

static proto ref Color Color.FromVector ( vector  color)
static

Creates a new color instance from RGB vector.

◆ G()

proto external float Color.G ( )

Returns Green component.

◆ GetLuminance()

proto external float Color.GetLuminance ( )

Returns perceptual brightness.

◆ IsEqual()

proto external bool Color.IsEqual ( Color  other,
float  epsilon = 0.0 
)

Returns true if the colors differ by at most epsilon in each component.

◆ IsZero()

proto external bool Color.IsZero ( )

Returns true if all the components are zero.

◆ Lerp()

proto external void Color.Lerp ( Color  other,
float  t 
)

Linear interpolation with other based on t.

Returns this + (other - this) * t.

◆ LerpNew()

proto ref Color Color.LerpNew ( Color  other,
float  t 
)
See also
Lerp
Returns
result as a new color

◆ LinearToSRGB()

proto external void Color.LinearToSRGB ( )

Converts this color from linear RGB color space to sRGB color space.

◆ Mul()

proto external void Color.Mul ( Color  other)

Component-wise multiplication-assignment.

◆ MulNew()

proto ref Color Color.MulNew ( Color  other)

Component-wise multiplication returns result as a new color.

◆ PackToInt()

proto external int Color.PackToInt ( )

Returs this color as integer with 8 bits per channel.

◆ R()

proto external float Color.R ( )

Returns Red component.

◆ Saturate()

proto external void Color.Saturate ( )

Clamps each component to [0, 1] range.

◆ Scale()

proto external void Color.Scale ( float  scale)

Multiplies each component by scale

◆ SetA()

proto external void Color.SetA ( float  alpha)

Sets the Alpha component.

◆ SetB()

proto external void Color.SetB ( float  blue)

Sets the Blue component.

◆ SetFromInt()

proto external void Color.SetFromInt ( int  color)

Sets the color to color given in packed ARGB integer.

◆ SetG()

proto external void Color.SetG ( float  green)

Sets the Green component.

◆ SetR()

proto external void Color.SetR ( float  red)

Sets the Red component.

◆ SRGBToLinear()

proto external void Color.SRGBToLinear ( )

Converts this color from sRGB color space to linear RGB color space.

◆ Sub()

proto external void Color.Sub ( Color  other)

Component-wise subtraction-assignment.

◆ SubNew()

proto ref Color Color.SubNew ( Color  other)

Component-wise subtraction returns result as a new color.

◆ UnpackInt()

static proto void Color.UnpackInt ( int  argb,
out int  a,
out int  r,
out int  g,
out int  b 
)
static

Unpack color data from packed integer, see PackToInt().

Parameters
argbinput packed argb int
aout alpha channel <0..255>
rout red channel <0..255>
gout green channel <0..255>
bout blue channel <0..255>

Member Data Documentation

◆ BLACK

const int Color.BLACK = 0xff000000
static

color constants - hex codes

◆ Black

const ref Color Color.Black = new Color(0.0, 0.0, 0.0, 1.0)
static

color constants - color objects

◆ BLUE

const int Color.BLUE = 0xff0000ff
static

◆ Blue

const ref Color Color.Blue = new Color(0.0, 0.0, 1.0, 1.0)
static

◆ CHARTREUSE

const int Color.CHARTREUSE = 0xff80ff00
static

◆ Chartreuse

const ref Color Color.Chartreuse = new Color(0.5, 1.0, 0.0, 1.0)
static

◆ CYAN

const int Color.CYAN = 0xff00ffff
static

◆ Cyan

const ref Color Color.Cyan = new Color(0.0, 1.0, 1.0, 1.0)
static

◆ DARK_BLUE

const int Color.DARK_BLUE = 0xff000080
static

◆ DARK_CYAN

const int Color.DARK_CYAN = 0xff008080
static

◆ DARK_GREEN

const int Color.DARK_GREEN = 0xff008000
static

◆ DARK_MAGENTA

const int Color.DARK_MAGENTA = 0xff800080
static

◆ DARK_RED

const int Color.DARK_RED = 0xff800000
static

◆ DARK_YELLOW

const int Color.DARK_YELLOW = 0xff808000
static

◆ DarkBlue

const ref Color Color.DarkBlue = new Color(0.0, 0.0, 0.5, 1.0)
static

◆ DarkCyan

const ref Color Color.DarkCyan = new Color(0.0, 0.5, 0.5, 1.0)
static

◆ DarkGreen

const ref Color Color.DarkGreen = new Color(0.0, 0.5, 0.0, 1.0)
static

◆ DarkMagenta

const ref Color Color.DarkMagenta = new Color(0.5, 0.0, 0.5, 1.0)
static

◆ DarkRed

const ref Color Color.DarkRed = new Color(0.5, 0.0, 0.0, 1.0)
static

◆ DarkYellow

const ref Color Color.DarkYellow = new Color(0.5, 0.5, 0.0, 1.0)
static

◆ DODGER_BLUE

const int Color.DODGER_BLUE = 0xff0080ff
static

◆ DodgerBlue

const ref Color Color.DodgerBlue = new Color(0.0, 0.5, 1.0, 1.0)
static

◆ GRAY

const int Color.GRAY = 0xff808080
static

◆ Gray

const ref Color Color.Gray = new Color(0.5, 0.5, 0.5, 1.0)
static

◆ Gray25

const ref Color Color.Gray25 = new Color(0.25, 0.25, 0.25, 1.0)
static

◆ Gray75

const ref Color Color.Gray75 = new Color(0.75, 0.75, 0.75, 1.0)
static

◆ GRAY_25

const int Color.GRAY_25 = 0xff404040
static

◆ GRAY_75

const int Color.GRAY_75 = 0xffc0c0c0
static

◆ GREEN

const int Color.GREEN = 0xff00ff00
static

◆ Green

const ref Color Color.Green = new Color(0.0, 1.0, 0.0, 1.0)
static

◆ MAGENTA

const int Color.MAGENTA = 0xffff00ff
static

◆ Magenta

const ref Color Color.Magenta = new Color(1.0, 0.0, 1.0, 1.0)
static

◆ ORANGE

const int Color.ORANGE = 0xffff8000
static

◆ Orange

const ref Color Color.Orange = new Color(1.0, 0.5, 0.0, 1.0)
static

◆ PINK

const int Color.PINK = 0xffff0080
static

◆ Pink

const ref Color Color.Pink = new Color(1.0, 0.0, 0.5, 1.0)
static

◆ RED

const int Color.RED = 0xffff0000
static

◆ Red

const ref Color Color.Red = new Color(1.0, 0.0, 0.0, 1.0)
static

◆ SPRING_GREEN

const int Color.SPRING_GREEN = 0xff00ff80
static

◆ SpringGreen

const ref Color Color.SpringGreen = new Color(0.0, 1.0, 0.5, 1.0)
static

◆ VIOLET

const int Color.VIOLET = 0xff8000ff
static

◆ Violet

const ref Color Color.Violet = new Color(0.5, 0.0, 1.0, 1.0)
static

◆ WHITE

const int Color.WHITE = 0xffffffff
static

◆ White

const ref Color Color.White = new Color(1.0, 1.0, 1.0, 1.0)
static

◆ YELLOW

const int Color.YELLOW = 0xffffff00
static

◆ Yellow

const ref Color Color.Yellow = new Color(1.0, 1.0, 0.0, 1.0)
static

The documentation for this interface was generated from the following file: