| | 1 | |
|
| | 2 | | using System; |
| | 3 | |
|
| | 4 | | namespace Morpho25.Utility |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Pixel struct. |
| | 8 | | /// </summary> |
| | 9 | | public struct Pixel : IEquatable<Pixel> |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// I component. |
| | 13 | | /// </summary> |
| 89146 | 14 | | public int I { get; set; } |
| | 15 | | /// <summary> |
| | 16 | | /// J component. |
| | 17 | | /// </summary> |
| 89146 | 18 | | public int J { get; set; } |
| | 19 | | /// <summary> |
| | 20 | | /// K component. |
| | 21 | | /// </summary> |
| 178292 | 22 | | public int K { get; set; } |
| | 23 | |
|
| | 24 | | /// <summary> |
| | 25 | | /// Create a new pixel. |
| | 26 | | /// </summary> |
| | 27 | | /// <param name="i">I component.</param> |
| | 28 | | /// <param name="j">J component.</param> |
| | 29 | | /// <param name="k">K component.</param> |
| | 30 | | public Pixel(int i, int j, int k) |
| 89146 | 31 | | { |
| 89146 | 32 | | I = i; |
| 89146 | 33 | | J = j; |
| 89146 | 34 | | K = k; |
| 89146 | 35 | | } |
| | 36 | |
|
| 0 | 37 | | public static bool operator ==(Pixel first, Pixel second) => first.Equals(second); |
| 0 | 38 | | public static bool operator !=(Pixel first, Pixel second) => !(first == second); |
| 0 | 39 | | public override bool Equals(object obj) => obj is Pixel other && this.Equals(other); |
| 0 | 40 | | public override int GetHashCode() => (I, J, K).GetHashCode(); |
| | 41 | | public bool Equals(Pixel other) |
| 0 | 42 | | { |
| 0 | 43 | | return I == other.I && J == other.J && K == other.K; |
| 0 | 44 | | } |
| | 45 | | } |
| | 46 | | } |