Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    ColorBGRA Struct

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

    Represents a 32-bit color (4 bytes) in the form of BGRA (in byte order: B, G, R, A).

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

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Vector4)

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Byte)

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Byte, Byte, Byte, Byte)

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Byte[])

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Int32)

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Single)

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Single, Single, Single, Single)

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(Single[])

    Initializes a new instance of the ColorBGRA struct.

    ColorBGRA(UInt32)

    Initializes a new instance of the ColorBGRA struct.

    Fields
    A

    The alpha component of the color.

    B

    The blue component of the color.

    G

    The green component of the color.

    R

    The red component of the color.

    Properties
    Item[Int32]

    Gets or sets the component at the specified index.

    Methods
    Add(ColorBGRA, ColorBGRA)

    Adds two colors.

    Add(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Adds two colors.

    AdjustContrast(ColorBGRA, Single)

    Adjusts the contrast of a color.

    AdjustContrast(ref ColorBGRA, Single, out ColorBGRA)

    Adjusts the contrast of a color.

    AdjustSaturation(ColorBGRA, Single)

    Adjusts the saturation of a color.

    AdjustSaturation(ref ColorBGRA, Single, out ColorBGRA)

    Adjusts the saturation of a color.

    Clamp(ColorBGRA, ColorBGRA, ColorBGRA)

    Restricts a value to be within a specified range.

    Clamp(ref ColorBGRA, ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Restricts a value to be within a specified range.

    Equals(ColorBGRA)

    Determines whether the specified ColorBGRA is equal to this instance.

    Equals(Object)

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

    FromBgra(Int32)

    Converts the color from a packed BGRA integer.

    FromBgra(UInt32)

    Converts the color from a packed BGRA integer.

    FromRgba(Int32)

    Converts the color from a packed RGBA integer.

    FromRgba(UInt32)

    Converts the color from a packed RGBA integer.

    GetBrightness()

    Gets the brightness.

    GetHashCode()

    Returns a hash code for this instance.

    GetHue()

    Gets the hue.

    GetSaturation()

    Gets the saturation.

    Lerp(ColorBGRA, ColorBGRA, Single)

    Performs a linear interpolation between two colors.

    Lerp(ref ColorBGRA, ref ColorBGRA, Single, out ColorBGRA)

    Performs a linear interpolation between two colors.

    Max(ColorBGRA, ColorBGRA)

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

    Max(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

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

    Min(ColorBGRA, ColorBGRA)

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

    Min(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

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

    Modulate(ColorBGRA, ColorBGRA)

    Modulates two colors.

    Modulate(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Modulates two colors.

    Negate(ColorBGRA)

    Negates a color.

    Negate(ref ColorBGRA, out ColorBGRA)

    Negates a color.

    Scale(ColorBGRA, Single)

    Scales a color.

    Scale(ref ColorBGRA, Single, out ColorBGRA)

    Scales a color.

    SmoothStep(ColorBGRA, ColorBGRA, Single)

    Performs a cubic interpolation between two colors.

    SmoothStep(ref ColorBGRA, ref ColorBGRA, Single, out ColorBGRA)

    Performs a cubic interpolation between two colors.

    Subtract(ColorBGRA, ColorBGRA)

    Subtracts two colors.

    Subtract(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Subtracts two colors.

    ToArray()

    Creates an array containing the elements of the color.

    ToBgra()

    Converts the color into a packed integer.

    ToColor3()

    Converts the color into a three component color.

    ToRgba()

    Converts the color into a packed integer.

    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(ColorBGRA, ColorBGRA)

    Adds two colors.

    Equality(ColorBGRA, ColorBGRA)

    Tests for equality between two objects.

    Explicit(Color3 to ColorBGRA)

    Performs an explicit conversion from Color3 to ColorBGRA.

    Explicit(Color4 to ColorBGRA)

    Performs an explicit conversion from Color4 to ColorBGRA.

    Explicit(ColorBGRA to Color3)

    Performs an explicit conversion from ColorBGRA to Color3.

    Explicit(ColorBGRA to Color4)

    Performs an explicit conversion from ColorBGRA to Color4.

    Explicit(ColorBGRA to Vector3)

    Performs an explicit conversion from ColorBGRA to Vector3.

    Explicit(ColorBGRA to Vector4)

    Performs an explicit conversion from ColorBGRA to Vector4.

    Explicit(ColorBGRA to Int32)

    Performs an explicit conversion from ColorBGRA to System.Int32.

    Explicit(Vector3 to ColorBGRA)

    Performs an explicit conversion from Vector3 to ColorBGRA.

    Explicit(Vector4 to ColorBGRA)

    Performs an explicit conversion from Vector4 to ColorBGRA.

    Explicit(Int32 to ColorBGRA)

    Performs an explicit conversion from System.Int32 to ColorBGRA.

    Implicit(Color to ColorBGRA)

    Performs an implicit conversion from Color to ColorBGRA.

    Implicit(ColorBGRA to Color)

    Performs an implicit conversion from ColorBGRA to Color.

    Inequality(ColorBGRA, ColorBGRA)

    Tests for inequality between two objects.

    Multiply(ColorBGRA, ColorBGRA)

    Modulates two colors.

    Multiply(ColorBGRA, Single)

    Scales a color.

    Multiply(Single, ColorBGRA)

    Scales a color.

    Subtraction(ColorBGRA, ColorBGRA)

    Subtracts two colors.

    UnaryNegation(ColorBGRA)

    Negates a color.

    UnaryPlus(ColorBGRA)

    Assert a color (return it unchanged).

    | Improve this Doc View Source

    Constructors


    ColorBGRA(Vector3, Single)

    Initializes a new instance of the ColorBGRA struct.

    public ColorBGRA(Vector3 value, float alpha)
    Parameters
    Type Name Description
    Vector3 value

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

    System.Single alpha

    The alpha component of the color.


    ColorBGRA(Vector4)

    Initializes a new instance of the ColorBGRA struct.

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

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


    ColorBGRA(Byte)

    Initializes a new instance of the ColorBGRA struct.

    public ColorBGRA(byte value)
    Parameters
    Type Name Description
    System.Byte value

    The value that will be assigned to all components.


    ColorBGRA(Byte, Byte, Byte, Byte)

    Initializes a new instance of the ColorBGRA struct.

    public ColorBGRA(byte red, byte green, byte blue, byte alpha)
    Parameters
    Type Name Description
    System.Byte red

    The red component of the color.

    System.Byte green

    The green component of the color.

    System.Byte blue

    The blue component of the color.

    System.Byte alpha

    The alpha component of the color.


    ColorBGRA(Byte[])

    Initializes a new instance of the ColorBGRA struct.

    public ColorBGRA(byte[] values)
    Parameters
    Type Name Description
    System.Byte[] values

    The values to assign to the red, green, and blue, 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.


    ColorBGRA(Int32)

    Initializes a new instance of the ColorBGRA struct.

    public ColorBGRA(int bgra)
    Parameters
    Type Name Description
    System.Int32 bgra

    A packed integer containing all four color components in BGRA.


    ColorBGRA(Single)

    Initializes a new instance of the ColorBGRA struct.

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

    The value that will be assigned to all components.


    ColorBGRA(Single, Single, Single, Single)

    Initializes a new instance of the ColorBGRA struct.

    public ColorBGRA(float red, float green, float blue, float alpha)
    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.


    ColorBGRA(Single[])

    Initializes a new instance of the ColorBGRA struct.

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

    The values to assign to the red, green, and blue, 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.


    ColorBGRA(UInt32)

    Initializes a new instance of the ColorBGRA struct.

    public ColorBGRA(uint bgra)
    Parameters
    Type Name Description
    System.UInt32 bgra

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

    | Improve this Doc View Source

    Fields


    A

    The alpha component of the color.

    [DataMember(3)]
    public byte A
    Field Value
    Type Description
    System.Byte

    B

    The blue component of the color.

    [DataMember(0)]
    public byte B
    Field Value
    Type Description
    System.Byte

    G

    The green component of the color.

    [DataMember(1)]
    public byte G
    Field Value
    Type Description
    System.Byte

    R

    The red component of the color.

    [DataMember(2)]
    public byte R
    Field Value
    Type Description
    System.Byte
    | Improve this Doc View Source

    Properties


    Item[Int32]

    Gets or sets the component at the specified index.

    public byte 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.Byte

    The value of the alpha, red, green, or blue component, 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(ColorBGRA, ColorBGRA)

    Adds two colors.

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

    The first color to add.

    ColorBGRA right

    The second color to add.

    Returns
    Type Description
    ColorBGRA

    The sum of the two colors.


    Add(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Adds two colors.

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

    The first color to add.

    ColorBGRA right

    The second color to add.

    ColorBGRA result

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


    AdjustContrast(ColorBGRA, Single)

    Adjusts the contrast of a color.

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

    The color whose contrast is to be adjusted.

    System.Single contrast

    The amount by which to adjust the contrast.

    Returns
    Type Description
    ColorBGRA

    The adjusted color.


    AdjustContrast(ref ColorBGRA, Single, out ColorBGRA)

    Adjusts the contrast of a color.

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

    The color whose contrast is to be adjusted.

    System.Single contrast

    The amount by which to adjust the contrast.

    ColorBGRA result

    When the method completes, contains the adjusted color.


    AdjustSaturation(ColorBGRA, Single)

    Adjusts the saturation of a color.

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

    The color whose saturation is to be adjusted.

    System.Single saturation

    The amount by which to adjust the saturation.

    Returns
    Type Description
    ColorBGRA

    The adjusted color.


    AdjustSaturation(ref ColorBGRA, Single, out ColorBGRA)

    Adjusts the saturation of a color.

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

    The color whose saturation is to be adjusted.

    System.Single saturation

    The amount by which to adjust the saturation.

    ColorBGRA result

    When the method completes, contains the adjusted color.


    Clamp(ColorBGRA, ColorBGRA, ColorBGRA)

    Restricts a value to be within a specified range.

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

    The value to clamp.

    ColorBGRA min

    The minimum value.

    ColorBGRA max

    The maximum value.

    Returns
    Type Description
    ColorBGRA

    The clamped value.


    Clamp(ref ColorBGRA, ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Restricts a value to be within a specified range.

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

    The value to clamp.

    ColorBGRA min

    The minimum value.

    ColorBGRA max

    The maximum value.

    ColorBGRA result

    When the method completes, contains the clamped value.


    Equals(ColorBGRA)

    Determines whether the specified ColorBGRA is equal to this instance.

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

    The ColorBGRA to compare with this instance.

    Returns
    Type Description
    System.Boolean

    true if the specified ColorBGRA 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)

    FromBgra(Int32)

    Converts the color from a packed BGRA integer.

    public static ColorBGRA FromBgra(int color)
    Parameters
    Type Name Description
    System.Int32 color

    A packed integer containing all four color components in BGRA order

    Returns
    Type Description
    ColorBGRA

    A color.


    FromBgra(UInt32)

    Converts the color from a packed BGRA integer.

    public static ColorBGRA FromBgra(uint color)
    Parameters
    Type Name Description
    System.UInt32 color

    A packed integer containing all four color components in BGRA order

    Returns
    Type Description
    ColorBGRA

    A color.


    FromRgba(Int32)

    Converts the color from a packed RGBA integer.

    public static ColorBGRA FromRgba(int color)
    Parameters
    Type Name Description
    System.Int32 color

    A packed integer containing all four color components in RGBA order

    Returns
    Type Description
    ColorBGRA

    A color.


    FromRgba(UInt32)

    Converts the color from a packed RGBA integer.

    public static ColorBGRA FromRgba(uint color)
    Parameters
    Type Name Description
    System.UInt32 color

    A packed integer containing all four color components in RGBA order

    Returns
    Type Description
    ColorBGRA

    A color.


    GetBrightness()

    Gets the brightness.

    public float GetBrightness()
    Returns
    Type Description
    System.Single

    The Hue-Saturation-Brightness (HSB) saturation for this Color


    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()

    GetHue()

    Gets the hue.

    public float GetHue()
    Returns
    Type Description
    System.Single

    The Hue-Saturation-Brightness (HSB) saturation for this Color


    GetSaturation()

    Gets the saturation.

    public float GetSaturation()
    Returns
    Type Description
    System.Single

    The Hue-Saturation-Brightness (HSB) saturation for this Color


    Lerp(ColorBGRA, ColorBGRA, Single)

    Performs a linear interpolation between two colors.

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

    Start color.

    ColorBGRA end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Type Description
    ColorBGRA

    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 ColorBGRA, ref ColorBGRA, Single, out ColorBGRA)

    Performs a linear interpolation between two colors.

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

    Start color.

    ColorBGRA end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    ColorBGRA 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(ColorBGRA, ColorBGRA)

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

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

    The first source color.

    ColorBGRA right

    The second source color.

    Returns
    Type Description
    ColorBGRA

    A color containing the largest components of the source colors.


    Max(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

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

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

    The first source color.

    ColorBGRA right

    The second source color.

    ColorBGRA result

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


    Min(ColorBGRA, ColorBGRA)

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

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

    The first source color.

    ColorBGRA right

    The second source color.

    Returns
    Type Description
    ColorBGRA

    A color containing the smallest components of the source colors.


    Min(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

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

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

    The first source color.

    ColorBGRA right

    The second source color.

    ColorBGRA result

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


    Modulate(ColorBGRA, ColorBGRA)

    Modulates two colors.

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

    The first color to modulate.

    ColorBGRA right

    The second color to modulate.

    Returns
    Type Description
    ColorBGRA

    The modulated color.


    Modulate(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Modulates two colors.

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

    The first color to modulate.

    ColorBGRA right

    The second color to modulate.

    ColorBGRA result

    When the method completes, contains the modulated color.


    Negate(ColorBGRA)

    Negates a color.

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

    The color to negate.

    Returns
    Type Description
    ColorBGRA

    The negated color.


    Negate(ref ColorBGRA, out ColorBGRA)

    Negates a color.

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

    The color to negate.

    ColorBGRA result

    When the method completes, contains the negated color.


    Scale(ColorBGRA, Single)

    Scales a color.

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

    The color to scale.

    System.Single scale

    The amount by which to scale.

    Returns
    Type Description
    ColorBGRA

    The scaled color.


    Scale(ref ColorBGRA, Single, out ColorBGRA)

    Scales a color.

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

    The color to scale.

    System.Single scale

    The amount by which to scale.

    ColorBGRA result

    When the method completes, contains the scaled color.


    SmoothStep(ColorBGRA, ColorBGRA, Single)

    Performs a cubic interpolation between two colors.

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

    Start color.

    ColorBGRA end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Type Description
    ColorBGRA

    The cubic interpolation of the two colors.


    SmoothStep(ref ColorBGRA, ref ColorBGRA, Single, out ColorBGRA)

    Performs a cubic interpolation between two colors.

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

    Start color.

    ColorBGRA end

    End color.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    ColorBGRA result

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


    Subtract(ColorBGRA, ColorBGRA)

    Subtracts two colors.

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

    The first color to subtract.

    ColorBGRA right

    The second color to subtract

    Returns
    Type Description
    ColorBGRA

    The difference of the two colors.


    Subtract(ref ColorBGRA, ref ColorBGRA, out ColorBGRA)

    Subtracts two colors.

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

    The first color to subtract.

    ColorBGRA right

    The second color to subtract.

    ColorBGRA result

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


    ToArray()

    Creates an array containing the elements of the color.

    public byte[] ToArray()
    Returns
    Type Description
    System.Byte[]

    A four-element array containing the components of the color in BGRA order.


    ToBgra()

    Converts the color into a packed integer.

    public int ToBgra()
    Returns
    Type Description
    System.Int32

    A packed integer containing all four color components.


    ToColor3()

    Converts the color into a three component color.

    public Color3 ToColor3()
    Returns
    Type Description
    Color3

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


    ToRgba()

    Converts the color into a packed integer.

    public int ToRgba()
    Returns
    Type Description
    System.Int32

    A packed integer containing all four color components.


    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 (byte).

    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 (byte).

    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(ColorBGRA, ColorBGRA)

    Adds two colors.

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

    The first color to add.

    ColorBGRA right

    The second color to add.

    Returns
    Type Description
    ColorBGRA

    The sum of the two colors.


    Equality(ColorBGRA, ColorBGRA)

    Tests for equality between two objects.

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

    The first value to compare.

    ColorBGRA right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

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


    Explicit(Color3 to ColorBGRA)

    Performs an explicit conversion from Color3 to ColorBGRA.

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

    The value.

    Returns
    Type Description
    ColorBGRA

    The result of the conversion.


    Explicit(Color4 to ColorBGRA)

    Performs an explicit conversion from Color4 to ColorBGRA.

    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(ColorBGRA to Color3)

    Performs an explicit conversion from ColorBGRA to Color3.

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

    The value.

    Returns
    Type Description
    Color3

    The result of the conversion.


    Explicit(ColorBGRA to Color4)

    Performs an explicit conversion from ColorBGRA 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(ColorBGRA to Vector3)

    Performs an explicit conversion from ColorBGRA to Vector3.

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

    The value.

    Returns
    Type Description
    Vector3

    The result of the conversion.


    Explicit(ColorBGRA to Vector4)

    Performs an explicit conversion from ColorBGRA to Vector4.

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

    The value.

    Returns
    Type Description
    Vector4

    The result of the conversion.


    Explicit(ColorBGRA to Int32)

    Performs an explicit conversion from ColorBGRA to System.Int32.

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

    The value.

    Returns
    Type Description
    System.Int32

    The result of the conversion.


    Explicit(Vector3 to ColorBGRA)

    Performs an explicit conversion from Vector3 to ColorBGRA.

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

    The value.

    Returns
    Type Description
    ColorBGRA

    The result of the conversion.


    Explicit(Vector4 to ColorBGRA)

    Performs an explicit conversion from Vector4 to ColorBGRA.

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

    The value.

    Returns
    Type Description
    ColorBGRA

    The result of the conversion.


    Explicit(Int32 to ColorBGRA)

    Performs an explicit conversion from System.Int32 to ColorBGRA.

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

    The value.

    Returns
    Type Description
    ColorBGRA

    The result of the conversion.


    Implicit(Color to ColorBGRA)

    Performs an implicit conversion from Color to ColorBGRA.

    public static implicit operator ColorBGRA(Color value)
    Parameters
    Type Name Description
    Color value

    The value.

    Returns
    Type Description
    ColorBGRA

    The result of the conversion.


    Implicit(ColorBGRA to Color)

    Performs an implicit conversion from ColorBGRA to Color.

    public static implicit operator Color(ColorBGRA value)
    Parameters
    Type Name Description
    ColorBGRA value

    The value.

    Returns
    Type Description
    Color

    The result of the conversion.


    Inequality(ColorBGRA, ColorBGRA)

    Tests for inequality between two objects.

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

    The first value to compare.

    ColorBGRA right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

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


    Multiply(ColorBGRA, ColorBGRA)

    Modulates two colors.

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

    The first color to modulate.

    ColorBGRA right

    The second color to modulate.

    Returns
    Type Description
    ColorBGRA

    The modulated color.


    Multiply(ColorBGRA, Single)

    Scales a color.

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

    The factor by which to scale the color.

    System.Single scale

    The color to scale.

    Returns
    Type Description
    ColorBGRA

    The scaled color.


    Multiply(Single, ColorBGRA)

    Scales a color.

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

    The factor by which to scale the color.

    ColorBGRA value

    The color to scale.

    Returns
    Type Description
    ColorBGRA

    The scaled color.


    Subtraction(ColorBGRA, ColorBGRA)

    Subtracts two colors.

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

    The first color to subtract.

    ColorBGRA right

    The second color to subtract.

    Returns
    Type Description
    ColorBGRA

    The difference of the two colors.


    UnaryNegation(ColorBGRA)

    Negates a color.

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

    The color to negate.

    Returns
    Type Description
    ColorBGRA

    A negated color.


    UnaryPlus(ColorBGRA)

    Assert a color (return it unchanged).

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

    The color to assert (unchange).

    Returns
    Type Description
    ColorBGRA

    The asserted (unchanged) color.


    Extension Methods

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

    Back to top

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