예제 #1
0
        public void CreatePalette(IEnumerable <Color> colors)
        {
            // Step 1: Build a 3-dimensional histogram of all colors and calculate their moments
            var histogram = new Wu3DHistogram(colors.ToArray(), _indexBits, _indexAlphaBits, _indexCount, _indexAlphaCount);

            // Step 2: Create color cube
            var cube = WuColorCube.Create(histogram, _colorCount);

            // Step 3: Create palette from color cube
            _palette = CreatePalette(cube).ToList();
        }
예제 #2
0
        /// <inheritdoc />
        public IList <Color> CreatePalette(IEnumerable <Color> colors)
        {
            Array.Clear(_colorCache.Tag, 0, _colorCache.Tag.Length);

            // Step 1: Build a 3-dimensional histogram of all colors and calculate their moments
            _histogram.Create(colors.ToList());

            // Step 2: Create color cube
            var cube = WuColorCube.Create(_histogram, _colorCount);

            // Step 3: Create palette from color cube
            return(CreatePalette(cube).ToList());
        }