Example #1
0
        public IIndexConfiguration With(IColorEncoding encoding)
        {
            ContractAssertions.IsNotNull(encoding, nameof(encoding));

            PaletteEncoding = encoding;

            return(_parent);
        }
Example #2
0
        public void AddColorEncoding(int imageFormat, IColorEncoding colorEncoding)
        {
            if (_colorEncodings.ContainsKey(imageFormat) || _indexEncodings.ContainsKey(imageFormat))
            {
                return;
            }

            _colorEncodings.Add(imageFormat, colorEncoding);
        }
Example #3
0
        public IImageConfiguration With(IColorEncoding encoding)
        {
            ContractAssertions.IsNotNull(encoding, nameof(encoding));

            ColorEncoding = encoding;
            IndexEncoding = null;

            return(_parent);
        }
Example #4
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;
        }
Example #5
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;
        }
 /// <summary>
 /// Creates a new instance of <see cref="IndexedImageSettings"/>.
 /// </summary>
 /// <param name="indexEncoding">The encoding used for the index data.</param>
 /// <param name="paletteEncoding">The encoding used for the colors in the palette.</param>
 /// <param name="width">The width of the image.</param>
 /// <param name="height">The height of the image.</param>
 public IndexedImageSettings(IIndexEncoding indexEncoding, IColorEncoding paletteEncoding, int width, int height) : base(paletteEncoding, width, height)
 {
     IndexEncoding = indexEncoding;
 }
Example #7
0
 /// <summary>
 /// Creates a new instance of <see cref="ImageSettings"/>.
 /// </summary>
 /// <param name="encoding">The encoding used for the colors in an image.</param>
 /// <param name="width">The width of the image.</param>
 /// <param name="height">The height of the image.</param>
 public ImageSettings(IColorEncoding encoding, int width, int height)
 {
     Encoding = encoding;
     Width    = width;
     Height   = height;
 }
Example #8
0
 public ImageEncodingElement(int identifier, IColorEncoding colorEncoding)
 {
     _colorEncoding = colorEncoding;
     ImageIdent     = identifier;
 }