Palette GetMailPaletteFromMergedPalette(int offset) { Palette ret = new SpriteLibrary.Palette(); for (int i = 1; i < ret.Length; i++) { ret[i] = this.Palette[offset + i - 1]; } return(ret); }
private void palettePictureBox_DoubleClick(object sender, EventArgs e) { var mouseE = e as MouseEventArgs; var x = mouseE.X / paletteSquareSize; var y = mouseE.Y / paletteSquareSize; if (x >= 8 || y >= 2) { // clicked outside palette area (control is too big) return; } SpriteLibrary.Palette palette = null; switch (paletteComboBox.SelectedIndex) { case 0: palette = currentSprite.GreenMailPalette; break; case 1: palette = currentSprite.BlueMailPalette; break; case 2: palette = currentSprite.RedMailPalette; break; case 3: palette = currentSprite.BunnyPalette; break; default: return; } int index = x + y * 8; ColorDialog colorDialog = new ColorDialog(); colorDialog.Color = palette[index]; if (colorDialog.ShowDialog() == DialogResult.OK) { palette[index] = colorDialog.Color; } BuildPalette(paletteComboBox.SelectedIndex); if (this.ActiveMdiChild != null) { SpriteForm activeChild = (SpriteForm)this.ActiveMdiChild; activeChild.UpdateForm(); } }
void CopyColorArrayToSpritePalette(Color[] colorPal, SpriteLibrary.Palette spritePal) { if (spritePal.Length > colorPal.Length) { throw new Exception("Palette from sprite is wrong length! Cannot copy to UI palette."); } for (int i = 0; i < spritePal.Length; i++) { spritePal[i] = colorPal[i]; } }