private void UpdatePreviewPanel() { Misc.DeepCopy(SourceColorList, PreviewPanel.PalSource.Data); int startingIdx = (int)nudStartingIdx.Value; List <byte> WorkingList = SortByteList((byte)startingIdx, PreviewPanel.Selections); if (WorkingList == null) { PreviewPanel.Refresh(); return; } int steps = (int)nudSteps.Value; Color startingColor = StartingPreview.BackColor; Color endingColor = EndingPreview.BackColor; decimal deltaR = (decimal)(endingColor.R - startingColor.R) / steps; decimal deltaG = (decimal)(endingColor.G - startingColor.G) / steps; decimal deltaB = (decimal)(endingColor.B - startingColor.B) / steps; int i = 0; decimal LastR = startingColor.R, LastG = startingColor.G, LastB = startingColor.B; while (i < steps) { LastR += deltaR; LastG += deltaG; LastB += deltaB; PreviewPanel.PalSource[WorkingList[(byte)i]] = Color.FromArgb(252, Misc.GetRound(LastR), Misc.GetRound(LastG), Misc.GetRound(LastB)).ToArgb(); ++i; } PreviewPanel.Refresh(); }
private void DoSort() { for (int i = 0; i < 256; i++) { PreviewPanel.PalSource[(byte)i] = OrigionPal[(byte)i]; } PreviewPanel.Selections = OriginSelections; List <byte> sortSelections = new List <byte>(); List <int> sortValues = new List <int>(); if (IsAll) { for (int i = 0; i < 256; i++) { sortSelections.Add((byte)i); sortValues.Add(OrigionPal[(byte)i]); } } else { foreach (byte j in PreviewPanel.Selections) { sortSelections.Add(j); sortValues.Add(OrigionPal[j]); } } DoSort(sortValues); for (int i = 0; i < sortSelections.Count; i++) { PreviewPanel.PalSource[sortSelections[i]] = sortValues[IsIncrease ? i : sortSelections.Count - 1 - i]; } PreviewPanel.Refresh(); }
private void NudNewCount_ValueChanged(object sender, EventArgs e) { if (PreviewPanel.PalSource == null) { btnApply.Enabled = false; return; } btnApply.Enabled = true; Image img = Pal2Bmp(srcPal.Data); Misc.GetIndexedItem(img, PreviewPanel.PalSource, (int)nudNewCount.Value); PreviewPanel.Refresh(); }
private void Undo() { if (process.Count > 0) { process.RemoveAt(process.Count - 1); HistoryTextBox.Items.RemoveAt(HistoryTextBox.Items.Count - 1); previewProg.RemoveAt(previewProg.Count - 1); preview = previewProg[previewProg.Count - 1]; PreviewPanel.BackgroundImage = new Bitmap(Effects.ResizeImage(preview, 100, 100)); PreviewPanel.Refresh(); } }
public Sort(PalFile pal, List <byte> selects) { InitializeComponent(); Misc.SetLanguage(this); OrigionPal = pal; OriginSelections = selects; PreviewPanel.PalSource = new PalFile(); for (int i = 0; i < 256; i++) { PreviewPanel.PalSource[(byte)i] = OrigionPal[(byte)i]; } PreviewPanel.Selections = OriginSelections; PreviewPanel.Refresh(); InitializeRadioButtons(); }
private void lvTemplates_AfterSelect(object sender, TreeViewEventArgs e) { if (lvTemplates.SelectedNode.Tag == null) { return; } List <int> curTag = (List <int>)lvTemplates.SelectedNode.Tag; if (PreviewPanel.PalSource == null) { PreviewPanel.PalSource = new FileSystem.PalFile(); } PreviewPanel.PalSource.Data = curTag; PreviewPanel.Refresh(); }
private void ckbVisible_CheckedChanged(object sender, EventArgs e) { PreviewPanel.IsSelectVisible = ckbVisible.Checked; PreviewPanel.Refresh(); }