uGIF.NeuQuant.Process C# (CSharp) Method

Process() public method

public Process ( ) : byte[]
return byte[]
        public byte[] Process()
        {
            Learn ();
            Unbiasnet ();
            Inxbuild ();
            return ColorMap ();
        }

Usage Example

Beispiel #1
0
        void RemapPixels()
        {
            int len = pixels.Length;
            indexedPixels = new byte[len];

            if (firstFrame || !useGlobalColorTable) {
                // initialize quantizer
                nq = new NeuQuant (pixels, len, quality);
                colorTab = nq.Process (); // create reduced palette
            }

            for (int i = 0; i < len; i++) {
                int index = nq.Map (pixels [i].r & 0xff, pixels [i].g & 0xff, pixels [i].b & 0xff);
                usedEntry [index] = true;
                indexedPixels [i] = (byte)index;

                if (dispose == 1 && prevIndexedPixels != null) {
                    if (indexedPixels [i] == prevIndexedPixels [i]) {
                        indexedPixels [i] = (byte)transIndex;
                    } else {
                        prevIndexedPixels [i] = (byte)index;
                    }
                }
            }
            colorDepth = 8;
            palSize = 7;
            // get closest match to transparent color if specified
            if (transparent.HasValue) {
                var c = transparent.Value;
                //transIndex = FindClosest(transparent);
                transIndex = nq.Map (c.b, c.g, c.r);
            }

            if (dispose == 1 && prevIndexedPixels == null)
                prevIndexedPixels = indexedPixels.Clone () as byte[];
        }