1 // 2 // Copyright (c) 2010-2021 Antmicro 3 // Copyright (c) 2011-2015 Realtime Embedded 4 // Copyright (c) 2020-2021 Microsoft 5 // 6 // This file is licensed under the MIT License. 7 // Full license text is available in 'licenses/MIT.txt'. 8 // 9 using System; 10 11 namespace Antmicro.Renode.Backends.Display 12 { 13 public class Pixel 14 { Pixel(byte red, byte green, byte blue, byte alpha)15 public Pixel(byte red, byte green, byte blue, byte alpha) 16 { 17 Alpha = alpha; 18 Red = red; 19 Green = green; 20 Blue = blue; 21 } 22 23 public byte Alpha { get; private set; } 24 public byte Red { get; private set; } 25 public byte Green { get; private set; } 26 public byte Blue { get; private set; } 27 Equals(object obj)28 public override bool Equals(object obj) 29 { 30 return obj is Pixel pixel && 31 Alpha == pixel.Alpha && 32 Red == pixel.Red && 33 Green == pixel.Green && 34 Blue == pixel.Blue; 35 } 36 GetHashCode()37 public override int GetHashCode() 38 { 39 return Alpha << 24 + Red << 16 + Green << 8 + Blue; 40 } 41 } 42 } 43 44