Пример #1
0
        /// <summary>
        /// 分析图像的颜色并创建色域
        /// </summary>
        protected void AnalyzePixels()
        {
            int len  = _Pixels.Length;
            int nPix = len / 3;

            _IndexedPixels = new byte[nPix];
            NeuQuant nq = new NeuQuant(_Pixels, len, _Sample);

            _ColorTab = nq.Process();
            int k = 0;

            for (int i = 0; i < nPix; i++)
            {
                int index = nq.Map(_Pixels[k++] & 0xff, _Pixels[k++] & 0xff, _Pixels[k++] & 0xff);
                _UsedEntry[index] = true;
                _IndexedPixels[i] = (byte)index;
            }
            _Pixels     = null;
            _ColorDepth = 8;
            _PalSize    = 7;
            if (_Transparent != Color.Empty)
            {
                _TransIndex = FindClosest(_Transparent);
            }
        }
 /// <summary>
 /// 分析图像的颜色并创建色域
 /// </summary>
 protected void AnalyzePixels()
 {
     int len = _Pixels.Length;
     int nPix = len / 3;
     _IndexedPixels = new byte[nPix];
     NeuQuant nq = new NeuQuant(_Pixels, len, _Sample);
     _ColorTab = nq.Process();
     int k = 0;
     for (int i = 0; i < nPix; i++)
     {
         int index = nq.Map(_Pixels[k++] & 0xff, _Pixels[k++] & 0xff, _Pixels[k++] & 0xff);
         _UsedEntry[index] = true;
         _IndexedPixels[i] = (byte)index;
     }
     _Pixels = null;
     _ColorDepth = 8;
     _PalSize = 7;
     if (_Transparent != Color.Empty)
         _TransIndex = FindClosest(_Transparent);
 }