Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Color4 Struct

    Namespace: Stride.Core.Mathematics
    Assembly: Stride.Core.Mathematics.dll

    Represents a color in the form of rgba.

    [DataContract("Color4")]
    [DataStyle(DataStyle.Compact)]
    public struct Color4 : IEquatable<Color4>, IFormattable
    Name Description
    Constructors
    Color4(Color)

    Initializes a new instance of the Color4 struct.

    Color4(Color3)

    Initializes a new instance of the Color4 struct.

    Color4(Color3, Single)

    Initializes a new instance of the Color4 struct.

    Color4(ColorBGRA)

    Initializes a new instance of the Color4 struct.

    Color4(Vector3, Single)

    Initializes a new instance of the Color4 struct.

    Color4(Vector4)

    Initializes a new instance of the Color4 struct.

    Color4(Int32)

    Initializes a new instance of the Color4 struct.

    Color4(Single)

    Initializes a new instance of the Color4 struct.

    Color4(Single, Single, Single, Single)

    Initializes a new instance of the Color4 struct.

    Color4(Single[])

    Initializes a new instance of the Color4 struct.

    Color4(UInt32)

    Initializes a new instance of the Color4 struct.

    Fields
    A

    The alpha component of the color.

    B

    The blue component of the color.

    Black

    The Black color (0, 0, 0, 1).

    G

    The green component of the color.

    R

    The red component of the color.

    White

    The White color (1, 1, 1, 1).

    Properties
    Item[Int32]

    Gets or sets the component at the specified index.

    Methods
    Add(Color4, Color4)

    Adds two colors.

    Add(ref Color4, ref Color4, out Color4)

    Adds two colors.

    AdjustContrast(Color4, Single)

    Adjusts the contrast of a color.

    AdjustContrast(ref Color4, Single, out Color4)

    Adjusts the contrast of a color.

    AdjustSaturation(Color4, Single)

    Adjusts the saturation of a color.

    AdjustSaturation(ref Color4, Single, out Color4)

    Adjusts the saturation of a color.

    Clamp(Color4, Color4, Color4)

    Restricts a value to be within a specified range.

    Clamp(ref Color4, ref Color4, ref Color4, out Color4)

    Restricts a value to be within a specified range.

    Equals(Color4)

    Determines whether the specified Color4 is equal to this instance.

    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    GetHashCode()

    Returns a hash code for this instance.

    Lerp(Color4, Color4, Single)

    Performs a linear interpolation between two colors.

    Lerp(ref Color4, ref Color4, Single, out Color4)

    Performs a linear interpolation between two colors.

    Max(Color4, Color4)

    Returns a color containing the largest components of the specified colors.

    Max(ref Color4, ref Color4, out Color4)

    Returns a color containing the smallest components of the specified colors.

    Min(Color4, Color4)

    Returns a color containing the smallest components of the specified colors.

    Min(ref Color4, ref Color4, out Color4)

    Returns a color containing the smallest components of the specified colors.

    Modulate(Color4, Color4)

    Modulates two colors.

    Modulate(ref Color4, ref Color4, out Color4)

    Modulates two colors.

    Negate(Color4)

    Negates a color.

    Negate(ref Color4, out Color4)

    Negates a color.

    PremultiplyAlpha(Color4)

    Premultiplies the color components by the alpha value.

    Scale(Color4, Single)

    Scales a color.

    Scale(ref Color4, Single, out Color4)

    Scales a color.

    SmoothStep(Color4, Color4, Single)

    Performs a cubic interpolation between two colors.

    SmoothStep(ref Color4, ref Color4, Single, out Color4)

    Performs a cubic interpolation between two colors.

    Subtract(Color4, Color4)

    Subtracts two colors.

    Subtract(ref Color4, ref Color4, out Color4)

    Subtracts two colors.

    ToArray()

    Creates an array containing the elements of the color.

    ToBgra()

    Converts the color into a packed integer.

    ToBgra(out Byte, out Byte, out Byte, out Byte)

    Converts the color into a packed integer.

    ToColor3()

    Converts this color to an equivalent Color3, discarding the alpha channel.

    ToLinear()

    Converts this color from sRGB space to linear space.

    ToRgba()

    Converts the color into a packed integer.

    ToSRgb()

    Converts this color from linear space to sRGB space.

    ToString()

    Returns a System.String that represents this instance.

    ToString(IFormatProvider)

    Returns a System.String that represents this instance.

    ToString(String)

    Returns a System.String that represents this instance.

    ToString(String, IFormatProvider)

    Returns a System.String that represents this instance.

    ToVector3()

    Converts the color into a three component vector.

    ToVector4()

    Converts the color into a four component vector.

    Operators
    Addition(Color4, Color4)

    Adds two colors.

    Equality(Color4, Color4)

    Tests for equality between two objects.

    Explicit(Color4 to Color3)

    Performs an explicit conversion from Color4 to Color3.

    Explicit(Color4 to ColorBGRA)

    Performs an explicit conversion from Vector4 to Color4.

    Explicit(Color4 to Vector3)

    Performs an explicit conversion from Color4 to Vector3.

    Explicit(Color4 to Int32)

    Performs an explicit conversion from Color4 to System.Int32.

    Explicit(ColorBGRA to Color4)

    Performs an explicit conversion from Vector3 to Color4.

    Explicit(Vector3 to Color4)

    Performs an explicit conversion from Vector3 to Color4.

    Explicit(Vector4 to Color4)

    Performs an explicit conversion from Vector4 to Color4.

    Explicit(Int32 to Color4)

    Performs an explicit conversion from System.Int32 to Color4.

    Implicit(Color4 to Vector4)

    Performs an implicit conversion from Color4 to Vector4.

    Inequality(Color4, Color4)

    Tests for inequality between two objects.

    Multiply(Color4, Color4)

    Modulates two colors.

    Multiply(Color4, Single)

    Scales a color.

    Multiply(Single, Color4)

    Scales a color.

    Subtraction(Color4, Color4)

    Subtracts two colors.

    UnaryNegation(Color4)

    Negates a color.

    UnaryPlus(Color4)

    Assert a color (return it unchanged).

    | Improve this Doc View Source

    Constructors


    Color4(Color)

    Initializes a new instance of the Color4 struct.

    public Color4(Color color)
    Parameters
    Type Name Description
    Color color

    Color used to initialize the color.


    Color4(Color3)

    Initializes a new instance of the Color4 struct.

    public Color4(Color3 color)
    Parameters
    Type Name Description
    Color3 color

    Color3 used to initialize the color.


    Color4(Color3, Single)

    Initializes a new instance of the Color4 struct.

    public Color4(Color3 color, float alpha = 1F)
    Parameters
    Type Name Description
    Color3 color

    Color3 used to initialize the color.

    System.Single alpha

    The alpha component of the color.


    Color4(ColorBGRA)

    Initializes a new instance of the Color4 struct.

    public Color4(ColorBGRA color)
    Parameters
    Type Name Description
    ColorBGRA color

    Color used to initialize the color.


    Color4(Vector3, Single)

    Initializes a new instance of the Color4 struct.

    public Color4(Vector3 value, float alpha = 1F)
    Parameters
    Type Name Description
    Vector3 value

    The red, green, and blue components of the color.

    System.Single alpha

    The alpha component of the color.


    Color4(Vector4)

    Initializes a new instance of the Color4 struct.

    public Color4(Vector4 value)
    Parameters
    Type Name Description
    Vector4 value

    The red, green, blue, and alpha components of the color.


    Color4(Int32)

    Initializes a new instance of the Color4 struct.

    public Color4(int rgba)
    Parameters
    Type Name Description
    System.Int32 rgba

    A packed integer containing all four color components in RGBA order.


    Color4(Single)

    Initializes a new instance of the Color4 struct.

    public Color4(float value)
    Parameters
    Type Name Description
    System.Single value

    The value that will be assigned to all components.


    Color4(Single, Single, Single, Single)

    Initializes a new instance of the Color4 struct.

    public Color4(float red, float green, float blue, float alpha = 1F)
    Parameters
    Type Name Description
    System.Single red

    The red component of the color.

    System.Single green

    The green component of the color.

    System.Single blue

    The blue component of the color.

    System.Single alpha

    The alpha component of the color.


    Color4(Single[])

    Initializes a new instance of the Color4 struct.

    public Color4(float[] values)
    Parameters
    Type Name Description
    System.Single[] values

    The values to assign to the red, green, blue, and alpha components of the color. This must be an array with four elements.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than four elements.


    Color4(UInt32)

    Initializes a new instance of the Color4 struct.

    public Color4(uint rgba)
    Parameters
    Type Name Description
    System.UInt32 rgba

    A packed integer containing all four color components in RGBA order.

    | Improve this Doc View Source

    Fields


    A

    The alpha component of the color.

    [DataMember(3)]
    public float A
    Field Value
    Type Description
    System.Single

    B

    The blue component of the color.

    [DataMember(2)]
    public float B
    Field Value
    Type Description
    System.Single

    Black

    The Black color (0, 0, 0, 1).

    public static readonly Color4 Black
    Field Value
    Type Description
    Color4

    G

    The green component of the color.

    [DataMember(1)]
    public float G
    Field Value
    Type Description
    System.Single

    R

    The red component of the color.

    [DataMember(0)]
    public float R
    Field Value
    Type Description
    System.Single

    White

    The White color (1, 1, 1, 1).

    public static readonly Color4 White
    Field Value
    Type Description
    Color4
    | Improve this Doc View Source

    Properties


    Item[Int32]

    Gets or sets the component at the specified index.

    public float this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index

    The index of the component to access. Use 0 for the alpha component, 1 for the red component, 2 for the green component, and 3 for the blue component.

    Property Value
    Type Description
    System.Single

    The value of the red, green, blue, and alpha components, depending on the index.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    Thrown when the index is out of the range [0, 3].

    | Improve this Doc View Source

    Methods


    Add(Color4, Color4)

    Adds two colors.

    public static Color4 Add(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first color to add.

    Color4 right

    The second color to add.

    Returns
    Type Description
    Color4

    The sum of the two colors.


    Add(ref Color4, ref Color4, out Color4)

    Adds two colors.

    public static void Add(ref Color4 left, ref Color4 right, out Color4 result)
    Parameters
    Type Name Description
    Color4 left

    The first color to add.

    Color4 right

    The second color to add.

    Color4 result

    When the method completes, completes the sum of the two colors.


    AdjustContrast(Color4, Single)

    Adjusts the contrast of a color.

    public static Color4 AdjustContrast(Color4 value, float contrast)
    Parameters
    Type Name Description
    Color4 value

    The color whose contrast is to be adjusted.

    System.Single contrast

    The amount by which to adjust the contrast.

    Returns
    Type Description
    Color4

    The adjusted color.


    AdjustContrast(ref Color4, Single, out Color4)

    Adjusts the contrast of a color.

    public static void AdjustContrast(ref Color4 value, float contrast, out Color4 result)
    Parameters
    Type Name Description
    Color4 value

    The color whose contrast is to be adjusted.

    System.Single contrast

    The amount by which to adjust the contrast.

    Color4 result

    When the method completes, contains the adjusted color.


    AdjustSaturation(Color4, Single)

    Adjusts the saturation of a color.

    public static Color4 AdjustSaturation(Color4 value, float saturation)
    Parameters
    Type Name Description
    Color4 value

    The color whose saturation is to be adjusted.

    System.Single saturation

    The amount by which to adjust the saturation.

    Returns
    Type Description
    Color4

    The adjusted color.


    AdjustSaturation(ref Color4, Single, out Color4)

    Adjusts the saturation of a color.

    public static void AdjustSaturation(ref Color4 value, float saturation, out Color4 result)
    Parameters
    Type Name Description
    Color4 value

    The color whose saturation is to be adjusted.

    System.Single saturation

    The amount by which to adjust the saturation.

    Color4 result

    When the method completes, contains the adjusted color.


    Clamp(Color4, Color4, Color4)

    Restricts a value to be within a specified range.

    public static Color4 Clamp(Color4 value, Color4 min, Color4 max)
    Parameters
    Type Name Description
    Color4 value

    The value to clamp.

    Color4 min

    The minimum value.

    Color4 max

    The maximum value.

    Returns
    Type Description
    Color4

    The clamped value.


    Clamp(ref Color4, ref Color4, ref Color4, out Color4)

    Restricts a value to be within a specified range.

    public static void Clamp(ref Color4 value, ref Color4 min, ref Color4 max, out Color4 result)
    Parameters
    Type Name Description
    Color4 value

    The value to clamp.

    Color4 min

    The minimum value.

    Color4 max

    The maximum value.

    Color4 result

    When the method completes, contains the clamped value.


    Equals(Color4)

    Determines whether the specified Color4 is equal to this instance.

    public bool Equals(Color4 other)
    Parameters
    Type Name Description
    Color4 other

    The Color4 to compare with this instance.

    Returns
    Type Description
    System.Boolean

    true if the specified Color4 is equal to this instance; otherwise, false.


    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    public override bool Equals(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to compare with this instance.

    Returns
    Type Description
    System.Boolean

    true if the specified System.Object is equal to this instance; otherwise, false.

    Overrides
    System.ValueType.Equals(System.Object)

    GetHashCode()

    Returns a hash code for this instance.

    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

    Overrides
    System.ValueType.GetHashCode()

    Lerp(Color4, Color4, Single)

    Performs a linear interpolation between two colors.

    public static Color4 Lerp(Color4 start, Color4 end, float amount)
    Parameters
    Type Name Description
    Color4 start

    Start color.

    Color4 end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Type Description
    Color4

    The linear interpolation of the two colors.

    Remarks

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.


    Lerp(ref Color4, ref Color4, Single, out Color4)

    Performs a linear interpolation between two colors.

    public static void Lerp(ref Color4 start, ref Color4 end, float amount, out Color4 result)
    Parameters
    Type Name Description
    Color4 start

    Start color.

    Color4 end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Color4 result

    When the method completes, contains the linear interpolation of the two colors.

    Remarks

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.


    Max(Color4, Color4)

    Returns a color containing the largest components of the specified colors.

    public static Color4 Max(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first source color.

    Color4 right

    The second source color.

    Returns
    Type Description
    Color4

    A color containing the largest components of the source colors.


    Max(ref Color4, ref Color4, out Color4)

    Returns a color containing the smallest components of the specified colors.

    public static void Max(ref Color4 left, ref Color4 right, out Color4 result)
    Parameters
    Type Name Description
    Color4 left

    The first source color.

    Color4 right

    The second source color.

    Color4 result

    When the method completes, contains an new color composed of the largest components of the source colors.


    Min(Color4, Color4)

    Returns a color containing the smallest components of the specified colors.

    public static Color4 Min(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first source color.

    Color4 right

    The second source color.

    Returns
    Type Description
    Color4

    A color containing the smallest components of the source colors.


    Min(ref Color4, ref Color4, out Color4)

    Returns a color containing the smallest components of the specified colors.

    public static void Min(ref Color4 left, ref Color4 right, out Color4 result)
    Parameters
    Type Name Description
    Color4 left

    The first source color.

    Color4 right

    The second source color.

    Color4 result

    When the method completes, contains an new color composed of the smallest components of the source colors.


    Modulate(Color4, Color4)

    Modulates two colors.

    public static Color4 Modulate(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first color to modulate.

    Color4 right

    The second color to modulate.

    Returns
    Type Description
    Color4

    The modulated color.


    Modulate(ref Color4, ref Color4, out Color4)

    Modulates two colors.

    public static void Modulate(ref Color4 left, ref Color4 right, out Color4 result)
    Parameters
    Type Name Description
    Color4 left

    The first color to modulate.

    Color4 right

    The second color to modulate.

    Color4 result

    When the method completes, contains the modulated color.


    Negate(Color4)

    Negates a color.

    public static Color4 Negate(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The color to negate.

    Returns
    Type Description
    Color4

    The negated color.


    Negate(ref Color4, out Color4)

    Negates a color.

    public static void Negate(ref Color4 value, out Color4 result)
    Parameters
    Type Name Description
    Color4 value

    The color to negate.

    Color4 result

    When the method completes, contains the negated color.


    PremultiplyAlpha(Color4)

    Premultiplies the color components by the alpha value.

    public static Color4 PremultiplyAlpha(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The color to premultiply.

    Returns
    Type Description
    Color4

    A color with premultiplied alpha.


    Scale(Color4, Single)

    Scales a color.

    public static Color4 Scale(Color4 value, float scale)
    Parameters
    Type Name Description
    Color4 value

    The color to scale.

    System.Single scale

    The amount by which to scale.

    Returns
    Type Description
    Color4

    The scaled color.


    Scale(ref Color4, Single, out Color4)

    Scales a color.

    public static void Scale(ref Color4 value, float scale, out Color4 result)
    Parameters
    Type Name Description
    Color4 value

    The color to scale.

    System.Single scale

    The amount by which to scale.

    Color4 result

    When the method completes, contains the scaled color.


    SmoothStep(Color4, Color4, Single)

    Performs a cubic interpolation between two colors.

    public static Color4 SmoothStep(Color4 start, Color4 end, float amount)
    Parameters
    Type Name Description
    Color4 start

    Start color.

    Color4 end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Type Description
    Color4

    The cubic interpolation of the two colors.


    SmoothStep(ref Color4, ref Color4, Single, out Color4)

    Performs a cubic interpolation between two colors.

    public static void SmoothStep(ref Color4 start, ref Color4 end, float amount, out Color4 result)
    Parameters
    Type Name Description
    Color4 start

    Start color.

    Color4 end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Color4 result

    When the method completes, contains the cubic interpolation of the two colors.


    Subtract(Color4, Color4)

    Subtracts two colors.

    public static Color4 Subtract(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first color to subtract.

    Color4 right

    The second color to subtract

    Returns
    Type Description
    Color4

    The difference of the two colors.


    Subtract(ref Color4, ref Color4, out Color4)

    Subtracts two colors.

    public static void Subtract(ref Color4 left, ref Color4 right, out Color4 result)
    Parameters
    Type Name Description
    Color4 left

    The first color to subtract.

    Color4 right

    The second color to subtract.

    Color4 result

    WHen the method completes, contains the difference of the two colors.


    ToArray()

    Creates an array containing the elements of the color.

    public float[] ToArray()
    Returns
    Type Description
    System.Single[]

    A four-element array containing the components of the color.


    ToBgra()

    Converts the color into a packed integer.

    public int ToBgra()
    Returns
    Type Description
    System.Int32

    A packed integer containing all four color components.


    ToBgra(out Byte, out Byte, out Byte, out Byte)

    Converts the color into a packed integer.

    public void ToBgra(out byte r, out byte g, out byte b, out byte a)
    Parameters
    Type Name Description
    System.Byte r
    System.Byte g
    System.Byte b
    System.Byte a

    ToColor3()

    Converts this color to an equivalent Color3, discarding the alpha channel.

    public Color3 ToColor3()
    Returns
    Type Description
    Color3

    An equivalent Color3, discarding the alpha channel.


    ToLinear()

    Converts this color from sRGB space to linear space.

    public Color4 ToLinear()
    Returns
    Type Description
    Color4

    A color4 in linear space.


    ToRgba()

    Converts the color into a packed integer.

    public int ToRgba()
    Returns
    Type Description
    System.Int32

    A packed integer containing all four color components.


    ToSRgb()

    Converts this color from linear space to sRGB space.

    public Color4 ToSRgb()
    Returns
    Type Description
    Color4

    A color3 in sRGB space.


    ToString()

    Returns a System.String that represents this instance.

    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String that represents this instance.

    Overrides
    System.ValueType.ToString()

    ToString(IFormatProvider)

    Returns a System.String that represents this instance.

    public string ToString(IFormatProvider formatProvider)
    Parameters
    Type Name Description
    System.IFormatProvider formatProvider

    The format provider.

    Returns
    Type Description
    System.String

    A System.String that represents this instance.


    ToString(String)

    Returns a System.String that represents this instance.

    public string ToString(string format)
    Parameters
    Type Name Description
    System.String format

    The format to apply to each channel (float).

    Returns
    Type Description
    System.String

    A System.String that represents this instance.


    ToString(String, IFormatProvider)

    Returns a System.String that represents this instance.

    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    Type Name Description
    System.String format

    The format to apply to each channel (float).

    System.IFormatProvider formatProvider

    The format provider.

    Returns
    Type Description
    System.String

    A System.String that represents this instance.


    ToVector3()

    Converts the color into a three component vector.

    public Vector3 ToVector3()
    Returns
    Type Description
    Vector3

    A three component vector containing the red, green, and blue components of the color.


    ToVector4()

    Converts the color into a four component vector.

    public Vector4 ToVector4()
    Returns
    Type Description
    Vector4

    A four component vector containing all four color components.

    | Improve this Doc View Source

    Operators


    Addition(Color4, Color4)

    Adds two colors.

    public static Color4 operator +(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first color to add.

    Color4 right

    The second color to add.

    Returns
    Type Description
    Color4

    The sum of the two colors.


    Equality(Color4, Color4)

    Tests for equality between two objects.

    public static bool operator ==(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first value to compare.

    Color4 right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has the same value as right; otherwise, false.


    Explicit(Color4 to Color3)

    Performs an explicit conversion from Color4 to Color3.

    public static explicit operator Color3(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The value.

    Returns
    Type Description
    Color3

    The result of the conversion.


    Explicit(Color4 to ColorBGRA)

    Performs an explicit conversion from Vector4 to Color4.

    public static explicit operator ColorBGRA(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The value.

    Returns
    Type Description
    ColorBGRA

    The result of the conversion.


    Explicit(Color4 to Vector3)

    Performs an explicit conversion from Color4 to Vector3.

    public static explicit operator Vector3(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The value.

    Returns
    Type Description
    Vector3

    The result of the conversion.


    Explicit(Color4 to Int32)

    Performs an explicit conversion from Color4 to System.Int32.

    public static explicit operator int (Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The value.

    Returns
    Type Description
    System.Int32

    The result of the conversion.


    Explicit(ColorBGRA to Color4)

    Performs an explicit conversion from Vector3 to Color4.

    public static explicit operator Color4(ColorBGRA value)
    Parameters
    Type Name Description
    ColorBGRA value

    The value.

    Returns
    Type Description
    Color4

    The result of the conversion.


    Explicit(Vector3 to Color4)

    Performs an explicit conversion from Vector3 to Color4.

    public static explicit operator Color4(Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    The value.

    Returns
    Type Description
    Color4

    The result of the conversion.


    Explicit(Vector4 to Color4)

    Performs an explicit conversion from Vector4 to Color4.

    public static explicit operator Color4(Vector4 value)
    Parameters
    Type Name Description
    Vector4 value

    The value.

    Returns
    Type Description
    Color4

    The result of the conversion.


    Explicit(Int32 to Color4)

    Performs an explicit conversion from System.Int32 to Color4.

    public static explicit operator Color4(int value)
    Parameters
    Type Name Description
    System.Int32 value

    The value.

    Returns
    Type Description
    Color4

    The result of the conversion.


    Implicit(Color4 to Vector4)

    Performs an implicit conversion from Color4 to Vector4.

    public static implicit operator Vector4(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The value.

    Returns
    Type Description
    Vector4

    The result of the conversion.


    Inequality(Color4, Color4)

    Tests for inequality between two objects.

    public static bool operator !=(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first value to compare.

    Color4 right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has a different value than right; otherwise, false.


    Multiply(Color4, Color4)

    Modulates two colors.

    public static Color4 operator *(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first color to modulate.

    Color4 right

    The second color to modulate.

    Returns
    Type Description
    Color4

    The modulated color.


    Multiply(Color4, Single)

    Scales a color.

    public static Color4 operator *(Color4 value, float scale)
    Parameters
    Type Name Description
    Color4 value

    The factor by which to scale the color.

    System.Single scale

    The color to scale.

    Returns
    Type Description
    Color4

    The scaled color.


    Multiply(Single, Color4)

    Scales a color.

    public static Color4 operator *(float scale, Color4 value)
    Parameters
    Type Name Description
    System.Single scale

    The factor by which to scale the color.

    Color4 value

    The color to scale.

    Returns
    Type Description
    Color4

    The scaled color.


    Subtraction(Color4, Color4)

    Subtracts two colors.

    public static Color4 operator -(Color4 left, Color4 right)
    Parameters
    Type Name Description
    Color4 left

    The first color to subtract.

    Color4 right

    The second color to subtract.

    Returns
    Type Description
    Color4

    The difference of the two colors.


    UnaryNegation(Color4)

    Negates a color.

    public static Color4 operator -(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The color to negate.

    Returns
    Type Description
    Color4

    A negated color.


    UnaryPlus(Color4)

    Assert a color (return it unchanged).

    public static Color4 operator +(Color4 value)
    Parameters
    Type Name Description
    Color4 value

    The color to assert (unchanged).

    Returns
    Type Description
    Color4

    The asserted (unchanged) color.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    ColorExtensions.ToColorSpace(Color4, ColorSpace)
    ColorExtensions.ToColorSpace(Color4, ColorSpace, ColorSpace)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation