Пример #1
0
        /// <summary>
        /// Creates a new <see cref="PixelFormat"/> with one <see cref="PCID"/> channel.
        /// </summary>
        /// <param name="e0">The first channel format.</param>
        public PixelFormat(PCID e0) : this()
        {
            _Component0 = (Byte)e0;
            _Component1 = _Component2 = _Component3 = (Byte)PCID.Empty;

            _Validate();
        }
Пример #2
0
        public int GetByteOffset(PCID pef)
        {
            if (Component0 == pef)
            {
                return(0);
            }

            int l = Component0.ByteCount;

            if (Component1 == pef)
            {
                return(l);
            }

            l += Component1.ByteCount;
            if (Component2 == pef)
            {
                return(l);
            }

            l += Component2.ByteCount;
            if (Component3 == pef)
            {
                return(l);
            }

            return(-1);
        }
Пример #3
0
        /// <summary>
        /// Creates a new <see cref="PixelFormat"/> with three <see cref="PCID"/> channels.
        /// </summary>
        /// <param name="e0">The first channel format.</param>
        /// <param name="e1">The second channel format.</param>
        /// <param name="e2">The third channel format.</param>
        public PixelFormat(PCID e0, PCID e1, PCID e2) : this()
        {
            _Component0 = (Byte)e0;
            _Component1 = (Byte)e1;
            _Component2 = (Byte)e2;
            _Component3 = (Byte)PCID.Empty;

            _Validate();
        }
Пример #4
0
 public override int GetHashCode()
 {
     unchecked {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (MacAddress?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (MachineName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (IP?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (PCID?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Пример #5
0
 private int _FindIndex(PCID pef)
 {
     if (Component0.Id == pef)
     {
         return(0);
     }
     if (Component1.Id == pef)
     {
         return(1);
     }
     if (Component2.Id == pef)
     {
         return(2);
     }
     if (Component3.Id == pef)
     {
         return(3);
     }
     return(-1);
 }
Пример #6
0
 public bool Any(PCID a, PCID b, PCID c, PCID d)
 {
     return(_FindIndex(a) >= 0 || _FindIndex(b) >= 0 || _FindIndex(c) >= 0 || _FindIndex(d) >= 0);
 }
Пример #7
0
 public bool Any(PCID a, PCID b)
 {
     return(_FindIndex(a) >= 0 || _FindIndex(b) >= 0);
 }
Пример #8
0
 public bool Any(PCID a)
 {
     return(_FindIndex(a) >= 0);
 }
Пример #9
0
 public bool All(PCID a, PCID b, PCID c, PCID d)
 {
     return(_FindIndex(a) >= 0 && _FindIndex(b) >= 0 && _FindIndex(c) >= 0 && _FindIndex(d) >= 0);
 }
Пример #10
0
 public bool All(PCID a, PCID b)
 {
     return(_FindIndex(a) >= 0 && _FindIndex(b) >= 0);
 }
Пример #11
0
 public PixelComponent(PCID id)
 {
     _Identifier = (Byte)id;
 }