Example #1
0
        protected override bool IsReflexive(PropertyBasedSaveConfigToken token)
        {
            PngBitDepthUIChoices bitDepth = (PngBitDepthUIChoices)token.GetProperty <StaticListChoiceProperty>(PropertyNames.BitDepth).Value;

            // Only 32-bit is reflexive
            return(bitDepth == PngBitDepthUIChoices.Bpp32);
        }
Example #2
0
        internal override HashSet <InternalFileType.SavableBitDepths> CreateAllowedBitDepthListFromToken(PropertyBasedSaveConfigToken token)
        {
            PngBitDepthUIChoices choices = (PngBitDepthUIChoices)token.GetProperty <StaticListChoiceProperty>(PropertyNames.BitDepth).Value;
            HashSet <InternalFileType.SavableBitDepths> collection = new HashSet <InternalFileType.SavableBitDepths>();

            switch (choices)
            {
            case PngBitDepthUIChoices.AutoDetect:
                collection.AddRange <InternalFileType.SavableBitDepths>(new InternalFileType.SavableBitDepths[] { InternalFileType.SavableBitDepths.Rgb24 });
                return(collection);

            case PngBitDepthUIChoices.Bpp32:
                collection.AddRange <InternalFileType.SavableBitDepths>(new InternalFileType.SavableBitDepths[1]);
                return(collection);

            case PngBitDepthUIChoices.Bpp24:
            {
                InternalFileType.SavableBitDepths[] items = new InternalFileType.SavableBitDepths[] { InternalFileType.SavableBitDepths.Rgb24 };
                collection.AddRange <InternalFileType.SavableBitDepths>(items);
                return(collection);
            }

            case PngBitDepthUIChoices.Bpp8:
            {
                InternalFileType.SavableBitDepths[] depthsArray2 = new InternalFileType.SavableBitDepths[] { InternalFileType.SavableBitDepths.Rgb8, InternalFileType.SavableBitDepths.Rgba8 };
                collection.AddRange <InternalFileType.SavableBitDepths>(depthsArray2);
                return(collection);
            }
            }
            throw ExceptionUtil.InvalidEnumArgumentException <PngBitDepthUIChoices>(choices, "bitDepthFromToken");
        }
Example #3
0
        internal override Set <SavableBitDepths> CreateAllowedBitDepthListFromToken(PropertyBasedSaveConfigToken token)
        {
            PngBitDepthUIChoices bitDepthFromToken = (PngBitDepthUIChoices)token.GetProperty <StaticListChoiceProperty>(PropertyNames.BitDepth).Value;

            Set <SavableBitDepths> bitDepths = new Set <SavableBitDepths>();

            switch (bitDepthFromToken)
            {
            case PngBitDepthUIChoices.AutoDetect:
                bitDepths.AddRange(SavableBitDepths.Rgb24, SavableBitDepths.Rgb8, SavableBitDepths.Rgba32, SavableBitDepths.Rgba8);
                break;

            case PngBitDepthUIChoices.Bpp24:
                bitDepths.AddRange(SavableBitDepths.Rgb24);
                break;

            case PngBitDepthUIChoices.Bpp32:
                bitDepths.AddRange(SavableBitDepths.Rgba32);
                break;

            case PngBitDepthUIChoices.Bpp8:
                bitDepths.AddRange(SavableBitDepths.Rgb8, SavableBitDepths.Rgba8);
                break;

            default:
                throw new InvalidEnumArgumentException("bitDepthFromToken", (int)bitDepthFromToken, typeof(PngBitDepthUIChoices));
            }

            return(bitDepths);
        }