示例#1
0
        /// <summary>
        /// Creates a new instance of <see cref="ImageTranscoder"/> for usage on non-indexed images.
        /// </summary>
        /// <param name="colorEncoding"></param>
        /// <param name="remapPixels"></param>
        /// <param name="padSizeOptionsFunc"></param>
        /// <param name="shadeColorsFunc"></param>
        /// <param name="quantizer"></param>
        /// <param name="taskCount"></param>
        public ImageTranscoder(IColorEncoding colorEncoding, CreatePixelRemapper remapPixels,
                               IPadSizeOptionsBuild padSizeOptionsFunc, CreateShadedColor shadeColorsFunc,
                               IQuantizer quantizer, int taskCount)
        {
            ContractAssertions.IsNotNull(colorEncoding, nameof(colorEncoding));

            _colorEncoding = colorEncoding;
            _quantizer     = quantizer;

            _remapPixels     = remapPixels;
            _padSizeOptions  = padSizeOptionsFunc;
            _shadeColorsFunc = shadeColorsFunc;

            _taskCount = taskCount;
        }
示例#2
0
        /// <summary>
        /// Creates a new instance of <see cref="ImageTranscoder"/> for usage on indexed images.
        /// </summary>
        /// <param name="indexEncoding"></param>
        /// <param name="paletteEncoding"></param>
        /// <param name="remapPixels"></param>
        /// <param name="padSizeOptions"></param>
        /// <param name="shadeColorsFunc"></param>
        /// <param name="quantizer"></param>
        /// <param name="taskCount"></param>
        public ImageTranscoder(IIndexEncoding indexEncoding, IColorEncoding paletteEncoding,
                               CreatePixelRemapper remapPixels, IPadSizeOptionsBuild padSizeOptions, CreateShadedColor shadeColorsFunc,
                               IQuantizer quantizer, int taskCount)
        {
            ContractAssertions.IsNotNull(indexEncoding, nameof(indexEncoding));
            ContractAssertions.IsNotNull(quantizer, nameof(quantizer));

            // HINT: paletteEncoding can be null due to EncodeIndexInternal handling it.

            _indexEncoding   = indexEncoding;
            _paletteEncoding = paletteEncoding;
            _quantizer       = quantizer;

            _remapPixels     = remapPixels;
            _padSizeOptions  = padSizeOptions;
            _shadeColorsFunc = shadeColorsFunc;

            _taskCount = taskCount;
        }