Exemple #1
0
 public ChannelInfo ConvertToV5(Version version)
 {
     if (version.IsLess(5))
     {
         ChannelFormatV4 formatv4 = (ChannelFormatV4)Format;
         if (formatv4 == ChannelFormatV4.Color)
         {
             // replace ChannelFormat.Color with 1 dimention to ChannelFormat.Byte with 4 dimention
             return(new ChannelInfo(Stream, Offset, IsSet ? (byte)ChannelFormatV5.Byte : (byte)0, IsSet ? (byte)4 : (byte)0));
         }
         else
         {
             ChannelFormatV5 format = GetFormat(version).ToChannelFormatV5();
             return(new ChannelInfo(Stream, Offset, (byte)format, Dimension));
         }
     }
     else if (version.IsLess(2019))
     {
         return(this);
     }
     else
     {
         ChannelFormatV5 format = GetFormat(version).ToChannelFormatV5();
         return(new ChannelInfo(Stream, Offset, (byte)format, Dimension));
     }
 }
Exemple #2
0
        public static ChannelFormat ToChannelFormat(this ChannelFormatV5 _this)
        {
            switch (_this)
            {
            case ChannelFormatV5.Float:
                return(ChannelFormat.Float);

            case ChannelFormatV5.Float16:
                return(ChannelFormat.Float16);

            case ChannelFormatV5.Byte:
                return(ChannelFormat.Byte);

            case ChannelFormatV5.Int:
                return(ChannelFormat.Int);

            default:
                throw new Exception(_this.ToString());
            }
        }