Esempio n. 1
0
        private ImageConfiguration CreateImageConfiguration(int imageFormat, int paletteFormat)
        {
            var config = new ImageConfiguration();

            config.PadSize.With(options => options.To(size => ImageInfo.PadSize.Build(size)));

            if (ImageInfo.RemapPixels.IsSet)
            {
                config.RemapPixels.With(context => ImageInfo.RemapPixels.Build(context));
            }

            if (IsIndexEncoding(imageFormat) && _encodingDefinition.ContainsPaletteShader(paletteFormat))
            {
                config.ShadeColors.With(() => _encodingDefinition.GetPaletteShader(paletteFormat));
            }
            if (!IsIndexEncoding(imageFormat) && _encodingDefinition.ContainsColorShader(imageFormat))
            {
                config.ShadeColors.With(() => _encodingDefinition.GetColorShader(imageFormat));
            }

            return(config);
        }