Exemple #1
0
        /// <summary>
        /// Applies the hue colour onto the specified buffer.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="hueColor">The hue color.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        private static void ApplyHue(byte[] buffer, CallHandler.HueColor hueColor, int width, int height)
        {
            int widthXheight = width * height;

            for (var index = widthXheight; index < widthXheight * 3 / 2; index += 2)
            {
                switch (hueColor)
                {
                case CallHandler.HueColor.Red:
                    AddWithoutRollover(buffer, index, -16);
                    AddWithoutRollover(buffer, index + 1, 50);
                    break;

                case CallHandler.HueColor.Blue:
                    AddWithoutRollover(buffer, index, 50);
                    AddWithoutRollover(buffer, index + 1, -8);
                    break;

                case CallHandler.HueColor.Green:
                    AddWithoutRollover(buffer, index, -33);
                    AddWithoutRollover(buffer, index + 1, -41);
                    break;

                default: break;
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Applies the hue colour onto the specified buffer.
 /// </summary>
 /// <param name="videoMediaBuffer">The video media buffer.</param>
 /// <param name="hueColor">Color of the hue.</param>
 /// <returns>The media buffer byte array.</returns>
 public static byte[] ApplyHue(this VideoMediaBuffer videoMediaBuffer, CallHandler.HueColor hueColor)
 {
     byte[] buffer = new byte[videoMediaBuffer.VideoFormat.Width * videoMediaBuffer.VideoFormat.Height * 12 / 8];
     Marshal.Copy(videoMediaBuffer.Data, buffer, 0, buffer.Length);
     ApplyHue(buffer, hueColor, videoMediaBuffer.VideoFormat.Width, videoMediaBuffer.VideoFormat.Height);
     return(buffer);
 }