ImageMagick.Quantum.Convert C# (CSharp) Method

Convert() static private method

static private Convert ( byte value ) : Byte
value byte
return System.Byte
    internal static QuantumType Convert(byte value)
    {
#if Q16 || Q16HDRI
      return (QuantumType)(257UL * value);
#else
      return value;
#endif
    }

Same methods

Quantum::Convert ( double value ) : Byte
Quantum::Convert ( uint value ) : Byte
Quantum::Convert ( ushort value ) : Byte

Usage Example

Example #1
0
        private static bool TryParseQ8(string value, List <QuantumType> channels)
        {
            int size = 0;

            if (value.Length == 4 || value.Length == 5)
            {
                size = 1;
            }
            else if (value.Length == 3 || value.Length == 7 || value.Length == 9)
            {
                size = 2;
            }
            else
            {
                return(false);
            }

            for (int i = 1; i < value.Length; i += size)
            {
                if (!TryParseHex(value, i, size, out ushort channel))
                {
                    return(false);
                }

                channels.Add(Quantum.Convert((byte)channel));
            }

            return(true);
        }
All Usage Examples Of ImageMagick.Quantum::Convert