public LightColorSelector()
 {
     Load += LightColorSelector_Load;
     InitializeComponent();
     image1 = new Bitmap(576, 1);
     image2 = new Bitmap(576, 1);
     image3 = new Bitmap(576, 1);
     image4 = new Bitmap(576, 1);
     image5 = new Bitmap(576, 1);
     panel1.BackgroundImageLayout = panel2.BackgroundImageLayout = panel3.BackgroundImageLayout = panel4.BackgroundImageLayout = panel5.BackgroundImageLayout = ImageLayout.Stretch;
     panel2.MouseClick += panel1_MouseClick;
     panel3.MouseClick += panel1_MouseClick;
     panel4.MouseClick += panel1_MouseClick;
     panel5.MouseClick += panel1_MouseClick;
     RecalcColors();
     panel1.BackgroundImage = image1;
     panel2.BackgroundImage = image2;
     panel3.BackgroundImage = image3;
     panel4.BackgroundImage = image4;
     panel5.BackgroundImage = image5;
     Utils.Reflection.CallMethod(panel1, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel2, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel3, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel4, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel5, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     pos0 = new Light.LightMarker(this, 0, panel1.Location, Color.Black);
     pos2880 = new Light.LightMarker(this, 2880, new Point(panel5.Location.X + panel5.Width, panel5.Location.Y), Color.White);
     pos0.Fixed = true;
     pos2880.Fixed = true;
     pos0.ValueChanged += new Action<Light.LightMarker>(MarkerValueChanged);
     pos2880.ValueChanged += MarkerValueChanged;
     panel1.SendToBack();
     panel5.SendToBack();
 }
        public void InitFromWorldLight(List<uint> times, List<SlimDX.Vector3> colors)
        {
            mInterpolator.InitFromTable(times, colors);
            if (pos0 != null)
                pos0.RemoveMarker();
            if (pos2880 != null)
                pos2880.RemoveMarker();
            pos0 = pos2880 = null;

            for (int i = 0; i < times.Count; ++i)
            {
                var time = times[i];
                uint panel = time / 576;
                if (panel == 5)
                    panel = 4;

                var offset = time - panel * 576;
                var ctrl = Controls["panel" + (panel + 1)];
                var clr = colors[i];
                Color color = Color.FromArgb((int)(clr.X * 255), (int)(clr.Y * 255), (int)(clr.Z * 255));
                Light.LightMarker marker = new Light.LightMarker(this, times[i], new Point((int)offset + ctrl.Location.X, ctrl.Location.Y), color);
                marker.Fixed = false;
                marker.MinTime = panel * 576;
                marker.MaxTime = (panel + 1) * 576;
                marker.RemoveRequested += new Action<Light.LightMarker>(MarkerRemoved);
                marker.ValueChanged += new Action<Light.LightMarker>(MarkerValueChanged);
                marker.TimeChanged += new Action<Light.LightMarker, uint, uint>(MarkerTimeChanged);
            }

            RecalcColors();
        }
Exemple #3
0
 public LightColorSelector()
 {
     Load += LightColorSelector_Load;
     InitializeComponent();
     image1 = new Bitmap(576, 1);
     image2 = new Bitmap(576, 1);
     image3 = new Bitmap(576, 1);
     image4 = new Bitmap(576, 1);
     image5 = new Bitmap(576, 1);
     panel1.BackgroundImageLayout = panel2.BackgroundImageLayout = panel3.BackgroundImageLayout = panel4.BackgroundImageLayout = panel5.BackgroundImageLayout = ImageLayout.Stretch;
     panel2.MouseClick           += panel1_MouseClick;
     panel3.MouseClick           += panel1_MouseClick;
     panel4.MouseClick           += panel1_MouseClick;
     panel5.MouseClick           += panel1_MouseClick;
     RecalcColors();
     panel1.BackgroundImage = image1;
     panel2.BackgroundImage = image2;
     panel3.BackgroundImage = image3;
     panel4.BackgroundImage = image4;
     panel5.BackgroundImage = image5;
     Utils.Reflection.CallMethod(panel1, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel2, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel3, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel4, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     Utils.Reflection.CallMethod(panel5, "SetStyle", ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
     pos0                  = new Light.LightMarker(this, 0, panel1.Location, Color.Black);
     pos2880               = new Light.LightMarker(this, 2880, new Point(panel5.Location.X + panel5.Width, panel5.Location.Y), Color.White);
     pos0.Fixed            = true;
     pos2880.Fixed         = true;
     pos0.ValueChanged    += new Action <Light.LightMarker>(MarkerValueChanged);
     pos2880.ValueChanged += MarkerValueChanged;
     panel1.SendToBack();
     panel5.SendToBack();
 }
Exemple #4
0
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            Panel       pnl = sender as Panel;
            ColorDialog cd  = new ColorDialog();

            if (cd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            mInterpolator.AddColor(((uint)e.X) + uint.Parse(pnl.Tag as string) * 576, cd.Color);
            RecalcColors();

            Light.LightMarker marker = new Light.LightMarker(this, (uint)e.X + uint.Parse(pnl.Tag as string) * 576, new Point(e.X + pnl.Location.X, pnl.Location.Y), cd.Color);
            marker.MinTime          = uint.Parse(pnl.Tag as string) * 576;
            marker.MaxTime          = uint.Parse(pnl.Tag as string) * 576 + 576;
            marker.RemoveRequested += new Action <Light.LightMarker>(MarkerRemoved);
            marker.ValueChanged    += new Action <Light.LightMarker>(MarkerValueChanged);
            marker.TimeChanged     += new Action <Light.LightMarker, uint, uint>(MarkerTimeChanged);
        }
Exemple #5
0
        public void InitFromWorldLight(List <uint> times, List <SlimDX.Vector3> colors)
        {
            mInterpolator.InitFromTable(times, colors);
            if (pos0 != null)
            {
                pos0.RemoveMarker();
            }
            if (pos2880 != null)
            {
                pos2880.RemoveMarker();
            }
            pos0 = pos2880 = null;

            for (int i = 0; i < times.Count; ++i)
            {
                var  time  = times[i];
                uint panel = time / 576;
                if (panel == 5)
                {
                    panel = 4;
                }

                var               offset = time - panel * 576;
                var               ctrl   = Controls["panel" + (panel + 1)];
                var               clr    = colors[i];
                Color             color  = Color.FromArgb((int)(clr.X * 255), (int)(clr.Y * 255), (int)(clr.Z * 255));
                Light.LightMarker marker = new Light.LightMarker(this, times[i], new Point((int)offset + ctrl.Location.X, ctrl.Location.Y), color);
                marker.Fixed            = false;
                marker.MinTime          = panel * 576;
                marker.MaxTime          = (panel + 1) * 576;
                marker.RemoveRequested += new Action <Light.LightMarker>(MarkerRemoved);
                marker.ValueChanged    += new Action <Light.LightMarker>(MarkerValueChanged);
                marker.TimeChanged     += new Action <Light.LightMarker, uint, uint>(MarkerTimeChanged);
            }

            RecalcColors();
        }
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            Panel pnl = sender as Panel;
            ColorDialog cd = new ColorDialog();
            if (cd.ShowDialog() != DialogResult.OK)
                return;

            mInterpolator.AddColor(((uint)e.X) + uint.Parse(pnl.Tag as string) * 576, cd.Color);
            RecalcColors();

            Light.LightMarker marker = new Light.LightMarker(this, (uint)e.X + uint.Parse(pnl.Tag as string) * 576, new Point(e.X + pnl.Location.X, pnl.Location.Y), cd.Color);
            marker.MinTime = uint.Parse(pnl.Tag as string) * 576;
            marker.MaxTime = uint.Parse(pnl.Tag as string) * 576 + 576;
            marker.RemoveRequested += new Action<Light.LightMarker>(MarkerRemoved);
            marker.ValueChanged += new Action<Light.LightMarker>(MarkerValueChanged);
            marker.TimeChanged += new Action<Light.LightMarker, uint, uint>(MarkerTimeChanged);
        }
Exemple #7
0
 void MarkerRemoved(Light.LightMarker marker)
 {
     mInterpolator.RemoveTime(marker.Time);
     marker.RemoveMarker();
     RecalcColors();
 }
Exemple #8
0
 void MarkerValueChanged(Light.LightMarker marker)
 {
     mInterpolator.ChangeColorForTime(marker.Time, marker.Color);
     RecalcColors();
 }
Exemple #9
0
 void MarkerTimeChanged(Light.LightMarker arg1, uint arg2, uint arg3)
 {
     mInterpolator.ChangeTime(arg2, arg3);
     RecalcColors();
 }