ColorSwizzle

Description

struct Tinman.Core.Util.ColorSwizzle

A ColorSwizzle type represents a specific swizzle operation that is performed on the red, green, blue and alpha channels of a color value.

See also

Colors
ColorF

Public / Constants

Alpha


public constant Alpha → (4:int32)

Color channel identifier that selects the alpha channel of the source color.

Blue


public constant Blue → (3:int32)

Color channel identifier that selects the blue channel of the source color.

Green


public constant Green → (2:int32)

Color channel identifier that selects the green channel of the source color.

Identity


public static readonly attribute Identity → (ColorSwizzle)

The identity color swizzle operation.

One


public constant One → (5:int32)

Color channel identifier that selects the constant value 1.

Red


public constant Red → (1:int32)

Color channel identifier that selects the red channel of the source color.

Zero


public constant Zero → (0:int32)

Color channel identifier that selects the constant value 0.

Public / Constructors

For


[Pure]
public static method For → (4)

red opt : int32 = ColorSwizzle.Red

The color channel identifier to use for the red output channel.

green opt : int32 = ColorSwizzle.Green

The color channel identifier to use for the green output channel.

blue opt : int32 = ColorSwizzle.Blue

The color channel identifier to use for the blue output channel.

alpha opt : int32 = ColorSwizzle.Alpha

The color channel identifier to use for the alpha output channel.

returns → ColorSwizzle

The color swizzle operation. Will be Identity if red opt, green opt, blue opt and alpha opt are equal to Red, Green, Blue and Alpha, respectively.

Creates a new color swizzle operation.

The following color channel identifiers may be used:
Zero (0) : constant color channel value 0,
Red (1) : the red channel of the input color,
Green (2) : the green channel of the input color,
Blue (3) : the blue channel of the input color,
Alpha (4) : the alpha channel of the input color,
One (5) : constant color channel value 1.
To invert an input color channel, specify the negative value of its identifier.

Public / Methods

Append


[Pure]
public method Append → (1)

second in : ColorSwizzle

The color swizzle operation to append.

returns → ColorSwizzle

The resulting color swizzle operation.

Appends the given color swizzle operation to this one.

Apply

2 overloads


[Pure]
public method Apply1 → (1)

color in : int64

The color to swizzle.

returns → int64

The resulting color.

Applies this color channel swizzle operation of the given color in.


[Pure]
public method Apply2 → (1)

color in : ColorF

The color to swizzle.

returns → ColorF

The resulting color.

Applies this color channel swizzle operation of the given color in.

Public / Attributes

Channels


[Constant]
public attribute Channels → (get)

value : Vec4I

The color channel identifiers:
Vec4I.X : red
Vec4I.Y : green
Vec4I.Z : blue
Vec4I.W : alpha
The original color channel identifier -One will be reported as Zero by this property.

Returns the color channel identifiers that have been used to create this ColorSwizzle value.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<ColorSwizzle>

[not-null]
The configurator object.

The configurator object for this type.