コード例 #1
0
        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;
        }
コード例 #2
0
 public void Initialize()
 {
     _rootEntry        = ColorEntry.Create();
     _rootEntry->_prev = _rootEntry->_next = _rootEntry;
     _rootEntry->_box  = Address;
     _colors           = 0;
 }
コード例 #3
0
            public void InsertPrev(ColorEntry *entry)
            {
                entry->_prev = _prev;
                entry->_next = _prev->_next;
                entry->_box  = _box;
                _box->_colors++;

                _prev->_next = entry;
                _prev        = entry;
            }
コード例 #4
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;
                }
            }
コード例 #5
0
 public static void Destroy(ColorEntry *e)
 {
     Marshal.FreeHGlobal((IntPtr)e);
 }
コード例 #6
0
            public void InsertPrev(ColorEntry* entry)
            {
                entry->_prev = _prev;
                entry->_next = _prev->_next;
                entry->_box = _box;
                _box->_colors++;

                _prev->_next = entry;
                _prev = entry;
            }
コード例 #7
0
 public void Initialize()
 {
     _rootEntry = ColorEntry.Create();
     _rootEntry->_prev = _rootEntry->_next = _rootEntry;
     _rootEntry->_box = Address;
     _colors = 0;
 }
コード例 #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;
                }
            }