Beispiel #1
0
 public PaletteColour(Color c, int index)
 {
     this.originalColour = c;
     this.index          = index;
     this.Height         = 26;
     this.Width          = 100;
     this.Orientation    = Orientation.Horizontal;
     btn = new Button
     {
         Height            = 16,
         Width             = 16,
         VerticalAlignment = VerticalAlignment.Center,
         Background        = new SolidColorBrush(c)
     };
     cstr = new string[10];
     Array.Copy(COLOURS, 1, cstr, 1, 9);
     cstr[0]  = "OFF";
     comboBox = new CbBox
     {
         index       = index,
         ItemsSource = cstr,
         Width       = 80
     };
     Children.Add(btn);
     Children.Add(comboBox);
 }
Beispiel #2
0
        private void Colour4Changed(object sender, SelectionChangedEventArgs e)
        {
            CbBox         cb = (sender as CbBox);
            PaletteColour p  = (palette.Children[cb.index] as PaletteColour);

            for (int x = 0; x < pixelWidth; x++)
            {
                for (int y = 0; y < pixelHeight; y++)
                {
                    if (bmpPixels[x, y] == p.originalColour)
                    {
                        int c = MonoColourRGB[cb.SelectedIndex];
                        treatedPixels[x, y] = Color.FromRgb((byte)(c >> 16), (byte)(c >> 8), (byte)(c));
                    }
                }
            }
            RedrawCanvas(treatedPixels);
        }