Rgba1010102 Struct
A pixel with 10-bit red, green and blue components and a 2-bit straight (non-premultiplied) alpha, packed in a 32-bit value.
public struct Rgba1010102 : IEquatable<Rgba1010102>Remarks
Rgba1010102.PackedValue is stored in native endianness and holds red in its 10 low bits, then green, then blue, and alpha in its 2 high bits: the layout of DXGI_FORMAT_R10G10B10A2_UNORM and of the RGBA_1010102 bitmaps of Android. The colors go from 0 to 1023 and the alpha from 0 (fully transparent) to 3 (fully opaque).
A component is the fraction of its largest value: conversions to and from the other formats round to the nearest sample, so the conversion to a format with 16 bits per component and back is exact, and a conversion to this format reduces the precision (alpha keeps 4 levels).
- Implements
Constructors
| Name | Description |
|---|---|
| Rgba1010102(ushort, ushort, ushort, byte) | Initializes a new instance of the Rgba1010102 struct. |
Rgba1010102(ushort, ushort, ushort, byte)
Rgba1010102.csInitializes a new instance of the Rgba1010102 struct.
Parameters
rushort- The red component, from 0 to 1023.
gushort- The green component, from 0 to 1023.
bushort- The blue component, from 0 to 1023.
abyte- The straight alpha component, from 0 to 3. Defaults to fully opaque.
Exceptions
ArgumentOutOfRangeException- A component is larger than the largest value of its bits.
Properties
| Name | Description |
|---|---|
| A | Gets or sets the straight alpha component, from 0 (fully transparent) to 3 (fully opaque). |
| B | Gets or sets the blue component, from 0 to 1023. |
| G | Gets or sets the green component, from 0 to 1023. |
| R | Gets or sets the red component, from 0 to 1023. |
Gets or sets the straight alpha component, from 0 (fully transparent) to 3 (fully opaque).
public byte A { readonly get; set; }Gets or sets the blue component, from 0 to 1023.
public ushort B { readonly get; set; }Gets or sets the green component, from 0 to 1023.
public ushort G { readonly get; set; }Gets or sets the red component, from 0 to 1023.
public ushort R { readonly get; set; }Methods
| Name | Description |
|---|---|
| Equals(Rgba1010102) | Indicates whether the current object is equal to another object of the same type. |
| Equals(object?) | Indicates whether this instance and a specified object are equal. |
| GetHashCode() | Returns the hash code for this instance. |
| ToString() | Returns the fully qualified type name of this instance. |
Equals overloads
Equals(Rgba1010102)
Rgba1010102.csIndicates whether the current object is equal to another object of the same type.
public readonly bool Equals(Rgba1010102 other)Parameters
otherRgba1010102- An object to compare with this object.
Returns
bool true if the current object is equal to the other parameter; otherwise, false.
Equals(object?)
Rgba1010102.csGetHashCode()
Rgba1010102.csToString()
Rgba1010102.csOperators
| Name | Description |
|---|---|
| operator ==(Rgba1010102, Rgba1010102) | Compares two pixels for equality. |
| operator !=(Rgba1010102, Rgba1010102) | Compares two pixels for inequality. |
operator ==(Rgba1010102, Rgba1010102)
Rgba1010102.csCompares two pixels for equality.
public static bool operator ==(Rgba1010102 left, Rgba1010102 right)Parameters
leftRgba1010102- The first pixel.
rightRgba1010102- The second pixel.
Returns
bool true if all components are equal; otherwise false.
operator !=(Rgba1010102, Rgba1010102)
Rgba1010102.csCompares two pixels for inequality.
public static bool operator !=(Rgba1010102 left, Rgba1010102 right)Parameters
leftRgba1010102- The first pixel.
rightRgba1010102- The second pixel.
Returns
bool true if any component differs; otherwise false.
Fields
| Name | Description |
|---|---|
| PackedValue | The packed components: red in bits 0 to 9, green in bits 10 to 19, blue in bits 20 to 29 and alpha in bits 30 and 31. |
PackedValue
The packed components: red in bits 0 to 9, green in bits 10 to 19, blue in bits 20 to 29 and alpha in bits 30 and 31.
public uint PackedValue