/// <summary> /// Associates each of the colours in the pattern list with the number of times the colour appears. /// Will not set if number of entries exceeds MainForm.MAX_COLOURS /// </summary> public void UpdateColourMap() { patternList.Items.Clear(); if (mParent.ColourMap.Count > MainForm.MAX_COLOURS) { MessageBox.Show("Too many colours!"); return; } patternCreator = new PatternCreator(); List <IColourInfo> temp = mParent.ColourMap.ToList(); // loop through ColourMap, adding max frequency first. while (temp.Count > 0) { int max = int.MinValue; IColourInfo maxC = temp[0]; foreach (IColourInfo col in temp) { if (col.Frequency > max) { max = col.Frequency; maxC = col; } } AddPattern(maxC); temp.Remove(maxC); } patternList.Sort(); }
public PatternEditor(MainForm parent) { mParent = parent; InitializeComponent(); sortingCombo.DataSource = Enum.GetValues(typeof(PatternListComparer.SortOptions)); patternList.SmallImageList = new ImageList(); patternList.SmallImageList.ImageSize = new Size(PATTERN_WIDTH, PATTERN_WIDTH); patternList.ListViewItemSorter = new PatternListComparer(); patternCreator = new PatternCreator(); if (parent.ColourMap != null && parent.ColourMap.Count > 0) { //Palette = parent.OutputImagePalette; patternList.Items[0].Selected = true; } }
/// <summary> /// Associates each of the colours in the pattern list with the number of times the colour appears. /// Will not set if number of entries exceeds MainForm.MAX_COLOURS /// </summary> public void UpdateColourMap() { patternList.Items.Clear(); if (mParent.ColourMap.Count > MainForm.MAX_COLOURS) { MessageBox.Show("Too many colours!"); return; } patternCreator = new PatternCreator(); List<IColourInfo> temp = mParent.ColourMap.ToList(); // loop through ColourMap, adding max frequency first. while (temp.Count > 0) { int max = int.MinValue; IColourInfo maxC = temp[0]; foreach (IColourInfo col in temp) { if (col.Frequency > max) { max = col.Frequency; maxC = col; } } AddPattern(maxC); temp.Remove(maxC); } patternList.Sort(); }