Struct FRGBA
- Namespace
- RenderSharp
- Assembly
- RenderSharp.dll
A MathSharp.IVec4<TSelf, TBase, TFloat, TVFloat> of type double. Values R, G, B and A all intended to lie within the range [0, 1].
public struct FRGBA : IVec4<FRGBA, double, double, FRGBA>, IEquatable<FRGBA>, ISwizzlable<FRGBA, double>
- Implements
- Inherited Members
Constructors
FRGBA(in FRGB, double)
Constructs a new color from the given color and alpha channel.
public FRGBA(in FRGB rgbf, double a)
Parameters
rgbf
FRGBThe red, green and blue channels of the new color.
a
doubleThe alpha channel of the new vector. Intended [0, 1].
FRGBA(double, double, double, double)
Constructs a new color from the given red, green, blue and alpha channels.
public FRGBA(double r, double g, double b, double a)
Parameters
r
doubleThe red channel of the new color. Intended [0, 1].
g
doubleThe green channel of the new color. Intended [0, 1].
b
doubleThe blue channel of the new color. Intended [0, 1].
a
doubleThe alpha channel of the new color. Intended [0, 1].
Properties
A
Alpha channel. Intended to range [0, 1].
public double A { get; set; }
Property Value
B
Blue channel. Intended to range [0, 1].
public double B { get; set; }
Property Value
Components
A new array representing the components of the vector.
public double[] Components { get; }
Property Value
- double[]
G
Green channel. Intended to range [0, 1].
public double G { get; set; }
Property Value
this[int]
Indexer for the vector. 0 is the x component and so on.
public double this[int i] { get; set; }
Parameters
i
int
Property Value
this[string]
Used to perform a swizzle. i.e. vec3["yz"] = vec3["xz"];
public double[] this[string swizzle] { get; set; }
Parameters
swizzle
string
Property Value
- double[]
R
Red channel. Intended to range [0, 1].
public double R { get; set; }
Property Value
SwizzleMap
Mapping of swizzle characters to their index in the implementing type. i.e. SwizzleMap['x'] = 0, SwizzleMap['y'] = 1, etc.
public static Dictionary<char, int> SwizzleMap { get; }
Property Value
W
The w component of the vector.
public double W { readonly get; set; }
Property Value
X
The x component of the vector.
public double X { readonly get; set; }
Property Value
Y
The y component of the vector.
public double Y { readonly get; set; }
Property Value
Z
The z component of the vector.
public double Z { readonly get; set; }
Property Value
Methods
Dot(in FRGBA)
Computes the dot product between two vectors (https://en.wikipedia.org/wiki/Dot_product).
public double Dot(in FRGBA other)
Parameters
other
FRGBA
Returns
Equals(FRGBA)
Computes whether two vectors are equal.
public bool Equals(FRGBA other)
Parameters
other
FRGBA
Returns
Mag()
Computes the magnitude of the vector.
public double Mag()
Returns
Mag2()
Computes the squared magnitude of the vector.
public double Mag2()
Returns
Norm()
Computes the normalized vector.
public FRGBA Norm()
Returns
Norm(out double)
Computes the normalized vector.
public FRGBA Norm(out double mag)
Parameters
mag
double
Returns
ToFRGB()
Returns the color expressed in FRGB space.
public FRGB ToFRGB()
Returns
- FRGB
A new color with the same channels, but alpha truncated.
ToHSV()
Returns the color expressed in HSV space.
public HSV ToHSV()
Returns
- HSV
A new color with hue [0, 360], saturation and value [0, 1] and alpha truncated.
ToHSVA()
Returns the color expressed in HSVA space.
public HSVA ToHSVA()
Returns
- HSVA
A new color with hue [0, 360] and saturation, value and alpha [0 - 1].
ToRGB()
Returns the color expressed in RGB space.
public RGB ToRGB()
Returns
- RGB
A new color with values scaled down by 255 and alpha truncated.
ToRGBA()
Returns the color expressed in RGBA space.
public RGBA ToRGBA()
Returns
- RGBA
A new color with values scaled by 255.
ToString()
Gets the string representation of the vector.
public override string ToString()
Returns
Operators
operator +(in FRGBA, in FRGBA)
Computes the sum of two vectors.
public static FRGBA operator +(in FRGBA lhs, in FRGBA rhs)
Parameters
Returns
operator /(in FRGBA, in FRGBA)
Computes the Hadamar inverse product (division) of two vectors, also known as the component-wise inverse product (https://en.wikipedia.org/wiki/Hadamard_product_(matrices)).
public static FRGBA operator /(in FRGBA lhs, in FRGBA rhs)
Parameters
Returns
operator /(in FRGBA, double)
Computes the division of a vector by a scalar.
public static FRGBA operator /(in FRGBA lhs, double scalar)
Parameters
Returns
explicit operator FRGB(in FRGBA)
Returns the color expressed in FRGB space.
public static explicit operator FRGB(in FRGBA rgbaf)
Parameters
rgbaf
FRGBA
Returns
- FRGB
A new color with the same channels, but alpha truncated.
explicit operator HSV(in FRGBA)
Returns the color expressed in HSV space.
public static explicit operator HSV(in FRGBA rgbaf)
Parameters
rgbaf
FRGBA
Returns
- HSV
A new color with hue [0, 360], saturation and value [0, 1] and alpha truncated.
explicit operator RGB(in FRGBA)
Returns the color expressed in RGB space.
public static explicit operator RGB(in FRGBA rgbaf)
Parameters
rgbaf
FRGBA
Returns
- RGB
A new color with values scaled down by 255 and alpha truncated.
implicit operator HSVA(in FRGBA)
Returns the color expressed in HSVA space.
public static implicit operator HSVA(in FRGBA rgbaf)
Parameters
rgbaf
FRGBA
Returns
- HSVA
A new color with hue [0, 360] and saturation, value and alpha [0 - 1].
implicit operator RGBA(in FRGBA)
Returns the color expressed in RGBA space.
public static implicit operator RGBA(in FRGBA rgbaf)
Parameters
rgbaf
FRGBA
Returns
- RGBA
A new color with values scaled by 255.
implicit operator double[](in FRGBA)
For implicitly converting the implementing type to a swizzle. i.e. Vec2 v["yx"] = other2;
public static implicit operator double[](in FRGBA swizzler)
Parameters
swizzler
FRGBA
Returns
- double[]
implicit operator FRGBA(double[])
For implicitly converting a swizzle to the implementing type. i.e. Vec2 v = vec3["yz"];
public static implicit operator FRGBA(double[] swizzle)
Parameters
swizzle
double[]
Returns
operator *(in FRGBA, in FRGBA)
Computes the Hadamard product of two vectors, also known as the component-wise product (https://en.wikipedia.org/wiki/Hadamard_product_(matrices)).
public static FRGBA operator *(in FRGBA lhs, in FRGBA rhs)
Parameters
Returns
operator *(in FRGBA, double)
Computes the product of a vector and a scalar.
public static FRGBA operator *(in FRGBA lhs, double scalar)
Parameters
Returns
operator -(in FRGBA, in FRGBA)
Computes the difference of two vectors.
public static FRGBA operator -(in FRGBA lhs, in FRGBA rhs)