private void SpreadColors(int total)
        {
            ColorBox *  pBox  = _boxes;
            ColorEntry *entry = pBox->_rootEntry->_next;

            int index, count = (int)pBox->_colors;

            //Set initial box
            pBox->_color = entry->_color;
            entry        = entry->_next;
            pBox++;

            //Set remaining boxes
            for (index = 1; index < count; index++, pBox++, entry = entry->_next)
            {
                entry->_box      = pBox;
                pBox->_color     = entry->_color;
                pBox->_rootEntry = null;
            }

            //Not needed because the remaining palette colors will be empty anyways.
            //Set total boxes
            //for (; index < total; index++, pBox++)
            //{
            //    pBox->_color = new ARGBPixel(255, 0, 0, 0);
            //    pBox->_rootEntry = null;
            //}

            //_boxCount = total;
            _boxCount = count;
        }
 public void Initialize()
 {
     _rootEntry        = ColorEntry.Create();
     _rootEntry->_prev = _rootEntry->_next = _rootEntry;
     _rootEntry->_box  = Address;
     _colors           = 0;
 }
            public void InsertPrev(ColorEntry *entry)
            {
                entry->_prev = _prev;
                entry->_next = _prev->_next;
                entry->_box  = _box;
                _box->_colors++;

                _prev->_next = entry;
                _prev        = entry;
            }
            public void Destroy()
            {
                ColorEntry *current, next;

                if (_rootEntry != null)
                {
                    current = _rootEntry;
                    do
                    {
                        next = current->_next;
                        ColorEntry.Destroy(current);
                        current = next;
                    } while (current != _rootEntry);
                    _rootEntry = null;
                }
            }
 public static void Destroy(ColorEntry *e)
 {
     Marshal.FreeHGlobal((IntPtr)e);
 }
Exemplo n.º 6
0
            public void InsertPrev(ColorEntry* entry)
            {
                entry->_prev = _prev;
                entry->_next = _prev->_next;
                entry->_box = _box;
                _box->_colors++;

                _prev->_next = entry;
                _prev = entry;
            }
Exemplo n.º 7
0
 public void Initialize()
 {
     _rootEntry = ColorEntry.Create();
     _rootEntry->_prev = _rootEntry->_next = _rootEntry;
     _rootEntry->_box = Address;
     _colors = 0;
 }
Exemplo n.º 8
0
            public void Destroy()
            {
                ColorEntry* current, next;

                if (_rootEntry != null)
                {
                    current = _rootEntry;
                    do
                    {
                        next = current->_next;
                        ColorEntry.Destroy(current);
                        current = next;
                    } while (current != _rootEntry);
                    _rootEntry = null;
                }
            }