Example #1
0
 private void PictureBox4_Click(object sender, EventArgs e)
 {
     if (pictureBox4.Image != nv12)
     {
         Image temp = pictureBox4.Image;
         pictureBox4.Image = nv12;
         temp.Dispose();
     }
     else
     {
         pictureBox4.Image = ColorspaceConverter.ColorDifference(original, nv12);
     }
 }
Example #2
0
 private void PictureBox2_Click(object sender, EventArgs e)
 {
     if (pictureBox2.Image != yuv444)
     {
         Image temp = pictureBox2.Image;
         pictureBox2.Image = yuv444;
         temp.Dispose();
     }
     else
     {
         pictureBox2.Image = ColorspaceConverter.ColorDifference(original, yuv444);
     }
 }
Example #3
0
        public MainForm()
        {
            InitializeComponent();

            original  = new Bitmap(Resources._749px_Vector_Video_Standards2_svg);
            yuv444    = ColorspaceConverter.ConvertToYUV444(original);
            yuv422    = ColorspaceConverter.ConvertToYUV422(original);
            nv12      = ColorspaceConverter.ConvertToNV12(original);
            dctyuv444 = ColorspaceConverter.ConvertToQuantizedYUV444(original);

            pictureBox1.Image = original;
            pictureBox2.Image = yuv444;
            pictureBox3.Image = yuv422;
            pictureBox4.Image = nv12;
            pictureBox5.Image = dctyuv444;
        }
        private static async void InterpolateColor(PropertyInfo propertyInfo, AnimMessage animationMessage, AnimInterpolator interpolator, Color sourceColor, Color destinationColor)
        {
            // Safety procedure
            try
            {
                // Calculate all interpolated colours in between.
                Lch        originalColorLch = ColorspaceConverter.ColorToLch(sourceColor);
                Lch        newColorLch      = ColorspaceConverter.ColorToLch(destinationColor);
                List <Lch> lchColours       = interpolator.CalculateIntermediateColours(originalColorLch, newColorLch);

                // Converted interpolated colours to RGB.
                List <Color> interpolatedColours = ColorspaceConverter.LchListToColor(lchColours);

                // Check if object is a winform control.
                Control winFormControl   = animationMessage.Control as Control;
                bool    isWinFormControl = winFormControl != null;

                // Interpolate over the colours.
                foreach (Color newBackgroundColour in interpolatedColours)
                {
                    // Check exit condition.
                    if (animationMessage.PlayAnimation == false)
                    {
                        return;
                    }

                    // Set the BackColor
                    if (isWinFormControl)
                    {
                        winFormControl.Invoke((ChangeColorDelegate)ChangeColor, propertyInfo, winFormControl, newBackgroundColour);
                    }
                    else
                    {
                        propertyInfo.SetValue(animationMessage.Control, newBackgroundColour, null);
                    }

                    // Wait
                    await Task.Delay(interpolator.SleepTime);
                }
            } catch { }
        }