예제 #1
0
        public static EncodingDefinition GetEncodingDefinition()
        {
            var formats = new Dictionary <int, IColorEncoding>
            {
                [0]  = ImageFormats.Rgba8888(),
                [1]  = ImageFormats.Rgb888(),
                [2]  = ImageFormats.Rgba5551(),
                [3]  = ImageFormats.Rgb565(),
                [4]  = ImageFormats.Rgba4444(),
                [5]  = ImageFormats.La88(),
                [6]  = ImageFormats.Rg88(),
                [7]  = ImageFormats.L8(),
                [8]  = ImageFormats.A8(),
                [9]  = ImageFormats.La44(),
                [10] = ImageFormats.L4(BitOrder.LeastSignificantBitFirst),
                [11] = ImageFormats.A4(BitOrder.LeastSignificantBitFirst),
                [12] = ImageFormats.Etc1(true),
                [13] = ImageFormats.Etc1A4(true)
            };

            var definition = EncodingDefinition.Empty;

            definition.AddColorEncodings(formats);

            return(definition);
        }
예제 #2
0
        private IColorEncoding CreateEncoding(ExtensionType extType)
        {
            switch (extType.Name)
            {
            case "RGBA8888":
                var componentOrder1 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder1      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new Rgba(8, 8, 8, 8, componentOrder1, byteOrder1));

            case "RGB888":
                var componentOrder2 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder2      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new Rgba(8, 8, 8, componentOrder2, byteOrder2));

            case "RGB565":
                var componentOrder3 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder3      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new Rgba(5, 6, 5, componentOrder3, byteOrder3));

            case "RGB555":
                var componentOrder4 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder4      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new Rgba(5, 5, 5, componentOrder4, byteOrder4));

            case "RGBA5551":
                var componentOrder5 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder5      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new Rgba(5, 5, 5, 1, componentOrder5, byteOrder5));

            case "RGBA4444":
                var componentOrder6 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder6      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new Rgba(4, 4, 4, 4, componentOrder6, byteOrder6));

            case "RG88":
                var componentOrder7 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder7      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new Rgba(8, 8, 0, componentOrder7, byteOrder7));

            case "R8":
                return(new Rgba(8, 0, 0));

            case "G8":
                return(new Rgba(0, 8, 0));

            case "B8":
                return(new Rgba(0, 0, 8));

            case "LA88":
                var componentOrder8 = extType.GetParameterValue <string>("ComponentOrder");
                var byteOrder8      = extType.GetParameterValue <ByteOrder>("ByteOrder");
                return(new La(8, 8, componentOrder8, byteOrder8));

            case "LA44":
                var componentOrder9 = extType.GetParameterValue <string>("ComponentOrder");
                return(new La(4, 4, componentOrder9));

            case "L8":
                return(ImageFormats.L8());

            case "A8":
                return(ImageFormats.A8());

            case "L4":
                return(ImageFormats.L4(extType.GetParameterValue <BitOrder>("BitOrder")));

            case "A4":
                return(ImageFormats.A4(extType.GetParameterValue <BitOrder>("BitOrder")));

            case "ETC1":
                return(ImageFormats.Etc1(extType.GetParameterValue <bool>("Z-Order")));

            case "ETC1A4":
                return(ImageFormats.Etc1A4(extType.GetParameterValue <bool>("Z-Order")));

            case "ETC2 RGB":
                return(ImageFormats.Etc2());

            case "ETC2 RGBA":
                return(ImageFormats.Etc2A());

            case "ETC2 RGBA1":
                return(ImageFormats.Etc2A1());

            case "EAC R11":
                return(ImageFormats.EacR11());

            case "EAC RG11":
                return(ImageFormats.EacRG11());

            case "DXT1":
                return(ImageFormats.Dxt1());

            case "DXT3":
                return(ImageFormats.Dxt3());

            case "DXT5":
                return(ImageFormats.Dxt5());

            case "ATI1":
                return(ImageFormats.Ati1());

            case "ATI1L":
                return(ImageFormats.Ati1L());

            case "ATI1A":
                return(ImageFormats.Ati1A());

            case "ATI2":
                var wiiU = extType.GetParameterValue <bool>("Alpha/Luminance");
                return(wiiU ? ImageFormats.Ati2() : ImageFormats.Ati2AL());

            case "ATC":
                return(ImageFormats.Atc());

            case "ATCA":
                var atcAlpha = extType.GetParameterValue <AtcAlpha>("AlphaMode");
                return(atcAlpha == AtcAlpha.Explicit ?
                       ImageFormats.AtcExplicit() :
                       ImageFormats.AtcInterpolated());

            case "BC7":
                return(ImageFormats.Bc7());

            case "PVRTC 2Bpp":
                return(ImageFormats.Pvrtc_2bpp());

            case "PVRTC 4Bpp":
                return(ImageFormats.Pvrtc_4bpp());

            case "PVRTCA 2Bpp":
                return(ImageFormats.PvrtcA_2bpp());

            case "PVRTCA 4Bpp":
                return(ImageFormats.PvrtcA_4bpp());

            case "PVRTC2 2Bpp":
                return(ImageFormats.Pvrtc2_2bpp());

            case "PVRTC2 4Bpp":
                return(ImageFormats.Pvrtc2_4bpp());

            case "ASTC 4x4":
                return(ImageFormats.Astc4x4());

            default:
                return(null);
            }
        }