diff --git a/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Angle.md b/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Angle.md new file mode 100644 index 0000000000..375fbc8f96 --- /dev/null +++ b/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Angle.md @@ -0,0 +1,237 @@ +# Summary +Proposal API for additional math types to bring it up to feature parity with other popular math libraries i.e. `SlimDX`, `SharpDX`, or `Stride3D`. Leveraging modern .NET features such as `INumber` and vectorization. + +# Contributors +- Daniel Keenan (dfkeenan) + +# Current Status +- [x] Proposed +- [ ] Discussed with API Review Board (ARB) +- [ ] Approved +- [ ] Implemented + +# Design Decisions +- This proposal should compliment/augment the proposed 3.0 implementation of `Silk.Net.Maths`, matching `System.Numerics` where possible, with concessions for design oversights in that api. +- This proposal assumes no knowledge of the 2.x Math library. +- Text herein marked **INFORMATIVE** does not form a normative part of this proposal, and is for background only. +- Within this proposal, the key words **must**, **required**, **shall**, **should**, **recommended**, **may**, **could**, and **optional** are to be interpreted as described in [RFC 2119 - Key words for use in RFCs to Indicate Requirement Levels](https://www.ietf.org/rfc/rfc2119.txt). The additional key word **optionally** is an alternate form of **optional**, for use where grammatically appropriate. These key words are highlighted in the proposal for clarity. + + + +# Proposed API + +## Angle + +* `IParsable`, `ISpanParsable`, `IUtf8SpanParsable` + * must parse angle in degrees using `IParsable`, `ISpanParsable`, `IUtf8SpanParsable` + * optional handle `°` character + +* `IFormattable`, `IUtf8SpanFormattable` + * must produce text in degrees with default format of 2 decimal places. i.e. format string `0.##` + * optional include `°` character. i.e. format string `0.##°` + +Interface implementations not included for brevity. + +```csharp +/// +/// Represents a unit independant angle using a floating-point +/// internal representation. +/// +public readonly struct Angle + : IEquatable> + , IEqualityOperators,Angle, bool> + , IComparable> + , IComparisonOperators,Angle, bool> + , IAdditionOperators,Angle,Angle> + , IDivisionOperators, TScalar, Angle> + , IDivisionOperators, Angle> + , IMultiplyOperators, TScalar, Angle> + , IMultiplyOperators, Angle> + , IModulusOperators, Angle, Angle> + , ISubtractionOperators,Angle,Angle> + , IParsable> + , ISpanParsable> + , IUtf8SpanParsable> + , IFormattable + , IUtf8SpanFormattable + where TScalar : IFloatingPointIeee754 +{ + internal Angle(TScalar radians) { } + + /// Angle in degrees in the range [0, 360]. Without fractional component. + public TScalar Degrees { get; } + + /// Angle in degrees in the range [0, 360]. With fractional component. + public TScalar TotalDegrees { get; } + + /// Angle in radians in range [π, -π]. + public TScalar Radians { get; } + + /// Angle in radians in range [0, 2π]. + public TScalar PositiveRadians { get; } + + /// Gets or sets the minutes component of the degrees this Silk.NET.Maths.Angle represents. + public TScalar Minutes { get; } + + /// Gets or sets the seconds of the degrees this Silk.NET.Maths.Angle represents. + public TScalar Seconds { get; } + + + /// + /// Gets a System.Boolean that determines whether this Silk.NET.Maths.Angle + /// is a right angle (i.e. 90° or π/2). + /// + public bool IsRight { get; } + + /// + /// Gets a System.Boolean that determines whether this Silk.NET.Maths.Angle + /// is a straight angle (i.e. 180° or π). + /// + public bool IsStraight { get; } + + /// + /// Gets a System.Boolean that determines whether this Silk.NET.Maths.Angle + /// is a full rotation angle (i.e. 360° or 2π). + /// + public bool IsFullRotation { get; } + + /// + /// Gets a System.Boolean that determines whether this Silk.NET.Maths.Angle + /// is an oblique angle (i.e. is not 90° or a multiple of 90°). + /// + public bool IsOblique { get; } + + /// + /// Gets a System.Boolean that determines whether this Silk.NET.Maths.Angle + /// is an acute angle (i.e. less than 90° but greater than 0°). + /// + public bool IsAcute { get; } + + /// + /// Gets a System.Boolean that determines whether this Silk.NET.Maths.Angle + /// is an obtuse angle (i.e. greater than 90° but less than 180°). + /// + public bool IsObtuse { get; } + + /// + /// Gets a System.Boolean that determines whether this Silk.NET.Maths.Angle + /// is a reflex angle (i.e. greater than 180° but less than 360°). + /// + public bool IsReflex { get; } + + /// + /// Gets a Silk.NET.Maths.Angle instance that complements this angle (i.e. the two angles add to 90°). + /// + public Angle Complement { get; } + + /// + /// Gets a Silk.NET.Maths.Angle instance that supplements this angle (i.e. the two angles add to 180°). + /// + public Angle Supplement { get; } + + /// Implicit cast in radians + public static implicit operator TScalar(Angle angle) => default; +} + +``` + + + +```csharp + +public static class Angle +{ + public static Angle FromRadians(TScalar radians) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle FromDegrees(TScalar degrees) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle FromDegrees(TScalar degrees, TScalar minutes, TScalar seconds) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Min(Angle left, Angle right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Max(Angle left, Angle right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Add(Angle left, Angle right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Subtract(Angle left, Angle right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Multiply(Angle left, TScalar right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Divide(Angle left, TScalar right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Clamp(Angle value, Angle min, Angle max) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Atan2(TScalar y, TScalar x) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle ArcTan(TScalar y, TScalar x) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle ArcSin(TScalar sin) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle ArcCos(TScalar cos) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Between(in Vector2F left, in Vector2F right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle Between(in Vector3F left, in Vector3F right) + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle ZeroAngle() + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle RightAngle() + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle StraightAngle() + where TScalar : IFloatingPointIeee754 + => default; + + public static Angle FullRotationAngle() + where TScalar : IFloatingPointIeee754 + => default; +} +``` + +# Meeting Agenda/Notes +## TDB +* Degrees, minutes and seconds are not fractional. Should they be changed to an integer type (`int`)? + * ```csharp + public int Degrees { get; } + public int Minutes { get; } + public int Seconds { get; } + + public static Angle FromDegrees(int degrees, int minutes, int seconds) + where TScalar : IFloatingPointIeee754 + => default; + ``` \ No newline at end of file diff --git a/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Collision.md b/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Collision.md new file mode 100644 index 0000000000..a5d2f094d5 --- /dev/null +++ b/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Collision.md @@ -0,0 +1,280 @@ +# Summary +Proposal API for additional math types to bring it up to feature parity with other popular math libraries i.e. `SlimDX`, `SharpDX`, or `Stride3D`. Leveraging modern .NET features such as `INumber` and vectorization. + +DirectX and other APIs include "collision shapes" that can be used for such things as culling. This proposal covers the addition of similar "Bounding{Shape}" types and their corresponding containment and intersection test. + +# Contributors +- Daniel Keenan (dfkeenan) + +# Current Status +- [x] Proposed +- [ ] Discussed with API Review Board (ARB) +- [ ] Approved +- [ ] Implemented + +# Design Decisions +- This proposal should compliment/augment the proposed 3.0 implementation of `Silk.Net.Maths`, matching `System.Numerics` where possible, with concessions for design oversights in that api. +- This proposal assumes no knowledge of the 2.x Math library. +- Text herein marked **INFORMATIVE** does not form a normative part of this proposal, and is for background only. +- Within this proposal, the key words **must**, **required**, **shall**, **should**, **recommended**, **may**, **could**, and **optional** are to be interpreted as described in [RFC 2119 - Key words for use in RFCs to Indicate Requirement Levels](https://www.ietf.org/rfc/rfc2119.txt). The additional key word **optionally** is an alternate form of **optional**, for use where grammatically appropriate. These key words are highlighted in the proposal for clarity. + +# **INFORMATIVE** Integer and Floating Point Types +While investigating the use of generic math it was decided to provide both an integer and floating point variant for each vector type and every type built from them. See [Generic Math](Proposal%20-%20Generic%20Math.md) proposal for more details. + +# I types versus F Types +Where it is appropriate for a type in this proposal to have both integer and floating point variants they will have a name that ends in I or F, defining whether it is an integer type or floating point type. Integer types **must** use a generic type argument `T` with the constraint of `IBinaryInteger`. On the other hand, floating point types **must** use a generic type argument `T` with the constraint of `IFloatingPointIeee754`. + +# Proposed API + +`Silk.NET.Math` and the generic math proposal for 3.0 already contain "geometric types" that would be suitable to use for collision/intersection types. i.e. Box3F. + +This proposal is to add additional APIs for the purpose of intersection tests. + +### PlaneIntersectionType + +```csharp + public enum PlaneIntersectionType + { + Back, + Front, + Intersecting, + } +``` + +### ContainmentType +```csharp +public enum ContainmentType +{ + Disjoint, + Contains, + Intersects, +} +``` + +### IIntersectWithRay +```csharp +public interface IIntersectWithRay + where TScalar : IFloatingPointIeee754 +{ + public bool Intersects(ref readonly Ray3F ray); + + public static abstract bool Intersects(ref readonly TSelf shape, ref readonly Ray3F ray); + + public bool Intersects(ref readonly Ray3F ray, out float distance); + + public static abstract bool Intersects(ref readonly TSelf shape, ref readonly Ray3F ray, out float distance); + + public bool Intersects(ref readonly Ray3F ray, out Vector3F point); + + public static abstract bool Intersects(ref readonly TSelf shape, ref readonly Ray3F ray, out Vector3F point); +} +``` + +### IIntersectWithPlane +```csharp +public interface IIntersectWithPlane + where TScalar : IFloatingPointIeee754 +{ + + public PlaneIntersectionType Intersects(ref readonly PlaneF plane); + public static abstract PlaneIntersectionType Intersects(ref readonly TSelf shape, ref readonly PlaneF plane); +} +``` + +### IIntersect +```csharp +public interface IIntersect +{ + public bool Intersects(ref readonly TOther other); + + public static abstract bool Intersects(ref readonly TSelf shape, ref readonly TOther other); +} +``` + +### IContainPoint +```csharp +public interface IContainPoint + where TScalar : IFloatingPointIeee754 +{ + + public ContainmentType Contains(ref readonly Vector3F point); + + public static abstract ContainmentType Contains(ref readonly TSelf shape, ref readonly Vector3F point); + + public ContainmentType Contains(ref readonly Vector3F vertex1, ref readonly Vector3F vertex2, ref readonly Vector3F vertex3); + + public static abstract ContainmentType Contains(ref readonly TSelf shape, ref readonly Vector3F vertex1, ref readonly Vector3F vertex2, ref readonly Vector3F vertex3); +} +``` + +### IContain +```csharp +public interface IContain +{ + public ContainmentType Contains(ref readonly TOther other); + + public static abstract ContainmentType Contains(ref readonly TSelf shape, ref readonly TOther other); +} +``` + +### IColliderShape +```csharp +public interface IColliderShape + where TScalar : IFloatingPointIeee754 +{ + public static abstract TSelf Empty { get; } + + public static abstract void FromPoints(ReadOnlySpan> points, out TSelf result); + public static abstract TSelf FromPoints(ReadOnlySpan> points); + + public static abstract void Merge(ref readonly TSelf value1, ref readonly TSelf value2, out TSelf result); + + public static abstract TSelf Merge(TSelf value1, TSelf value2); + + public static abstract void Transform(ref readonly TSelf value, ref readonly Matrix4x4F transform); + public static abstract void Transform(ref readonly TSelf value, ref readonly Matrix4x4F transform, out TSelf result); +} +``` + +### BoxF + +Additional interfaces/members for BoxF. Interface implementations not included for brevity. + +```csharp +public struct BoxF + : IIntersectWithRay, TScalar> + , IIntersectWithPlane, TScalar> + , IColliderShape, TScalar> + , IContainPoint, TScalar> + , IIntersect, BoxF> + //Implement IIntersect for other shapes + , IContain, BoxF> + //Implement IContain for other shapes + where TScalar: IBinaryFloatingPointIeee754 +{ + +} +``` + +### SphereF + +Additional interfaces/members for SphereF. Interface implementations not included for brevity. + +```csharp +public struct SphereF + , IIntersectWithRay, TScalar> + , IIntersectWithPlane, TScalar> + , IColliderShape, TScalar> + , IContainPoint, TScalar> + , IIntersect, SphereF> + //Implement IIntersect for other shapes + , IContain, SphereF> + //Implement IContain for other shapes + , IFormattable + where TScalar : IBinaryFloatingPointIeee754 +{ + +} +``` + +### BoxExtentF + +Access aligned box for fast frustum culling. Interface implementations not included for brevity. + +* Must include the same members as mentioned in the Generic Math proposal in the `Geometric Types` section + +```csharp +public struct BoxExtentF + : IEquatable> + , IEqualityOperators, BoxExtentF, bool> + , IIntersectWithRay, TScalar> + , IIntersectWithPlane, TScalar> + , IColliderShape, TScalar> + , IContainPoint, TScalar> + , IIntersect, BoxExtentF> + //Implement IIntersect for other shapes + , IContain, BoxExtentF> + //Implement IContain for other shapes + , IFormattable + where TScalar : IBinaryFloatingPointIeee754 +{ + public Vector3F Center; + public Vector3F Extents; + + public BoxExtentF(BoxF box); + public BoxExtentF(Vector3F minimum, Vector3F maximum); + + public static explicit operator BoxF(BoxExtentF boxExtent); + public static explicit operator BoxExtentF(BoxF box) +} + +``` + +### OrientedBoxF + +Box with orientation. Interface implementations not included for brevity. + +* Must include the same members as mentioned in the Generic Math proposal in the `Geometric Types` section + +```csharp +public struct OrientedBoxF + : IEquatable> + , IEqualityOperators, OrientedBoxF, bool> + , IIntersectWithRay, TScalar> + , IIntersectWithPlane, TScalar> + , IColliderShape, TScalar> + , IContainPoint, TScalar> + , IIntersect, OrientedBoxF> + //Implement IIntersect for other shapes + , IContain, OrientedBoxF> + //Implement IContain for other shapes + , IFormattable + where TScalar : IBinaryFloatingPointIeee754 +{ + public Vector3F Center; + public Vector3F Extents; + public Quaternion Orientation; + + public OrientedBoxF(Vector3F center, Vector3F extents, Quaternion orientation); +} +``` + +### FrustumF + +Frustum + +```csharp +public struct FrustumF + , IIntersectWithRay, TScalar> + , IIntersectWithPlane, TScalar> + , IColliderShape, TScalar> + , IContainPoint, TScalar> + , IIntersect, FrustumF> + //Implement IIntersect for other shapes + , IContain, FrustumF> + //Implement IContain for other shapes + , IFormattable + , IEquatable> + where TScalar : IBinaryFloatingPointIeee754 +{ + public PlaneF LeftPlane; + public PlaneF RightPlane; + public PlaneF TopPlane; + public PlaneF BottomPlane; + public PlaneF NearPlane; + public PlaneF FarPlane; +} + +``` + +```csharp +public static class Frustum +{ + public static FrustumF FromMatrix(Matrix4x4F) + where TScalar : IBinaryFloatingPointIeee754 + => default; +} + +``` + +# Meeting Agenda/Notes \ No newline at end of file diff --git a/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Color.md b/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Color.md new file mode 100644 index 0000000000..9a7e115ebd --- /dev/null +++ b/documentation/proposals/(WIP) Proposal - 3.0 Additional math types - Color.md @@ -0,0 +1,2847 @@ +# Summary +Proposal API for additional math types to bring it up to feature parity with other popular math libraries i.e. `SlimDX`, `SharpDX`, or `Stride3D`. Leveraging modern .NET features such as `INumber` and vectorization. + +This proposal is regarding color type structs. + +# Contributors +- Daniel Keenan (dfkeenan) + +# Current Status +- [x] Proposed +- [ ] Discussed with API Review Board (ARB) +- [ ] Approved +- [ ] Implemented + +# Design Decisions +- This proposal should compliment/augment the proposed 3.0 implementation of `Silk.Net.Maths`, matching `System.Numerics` where possible, with concessions for design oversights in that api. +- This proposal assumes no knowledge of the 2.x Math library. +- Text herein marked **INFORMATIVE** does not form a normative part of this proposal, and is for background only. +- Within this proposal, the key words **must**, **required**, **shall**, **should**, **recommended**, **may**, **could**, and **optional** are to be interpreted as described in [RFC 2119 - Key words for use in RFCs to Indicate Requirement Levels](https://www.ietf.org/rfc/rfc2119.txt). The additional key word **optionally** is an alternate form of **optional**, for use where grammatically appropriate. These key words are highlighted in the proposal for clarity. + +# **INFORMATIVE** Integer and Floating Point Types +While investigating the use of generic math it was decided to provide both an integer and floating point variant for each vector type and every type built from them. See [Generic Math](Proposal%20-%20Generic%20Math.md) proposal for more details. + +# I types versus F Types +Where it is appropriate for a type in this proposal to have both integer and floating point variants they will have a name that ends in I or F, defining whether it is an integer type or floating point type. Integer types **must** use a generic type argument `T` with the constraint of `IBinaryInteger`. On the other hand, floating point types **must** use a generic type argument `T` with the constraint of `IFloatingPointIeee754`. + +# Proposed API + +### Color + +```csharp + [StructLayout(LayoutKind.Sequential, Size = 4)] + public partial struct Color : IEquatable + { + public byte R; + public byte G; + public byte B; + public byte A; + + /// + /// Initializes a new instance of the struct. + /// + /// The value that will be assigned to all components. + public Color(byte value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The value that will be assigned to all components. + public Color(float value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + /// The alpha component of the color. + public Color(byte red, byte green, byte blue, byte alpha) + { + } + + /// + /// Initializes a new instance of the struct. Alpha is set to 255. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + public Color(byte red, byte green, byte blue) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + /// The alpha component of the color. + public Color(float red, float green, float blue, float alpha) + { + } + + /// + /// Initializes a new instance of the struct. Alpha is set to 255. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + public Color(float red, float green, float blue) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red, green, blue, and alpha components of the color. + public Color(Vector4F value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red, green, and blue components of the color. + /// The alpha component of the color. + public Color(Vector3F value, float alpha) + { + } + + /// + /// Initializes a new instance of the struct. Alpha is set to 255. + /// + /// The red, green, and blue components of the color. + public Color(Vector3F value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed integer containing all four color components in RGBA order. + public Color(uint rgba) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed integer containing all four color components in RGBA order. + public Color(int rgba) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The values to assign to the red, green, and blue, alpha components of the color. This must be an array with four elements. + /// Thrown when is null. + /// Thrown when contains more or less than four elements. + public Color(float[] values) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The values to assign to the red, green, blue, or alpha components of the color. This must be an array with four elements. + /// Thrown when is null. + /// Thrown when contains more or less than four elements. + public Color(byte[] values) + { + } + + /// + /// Gets or sets the component at the specified index. + /// + /// The value of the red, green, blue, or alpha component, depending on the index. + /// The index of the component to access. Use 0 for the red(R) component, 1 for the green(G) component, 2 for the blue(B) component, and 3 for the alpha(A) component. + /// The value of the component at the specified index. + /// Thrown when the is out of the range [0, 3]. + public byte this[int index] { get; set; } + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToBgra() + => default; + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToRgba() + => default; + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToArgb() + => default; + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToAbgr() + => default; + + /// + /// Converts the color into a three component vector. + /// + /// A three component vector containing the red, green, and blue components of the color. + public Vector3F ToVector3() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Converts the color into a three component color. + /// + /// A three component color containing the red, green, and blue components of the color. + public Color3 ToColor3() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Converts the color into a four component vector. + /// + /// A four component vector containing all four color components. + public Vector4F ToVector4() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Creates an array containing the elements of the color. + /// + /// A four-element array containing the components of the color in RGBA order. + public byte[] ToArray() + => default; + + /// + /// Gets the brightness. + /// + /// The Hue-Saturation-Brightness (HSB) saturation for this + public float GetBrightness() + => default; + + /// + /// Gets the hue. + /// + /// The Hue-Saturation-Brightness (HSB) saturation for this + public float GetHue() + => default; + + /// + /// Gets the saturation. + /// + /// The Hue-Saturation-Brightness (HSB) saturation for this + public float GetSaturation() + => default; + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// When the method completes, completes the sum of the two colors. + public static void Add(ref readonly Color left, ref readonly Color right, out Color result) + { + } + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static Color Add(Color left, Color right) + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// WHen the method completes, contains the difference of the two colors. + public static void Subtract(ref readonly Color left, ref readonly Color right, out Color result) + { + } + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract + /// The difference of the two colors. + public static Color Subtract(Color left, Color right) + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// When the method completes, contains the modulated color. + public static void Modulate(ref readonly Color left, ref readonly Color right, out Color result) + { + } + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static Color Modulate(Color left, Color right) + => default; + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// When the method completes, contains the scaled color. + public static void Scale(ref readonly Color value, float scale, out Color result) + { + } + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// The scaled color. + public static Color Scale(Color value, float scale) + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// When the method completes, contains the negated color. + public static void Negate(ref readonly Color value, out Color result) + { + } + + /// + /// Negates a color. + /// + /// The color to negate. + /// The negated color. + public static Color Negate(Color value) + => default; + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// When the method completes, contains the clamped value. + public static void Clamp(ref readonly Color value, ref readonly Color min, ref readonly Color max, out Color result) + { + } + + /// + /// Converts the color from a packed BGRA integer. + /// + /// A packed integer containing all four color components in BGRA order + /// A color. + public static Color FromBgra(int color) + => default; + + /// + /// Converts the color from a packed BGRA integer. + /// + /// A packed integer containing all four color components in BGRA order + /// A color. + public static Color FromBgra(uint color) + => default; + + /// + /// Converts the color from a packed ABGR integer. + /// + /// A packed integer containing all four color components in ABGR order + /// A color. + public static Color FromAbgr(int color) + => default; + + /// + /// Converts the color from a packed ABGR integer. + /// + /// A packed integer containing all four color components in ABGR order + /// A color. + public static Color FromAbgr(uint color) + => default; + + /// + /// Converts the color from a packed RGBA integer. + /// + /// A packed integer containing all four color components in RGBA order + /// A color. + public static Color FromRgba(int color) + => default; + + /// + /// Converts the color from a packed RGBA integer. + /// + /// A packed integer containing all four color components in RGBA order + /// A color. + public static Color FromRgba(uint color) + => default; + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// The clamped value. + public static Color Clamp(Color value, Color min, Color max) + => default; + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the linear interpolation of the two colors. + /// + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static void Lerp(ref readonly Color start, ref readonly Color end, float amount, out Color result) + { + } + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The linear interpolation of the two colors. + /// + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static Color Lerp(Color start, Color end, float amount) + => default; + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the cubic interpolation of the two colors. + public static void SmoothStep(ref readonly Color start, ref readonly Color end, float amount, out Color result) + { + } + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The cubic interpolation of the two colors. + public static Color SmoothStep(Color start, Color end, float amount) + => default; + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the largest components of the source colors. + public static void Max(ref readonly Color left, ref readonly Color right, out Color result) + { + } + + /// + /// Returns a color containing the largest components of the specified colorss. + /// + /// The first source color. + /// The second source color. + /// A color containing the largest components of the source colors. + public static Color Max(Color left, Color right) + => default; + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the smallest components of the source colors. + public static void Min(ref readonly Color left, ref readonly Color right, out Color result) + { + } + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// A color containing the smallest components of the source colors. + public static Color Min(Color left, Color right) + => default; + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// When the method completes, contains the adjusted color. + public static void AdjustContrast(ref readonly Color value, float contrast, out Color result) + { + } + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// The adjusted color. + public static Color AdjustContrast(Color value, float contrast) + => default; + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// When the method completes, contains the adjusted color. + public static void AdjustSaturation(ref readonly Color value, float saturation, out Color result) + { + } + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// The adjusted color. + public static Color AdjustSaturation(Color value, float saturation) + => default; + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static Color operator +(Color left, Color right) + => default; + + /// + /// Assert a color (return it unchanged). + /// + /// The color to assert (unchanged). + /// The asserted (unchanged) color. + public static Color operator +(Color value) + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// The difference of the two colors. + public static Color operator -(Color left, Color right) + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// A negated color. + public static Color operator -(Color value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static Color operator *(float scale, Color value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static Color operator *(Color value, float scale) + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static Color operator *(Color left, Color right) + => default; + + /// + /// Tests for equality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has the same value as ; otherwise, false. + public static bool operator ==(Color left, Color right) + => default; + + /// + /// Tests for inequality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has a different value than ; otherwise, false. + public static bool operator !=(Color left, Color right) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color3(Color value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Vector3F(Color value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Vector4F(Color value) + => default; + + /// + /// Convert this instance to a + /// + /// The result of the conversion. + public Color4 ToColor4() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Performs an implicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static implicit operator Color4(Color value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color(Vector3F value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color(Color3 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color(Vector4F value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color(Color4 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// + /// The result of the conversion. + /// + public static explicit operator int (Color value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// + /// The result of the conversion. + /// + public static explicit operator Color(int value) + => default; + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + => default; + + /// + /// Returns a hash code for this instance. + /// + /// + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// + public override int GetHashCode() + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public bool Equals(Color other) + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public override bool Equals(object value) + => default; + + } +``` +### ColorBGRA + +```csharp + [StructLayout(LayoutKind.Sequential, Size = 4)] + public partial struct ColorBGRA : IEquatable, IFormattable + { + public byte B; + public byte G; + public byte R; + public byte A; + + /// + /// Initializes a new instance of the struct. + /// + /// The value that will be assigned to all components. + public ColorBGRA(byte value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The value that will be assigned to all components. + public ColorBGRA(float value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + /// The alpha component of the color. + public ColorBGRA(byte red, byte green, byte blue, byte alpha) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + /// The alpha component of the color. + public ColorBGRA(float red, float green, float blue, float alpha) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red, green, blue, and alpha components of the color. + public ColorBGRA(Vector4F value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red, green, and blue components of the color. + /// The alpha component of the color. + public ColorBGRA(Vector3F value, float alpha) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed integer containing all four color components in BGRA order. + public ColorBGRA(uint bgra) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed integer containing all four color components in BGRA. + public ColorBGRA(int bgra) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The values to assign to the red, green, and blue, alpha components of the color. This must be an array with four elements. + /// Thrown when is null. + /// Thrown when contains more or less than four elements. + public ColorBGRA(float[] values) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The values to assign to the red, green, and blue, alpha components of the color. This must be an array with four elements. + /// Thrown when is null. + /// Thrown when contains more or less than four elements. + public ColorBGRA(byte[] values) + { + } + + /// + /// Gets or sets the component at the specified index. + /// + /// The value of the alpha, red, green, or blue component, depending on the 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. + /// The value of the component at the specified index. + /// Thrown when the is out of the range [0, 3]. + public byte this[int index] { get; set; } + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToBgra() + => default; + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToRgba() + => default; + + /// + /// Converts the color into a three component vector. + /// + /// A three component vector containing the red, green, and blue components of the color. + public Vector3F ToVector3() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Converts the color into a three component color. + /// + /// A three component color containing the red, green, and blue components of the color. + public Color3 ToColor3() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Converts the color into a four component vector. + /// + /// A four component vector containing all four color components. + public Vector4F ToVector4() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Creates an array containing the elements of the color. + /// + /// A four-element array containing the components of the color in BGRA order. + public byte[] ToArray() + => default; + + /// + /// Gets the brightness. + /// + /// The Hue-Saturation-Brightness (HSB) saturation for this + public float GetBrightness() + => default; + + /// + /// Gets the hue. + /// + /// The Hue-Saturation-Brightness (HSB) saturation for this + public float GetHue() + => default; + + /// + /// Gets the saturation. + /// + /// The Hue-Saturation-Brightness (HSB) saturation for this + public float GetSaturation() + => default; + + /// + /// Converts the color from a packed BGRA integer. + /// + /// A packed integer containing all four color components in BGRA order + /// A color. + public static ColorBGRA FromBgra(int color) + => default; + + /// + /// Converts the color from a packed BGRA integer. + /// + /// A packed integer containing all four color components in BGRA order + /// A color. + public static ColorBGRA FromBgra(uint color) + => default; + + /// + /// Converts the color from a packed RGBA integer. + /// + /// A packed integer containing all four color components in RGBA order + /// A color. + public static ColorBGRA FromRgba(int color) + => default; + + /// + /// Converts the color from a packed RGBA integer. + /// + /// A packed integer containing all four color components in RGBA order + /// A color. + public static ColorBGRA FromRgba(uint color) + => default; + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// When the method completes, completes the sum of the two colors. + public static void Add(ref readonly ColorBGRA left, ref readonly ColorBGRA right, out ColorBGRA result) + { + } + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static ColorBGRA Add(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// WHen the method completes, contains the difference of the two colors. + public static void Subtract(ref readonly ColorBGRA left, ref readonly ColorBGRA right, out ColorBGRA result) + { + } + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract + /// The difference of the two colors. + public static ColorBGRA Subtract(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// When the method completes, contains the modulated color. + public static void Modulate(ref readonly ColorBGRA left, ref readonly ColorBGRA right, out ColorBGRA result) + { + } + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static ColorBGRA Modulate(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// When the method completes, contains the scaled color. + public static void Scale(ref readonly ColorBGRA value, float scale, out ColorBGRA result) + { + } + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// The scaled color. + public static ColorBGRA Scale(ColorBGRA value, float scale) + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// When the method completes, contains the negated color. + public static void Negate(ref readonly ColorBGRA value, out ColorBGRA result) + { + } + + /// + /// Negates a color. + /// + /// The color to negate. + /// The negated color. + public static ColorBGRA Negate(ColorBGRA value) + => default; + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// When the method completes, contains the clamped value. + public static void Clamp(ref readonly ColorBGRA value, ref readonly ColorBGRA min, ref readonly ColorBGRA max, out ColorBGRA result) + { + } + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// The clamped value. + public static ColorBGRA Clamp(ColorBGRA value, ColorBGRA min, ColorBGRA max) + => default; + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the linear interpolation of the two colors. + /// + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static void Lerp(ref readonly ColorBGRA start, ref readonly ColorBGRA end, float amount, out ColorBGRA result) + { + } + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The linear interpolation of the two colors. + /// + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static ColorBGRA Lerp(ColorBGRA start, ColorBGRA end, float amount) + => default; + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the cubic interpolation of the two colors. + public static void SmoothStep(ref readonly ColorBGRA start, ref readonly ColorBGRA end, float amount, out ColorBGRA result) + { + } + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The cubic interpolation of the two colors. + public static ColorBGRA SmoothStep(ColorBGRA start, ColorBGRA end, float amount) + => default; + + /// + /// Returns a color containing the smallest components of the specified colorss. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the largest components of the source colorss. + public static void Max(ref readonly ColorBGRA left, ref readonly ColorBGRA right, out ColorBGRA result) + { + } + + /// + /// Returns a color containing the largest components of the specified colorss. + /// + /// The first source color. + /// The second source color. + /// A color containing the largest components of the source colors. + public static ColorBGRA Max(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the smallest components of the source colors. + public static void Min(ref readonly ColorBGRA left, ref readonly ColorBGRA right, out ColorBGRA result) + { + } + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// A color containing the smallest components of the source colors. + public static ColorBGRA Min(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// When the method completes, contains the adjusted color. + public static void AdjustContrast(ref readonly ColorBGRA value, float contrast, out ColorBGRA result) + { + } + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// The adjusted color. + public static ColorBGRA AdjustContrast(ColorBGRA value, float contrast) + => default; + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// When the method completes, contains the adjusted color. + public static void AdjustSaturation(ref readonly ColorBGRA value, float saturation, out ColorBGRA result) + { + } + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// The adjusted color. + public static ColorBGRA AdjustSaturation(ColorBGRA value, float saturation) + => default; + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static ColorBGRA operator +(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Assert a color (return it unchanged). + /// + /// The color to assert (unchange). + /// The asserted (unchanged) color. + public static ColorBGRA operator +(ColorBGRA value) + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// The difference of the two colors. + public static ColorBGRA operator -(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// A negated color. + public static ColorBGRA operator -(ColorBGRA value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static ColorBGRA operator *(float scale, ColorBGRA value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static ColorBGRA operator *(ColorBGRA value, float scale) + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static ColorBGRA operator *(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Tests for equality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has the same value as ; otherwise, false. + public static bool operator ==(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Tests for inequality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has a different value than ; otherwise, false. + public static bool operator !=(ColorBGRA left, ColorBGRA right) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color3(ColorBGRA value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Vector3F(ColorBGRA value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Vector4F(ColorBGRA value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color4(ColorBGRA value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ColorBGRA(Vector3F value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ColorBGRA(Color3 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ColorBGRA(Vector4F value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ColorBGRA(Color4 value) + => default; + + /// + /// Performs an implicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static implicit operator ColorBGRA(Color value) + => default; + + /// + /// Performs an implicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static implicit operator Color(ColorBGRA value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// + /// The result of the conversion. + /// + public static explicit operator int (ColorBGRA value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// + /// The result of the conversion. + /// + public static explicit operator ColorBGRA(int value) + => default; + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format to apply to each channel (byte). + /// + /// A that represents this instance. + /// + public string ToString(string format) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(IFormatProvider formatProvider) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format to apply to each channel (byte). + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(string format, IFormatProvider formatProvider) + => default; + + /// + /// Returns a hash code for this instance. + /// + /// + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// + public override int GetHashCode() + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public bool Equals(ColorBGRA other) + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public override bool Equals(object value) + => default; + + /// + /// Deconstructs the vector's components into named variables. + /// + /// The R component + /// The G component + /// The B component + /// The A component + public void Deconstruct(out byte r, out byte g, out byte b, out byte a) + { + } + + } +``` +### ColorHSV + +```csharp + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct ColorHSV : IEquatable, IFormattable + { + public float H; + public float S; + public float V; + public float A; + + /// + /// Initializes a new instance of the struct. + /// + /// The h. + /// The s. + /// The v. + /// A. + public ColorHSV(float h, float s, float v, float a) + { + } + + /// + /// Converts the color into a three component vector. + /// + /// A three component vector containing the red, green, and blue components of the color. + public Color4 ToColor() + where TScalar : IFloatingPointIeee754 + => default; + + /// + public bool Equals(ColorHSV other) + => default; + + /// + public override bool Equals(object obj) + => default; + + /// + public override int GetHashCode() + => default; + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format. + /// + /// A that represents this instance. + /// + public string ToString(string format) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(IFormatProvider formatProvider) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format. + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(string format, IFormatProvider formatProvider) + => default; + + /// + /// Deconstructs the vector's components into named variables. + /// + /// The H component + /// The S component + /// The V component + /// The A component + public void Deconstruct(out float h, out float s, out float v, out float a) + { + } + + } +``` +### Color3 +```csharp + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct Color3 : IEquatable>, IFormattable where TScalar : IFloatingPointIeee754 + { + public TScalar R; + public TScalar G; + public TScalar B; + + /// + /// Initializes a new instance of the struct. + /// + /// The value that will be assigned to all components. + public Color3(TScalar value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + public Color3(TScalar red, TScalar green, TScalar blue) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red, green, and blue components of the color. + public Color3(Vector3F value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed integer containing all three color components. + /// The alpha component is ignored. + public Color3(int rgb) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed unsigned integer containing all three color components. + /// The alpha component is ignored. + public Color3(uint rgb) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The values to assign to the red, green, and blue components of the color. This must be an array with three elements. + /// Thrown when is null. + /// Thrown when contains more or less than four elements. + public Color3(TScalar[] values) + { + } + + /// + /// Gets or sets the component at the specified index. + /// + /// The value of the red, green, or blue component, depending on the index. + /// The index of the component to access. Use 0 for the red component, 1 for the green component, and 2 for the blue component. + /// The value of the component at the specified index. + /// Thrown when the is out of the range [0, 2]. + public TScalar this[int index] { get; set; } + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all three color components. + /// The alpha channel is set to 255. + public int ToRgb() + => default; + + /// + /// Raises the exponent for each components. + /// + /// The exponent. + public void Pow(TScalar exponent) + { + } + + /// + /// Converts the color into a three component vector. + /// + /// A three component vector containing the red, green, and blue components of the color. + public Vector3F ToVector3() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Creates an array containing the elements of the color. + /// + /// A three-element array containing the components of the color. + public TScalar[] ToArray() + => default; + + /// + /// Converts this color from linear space to sRGB space. + /// + /// A color3 in sRGB space. + public Color3 ToSRgb() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Converts this color from sRGB space to linear space. + /// + /// Color3. + public Color3 ToLinear() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static Color3 operator +(Color3 left, Color3 right) + => default; + + /// + /// Assert a color (return it unchanged). + /// + /// The color to assert (unchange). + /// The asserted (unchanged) color. + public static Color3 operator +(Color3 value) + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// The difference of the two colors. + public static Color3 operator -(Color3 left, Color3 right) + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// A negated color. + public static Color3 operator -(Color3 value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static Color3 operator *(TScalar scale, Color3 value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static Color3 operator *(Color3 value, TScalar scale) + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static Color3 operator *(Color3 left, Color3 right) + => default; + + /// + /// Tests for equality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has the same value as ; otherwise, false. + public static bool operator ==(Color3 left, Color3 right) + => default; + + /// + /// Tests for inequality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has a different value than ; otherwise, false. + public static bool operator !=(Color3 left, Color3 right) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color4(Color3 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Vector3F(Color3 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color3(Vector3F value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color3(int value) + => default; + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + => default; + + /// + /// Convert this color to an equivalent with an opaque alpha. + /// + /// An equivalent with an opaque alpha. + public Color4 ToColor4() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format. + /// + /// A that represents this instance. + /// + public string ToString(string format) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(IFormatProvider formatProvider) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format. + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(string format, IFormatProvider formatProvider) + => default; + + /// + /// Returns a hash code for this instance. + /// + /// + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// + public override int GetHashCode() + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public bool Equals(Color3 other) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public override bool Equals(object value) + => default; + + /// + /// Deconstructs the vector's components into named variables. + /// + /// The R component + /// The G component + /// The B component + public void Deconstruct(out TScalar r, out TScalar g, out TScalar b) + { + } + + } +``` +```csharp + public static class Color3 + { + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// When the method completes, completes the sum of the two colors. + public static void Add(ref readonly Color3 left, ref readonly Color3 right, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static Color3 Add(Color3 left, Color3 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// WHen the method completes, contains the difference of the two colors. + public static void Subtract(ref readonly Color3 left, ref readonly Color3 right, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract + /// The difference of the two colors. + public static Color3 Subtract(Color3 left, Color3 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// When the method completes, contains the modulated color. + public static void Modulate(ref readonly Color3 left, ref readonly Color3 right, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static Color3 Modulate(Color3 left, Color3 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// When the method completes, contains the scaled color. + public static void Scale(ref readonly Color3 value, TScalar scale, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// The scaled color. + public static Color3 Scale(Color3 value, TScalar scale) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// When the method completes, contains the negated color. + public static void Negate(ref readonly Color3 value, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Negates a color. + /// + /// The color to negate. + /// The negated color. + public static Color3 Negate(Color3 value) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// When the method completes, contains the clamped value. + public static void Clamp(ref readonly Color3 value, ref readonly Color3 min, ref readonly Color3 max, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// The clamped value. + public static Color3 Clamp(Color3 value, Color3 min, Color3 max) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the linear interpolation of the two colors. + /// + /// This method performs the linear interpolation based on the following formula. + /// start + (end - start) * amount + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static void Lerp(ref readonly Color3 start, ref readonly Color3 end, TScalar amount, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The linear interpolation of the two colors. + /// + /// This method performs the linear interpolation based on the following formula. + /// start + (end - start) * amount + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static Color3 Lerp(Color3 start, Color3 end, TScalar amount) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the cubic interpolation of the two colors. + public static void SmoothStep(ref readonly Color3 start, ref readonly Color3 end, TScalar amount, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The cubic interpolation of the two colors. + public static Color3 SmoothStep(Color3 start, Color3 end, TScalar amount) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Returns a color containing the smallest components of the specified colorss. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the largest components of the source colorss. + public static void Max(ref readonly Color3 left, ref readonly Color3 right, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Returns a color containing the largest components of the specified colorss. + /// + /// The first source color. + /// The second source color. + /// A color containing the largest components of the source colors. + public static Color3 Max(Color3 left, Color3 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the smallest components of the source colors. + public static void Min(ref readonly Color3 left, ref readonly Color3 right, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// A color containing the smallest components of the source colors. + public static Color3 Min(Color3 left, Color3 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// When the method completes, contains the adjusted color. + public static void AdjustContrast(ref readonly Color3 value, TScalar contrast, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// The adjusted color. + public static Color3 AdjustContrast(Color3 value, TScalar contrast) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// When the method completes, contains the adjusted color. + public static void AdjustSaturation(ref readonly Color3 value, TScalar saturation, out Color3 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// The adjusted color. + public static Color3 AdjustSaturation(Color3 value, TScalar saturation) + where TScalar : IFloatingPointIeee754 + => default; + + } +``` +### Color4 +```csharp + [StructLayout(LayoutKind.Sequential, Pack = 4)] + public struct Color4 : IEquatable>, IFormattable where TScalar : IFloatingPointIeee754 + { + /// + /// The Black color (0, 0, 0, 1). + /// + public static readonly Color4 Black = new Color4(0.0f, 0.0f, 0.0f, 1.0f); + /// + /// The White color (1, 1, 1, 1). + /// + public static readonly Color4 White = new Color4(1.0f, 1.0f, 1.0f, 1.0f); + public TScalar R; + public TScalar G; + public TScalar B; + public TScalar A; + + /// + /// Initializes a new instance of the struct. + /// + /// The value that will be assigned to all components. + public Color4(TScalar value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + /// The alpha component of the color. + public Color4(TScalar red, TScalar green, TScalar blue, TScalar alpha = 1f) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red, green, blue, and alpha components of the color. + public Color4(Vector4F value) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The red, green, and blue components of the color. + /// The alpha component of the color. + public Color4(Vector3F value, TScalar alpha = 1f) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed integer containing all four color components in RGBA order. + public Color4(uint rgba) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// A packed integer containing all four color components in RGBA order. + public Color4(int rgba) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The values to assign to the red, green, blue, and alpha components of the color. This must be an array with four elements. + /// Thrown when is null. + /// Thrown when contains more or less than four elements. + public Color4(TScalar[] values) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// used to initialize the color. + public Color4(Color3 color) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// used to initialize the color. + public Color4(Color color) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// used to initialize the color. + public Color4(ColorBGRA color) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// used to initialize the color. + /// The alpha component of the color. + public Color4(Color3 color, TScalar alpha = 1f) + { + } + + /// + /// Gets or sets the component at the specified index. + /// + /// The value of the red, green, blue, and alpha components, depending on the 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. + /// The value of the component at the specified index. + /// Thrown when the is out of the range [0, 3]. + public TScalar this[int index] { get; set; } + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToBgra() + => default; + + /// + /// Converts the color into a packed integer. + /// + public void ToBgra(out byte r, out byte g, out byte b, out byte a) + { + } + + /// + /// Converts the color into a packed integer. + /// + /// A packed integer containing all four color components. + public int ToRgba() + => default; + + /// + /// Converts the color into a three component vector. + /// + /// A three component vector containing the red, green, and blue components of the color. + public Vector3F ToVector3() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Converts the color into a four component vector. + /// + /// A four component vector containing all four color components. + public Vector4F ToVector4() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Creates an array containing the elements of the color. + /// + /// A four-element array containing the components of the color. + public TScalar[] ToArray() + => default; + + /// + /// Converts this color from linear space to sRGB space. + /// + /// A color3 in sRGB space. + public Color4 ToSRgb() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Converts this color from sRGB space to linear space. + /// + /// A color4 in linear space. + public Color4 ToLinear() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static Color4 operator +(Color4 left, Color4 right) + => default; + + /// + /// Assert a color (return it unchanged). + /// + /// The color to assert (unchanged). + /// The asserted (unchanged) color. + public static Color4 operator +(Color4 value) + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// The difference of the two colors. + public static Color4 operator -(Color4 left, Color4 right) + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// A negated color. + public static Color4 operator -(Color4 value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static Color4 operator *(TScalar scale, Color4 value) + => default; + + /// + /// Scales a color. + /// + /// The factor by which to scale the color. + /// The color to scale. + /// The scaled color. + public static Color4 operator *(Color4 value, TScalar scale) + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static Color4 operator *(Color4 left, Color4 right) + => default; + + /// + /// Tests for equality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has the same value as ; otherwise, false. + public static bool operator ==(Color4 left, Color4 right) + => default; + + /// + /// Tests for inequality between two objects. + /// + /// The first value to compare. + /// The second value to compare. + /// true if has a different value than ; otherwise, false. + public static bool operator !=(Color4 left, Color4 right) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color3(Color4 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Vector3F(Color4 value) + => default; + + /// + /// Performs an implicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static implicit operator Vector4F(Color4 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color4(Vector3F value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color4(Vector4F value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator Color4(ColorBGRA value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. + public static explicit operator ColorBGRA(Color4 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// + /// The result of the conversion. + /// + public static explicit operator int (Color4 value) + => default; + + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// + /// The result of the conversion. + /// + public static explicit operator Color4(int value) + => default; + + /// + /// Converts this color to an equivalent , discarding the alpha channel. + /// + /// An equivalent , discarding the alpha channel. + public Color3 ToColor3() + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format to apply to each channel (float). + /// + /// A that represents this instance. + /// + public string ToString(string format) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(IFormatProvider formatProvider) + => default; + + /// + /// Returns a that represents this instance. + /// + /// The format to apply to each channel (float). + /// The format provider. + /// + /// A that represents this instance. + /// + public string ToString(string format, IFormatProvider formatProvider) + => default; + + /// + /// Returns a hash code for this instance. + /// + /// + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// + public override int GetHashCode() + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public bool Equals(Color4 other) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Determines whether the specified is equal to this instance. + /// + /// The to compare with this instance. + /// + /// true if the specified is equal to this instance; otherwise, false. + /// + public override bool Equals(object value) + => default; + + /// + /// Deconstructs the vector's components into named variables. + /// + /// The R component + /// The G component + /// The B component + /// The A component + public void Deconstruct(out TScalar r, out TScalar g, out TScalar b, out TScalar a) + { + } + + } +``` +```csharp + public static class Color4 + { + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// When the method completes, completes the sum of the two colors. + public static void Add(ref readonly Color4 left, ref readonly Color4 right, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Adds two colors. + /// + /// The first color to add. + /// The second color to add. + /// The sum of the two colors. + public static Color4 Add(Color4 left, Color4 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract. + /// WHen the method completes, contains the difference of the two colors. + public static void Subtract(ref readonly Color4 left, ref readonly Color4 right, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Subtracts two colors. + /// + /// The first color to subtract. + /// The second color to subtract + /// The difference of the two colors. + public static Color4 Subtract(Color4 left, Color4 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// When the method completes, contains the modulated color. + public static void Modulate(ref readonly Color4 left, ref readonly Color4 right, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Modulates two colors. + /// + /// The first color to modulate. + /// The second color to modulate. + /// The modulated color. + public static Color4 Modulate(Color4 left, Color4 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// When the method completes, contains the scaled color. + public static void Scale(ref readonly Color4 value, TScalar scale, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Scales a color. + /// + /// The color to scale. + /// The amount by which to scale. + /// The scaled color. + public static Color4 Scale(Color4 value, TScalar scale) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Negates a color. + /// + /// The color to negate. + /// When the method completes, contains the negated color. + public static void Negate(ref readonly Color4 value, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Negates a color. + /// + /// The color to negate. + /// The negated color. + public static Color4 Negate(Color4 value) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// When the method completes, contains the clamped value. + public static void Clamp(ref readonly Color4 value, ref readonly Color4 min, ref readonly Color4 max, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Restricts a value to be within a specified range. + /// + /// The value to clamp. + /// The minimum value. + /// The maximum value. + /// The clamped value. + public static Color4 Clamp(Color4 value, Color4 min, Color4 max) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the linear interpolation of the two colors. + /// + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static void Lerp(ref readonly Color4 start, ref readonly Color4 end, TScalar amount, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Performs a linear interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The linear interpolation of the two colors. + /// + /// Passing a value of 0 will cause to be returned; a value of 1 will cause to be returned. + /// + public static Color4 Lerp(Color4 start, Color4 end, TScalar amount) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// When the method completes, contains the cubic interpolation of the two colors. + public static void SmoothStep(ref readonly Color4 start, ref readonly Color4 end, TScalar amount, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Performs a cubic interpolation between two colors. + /// + /// Start color. + /// End color. + /// Value between 0 and 1 indicating the weight of . + /// The cubic interpolation of the two colors. + public static Color4 SmoothStep(Color4 start, Color4 end, TScalar amount) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the largest components of the source colors. + public static void Max(ref readonly Color4 left, ref readonly Color4 right, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Returns a color containing the largest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// A color containing the largest components of the source colors. + public static Color4 Max(Color4 left, Color4 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// When the method completes, contains an new color composed of the smallest components of the source colors. + public static void Min(ref readonly Color4 left, ref readonly Color4 right, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Returns a color containing the smallest components of the specified colors. + /// + /// The first source color. + /// The second source color. + /// A color containing the smallest components of the source colors. + public static Color4 Min(Color4 left, Color4 right) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// When the method completes, contains the adjusted color. + public static void AdjustContrast(ref readonly Color4 value, TScalar contrast, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Adjusts the contrast of a color. + /// + /// The color whose contrast is to be adjusted. + /// The amount by which to adjust the contrast. + /// The adjusted color. + public static Color4 AdjustContrast(Color4 value, TScalar contrast) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// When the method completes, contains the adjusted color. + public static void AdjustSaturation(ref readonly Color4 value, TScalar saturation, out Color4 result) + where TScalar : IFloatingPointIeee754 + { + } + + /// + /// Adjusts the saturation of a color. + /// + /// The color whose saturation is to be adjusted. + /// The amount by which to adjust the saturation. + /// The adjusted color. + public static Color4 AdjustSaturation(Color4 value, TScalar saturation) + where TScalar : IFloatingPointIeee754 + => default; + + /// + /// Premultiplies the color components by the alpha value. + /// + /// The color to premultiply. + /// A color with premultiplied alpha. + public static Color4 PremultiplyAlpha(Color4 value) + where TScalar : IFloatingPointIeee754 + => default; + + } +``` + + +# Meeting Agenda/Notes +## TBD +* Started with an initial rough cut by copying the API of Stride color types. IF we want to move forward with these we can just copy and attribute. \ No newline at end of file