// Process keyboard input static bool HandleKeyboard() { if (Console.KeyAvailable) { var key = Console.ReadKey(false); var cb = new Gst.Video.ColorBalanceAdapter(Pipeline.Handle); switch (key.Key) { case ConsoleKey.C: UpdateColorChannel("CONTRAST", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.B: UpdateColorChannel("BRIGHTNESS", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.H: UpdateColorChannel("HUE", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.S: UpdateColorChannel("SATURATION", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.Q: MainLoop.Quit(); break; } PrintCurrentValues(); } return(true); }
// Process keyboard input static bool HandleKeyboard() { if (Console.KeyAvailable) { var key = Console.ReadKey (false); var cb = new Gst.Video.ColorBalanceAdapter (Pipeline.Handle); switch (key.Key) { case ConsoleKey.C: UpdateColorChannel ("CONTRAST", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.B: UpdateColorChannel ("BRIGHTNESS", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.H: UpdateColorChannel ("HUE", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.S: UpdateColorChannel ("SATURATION", key.Modifiers == ConsoleModifiers.Shift, cb); break; case ConsoleKey.Q: MainLoop.Quit (); break; } PrintCurrentValues (); } return true; }
// Output the current values of all Color Balance channels static void PrintCurrentValues() { // Output Color Balance value var cb = new Gst.Video.ColorBalanceAdapter(Pipeline.Handle); var channels = cb.ListChannels(); foreach (var ch in channels) { var value = cb.GetValue(ch); Console.WriteLine("{0}: {1}", ch.Label, 100 * (value - ch.MinValue) / (ch.MaxValue - ch.MinValue)); } Console.WriteLine(); }
// Output the current values of all Color Balance channels static void PrintCurrentValues() { // Output Color Balance value var cb = new Gst.Video.ColorBalanceAdapter (Pipeline.Handle); var channels = cb.ListChannels (); foreach (var ch in channels) { var value = cb.GetValue (ch); Console.WriteLine ("{0}: {1}", ch.Label, 100 * (value - ch.MinValue) / (ch.MaxValue - ch.MinValue)); } Console.WriteLine (); }