private void BeadChange(object sender, EventArgs e) { for (int i = 0; i < m_Pallet.Colours.Count; ++i) { m_Pallet.Colours[i] = colors[i].Colour; } m_Pallet.Save(); }
private void finishProjectToolStripMenuItem_Click(object sender, EventArgs e) { if (m_OriginalImage != null) { Dictionary <Colour, int> m_Colours = new Dictionary <Colour, int>(); Dictionary <Color, Colour> m_ColorToColour = new Dictionary <Color, Colour>(); for (int i = 0; i < m_BasePallet.FoundMatches.Keys.Count; ++i) { if (!m_Colours.ContainsKey(m_BasePallet.FoundMatches.Values.ElementAt(i).BestMatch)) { m_Colours.Add(m_BasePallet.FoundMatches.Values.ElementAt(i).BestMatch, 0); m_ColorToColour.Add(m_BasePallet.FoundMatches.Values.ElementAt(i).BestMatch.Color, m_BasePallet.FoundMatches.Values.ElementAt(i).BestMatch); } } Color ignore = m_Image.Image.GetPixel(0, 0); for (int x = 0; x < m_Image.Image.Width; ++x) { for (int y = 0; y < m_Image.Image.Height; ++y) { Color col = m_Image.Image.GetPixel(x, y); if (col != ignore) { m_Colours[m_ColorToColour[col]]++; } } } for (int i = 0; i < m_Colours.Keys.Count; ++i) { m_BasePallet.UpdateColour(m_Colours.Keys.ElementAt(i), m_Colours.Values.ElementAt(i)); } m_BasePallet.Save(); string time = String.Format("{0:t}", (DateTime.Now - start)); time = time.Remove(time.LastIndexOf('.')); MessageBox.Show("Hooray! this project took roughly: " + time, "Hooray"); } }