コード例 #1
0
ファイル: ChannelInfo.cs プロジェクト: yaoya/UtinyRipper
 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));
     }
 }
コード例 #2
0
        public static ChannelFormat ToChannelFormat(this ChannelFormatV4 _this)
        {
            switch (_this)
            {
            case ChannelFormatV4.Float:
                return(ChannelFormat.Float);

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

            case ChannelFormatV4.Color:
                return(ChannelFormat.Color);

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

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