public EffectColorThemeComponent(ThemeComponentType componentType, string componentName, EffectColor componentEffectColor, bool componentTemporary) { ComponentType = componentType; ComponentName = componentName ?? throw new ArgumentException("Null parameters not allowed in EffectColorThemeComponent constructor"); EffectColor = componentEffectColor; Temporary = componentTemporary; }
private void ProfileImage_MouseDown(object sender, MouseButtonEventArgs e) { if (sender != null && sender is Image && (sender as Image).Tag != null && (sender as Image).Tag is ProfileManager) { if (e == null || e.LeftButton == MouseButtonState.Pressed) { this.FocusedProfile = (sender as Image).Tag as ProfileManager; var bitmap = (BitmapSource)(sender as Image).Source; var color = Utils.ColorUtils.GetAverageColor(bitmap); current_color = new EffectColor(color); current_color *= 0.85f; transitionamount = 0.0f; UpdateProfileStackBackground(sender as FrameworkElement); } else if (e.RightButton == MouseButtonState.Pressed) { this.cmenuProfiles.PlacementTarget = (Image)sender; this.cmenuProfiles.IsOpen = true; } } }
private void DesktopControl_MouseDown(object sender, MouseButtonEventArgs e) { this.FocusedApplication = null; SelectedControl = settingsControl; current_color = desktop_color_scheme; transitionamount = 0.0f; UpdateProfileStackBackground(sender as FrameworkElement); }
private void DesktopControl_MouseDown(object sender, MouseButtonEventArgs e) { this.content_grid.Children.Clear(); this.content_grid.Children.Add(settings_control); current_color = desktop_color_scheme; transitionamount = 0.0f; UpdateProfileStackBackground(sender as FrameworkElement); }
private void TransitionToProfile(Image source) { var bitmap = (BitmapSource)source.Source; var color = Utils.ColorUtils.GetAverageColor(bitmap); current_color = new EffectColor(color); current_color *= 0.85f; transitionamount = 0.0f; UpdateProfileStackBackground(source); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (!settingsloaded) { virtual_keyboard_timer = new Timer(100); virtual_keyboard_timer.Elapsed += new ElapsedEventHandler(virtual_keyboard_timer_Tick); virtual_keyboard_timer.Start(); settingsloaded = true; } this.keyboard_record_message.Visibility = Visibility.Hidden; current_color = desktop_color_scheme; bg_grid.Background = new SolidColorBrush(Color.FromRgb(desktop_color_scheme.Red, desktop_color_scheme.Green, desktop_color_scheme.Blue)); virtial_kb = Global.kbLayout.Virtual_keyboard; keyboard_grid.Children.Clear(); keyboard_grid.Children.Add(virtial_kb); keyboard_grid.Children.Add(new LayerEditor()); keyboard_grid.Width = virtial_kb.Width; this.Width = width + (virtial_kb.Width - virtual_keyboard_width); keyboard_grid.Height = virtial_kb.Height; this.Height = height + (virtial_kb.Height - virtual_keyboard_height); keyboard_grid.UpdateLayout(); keyboard_viewbox.MaxWidth = virtial_kb.Width + 50; keyboard_viewbox.MaxHeight = virtial_kb.Height + 50; keyboard_viewbox.UpdateLayout(); UpdateManagerStackFocus(ctrlLayerManager); this.UpdateLayout(); foreach (Image child in this.profiles_stack.Children) { if (child.Visibility == Visibility.Visible) { this.ProfileImage_MouseDown(child, null); break; } } }
private void AddProfile_MouseDown(object sender, MouseButtonEventArgs e) { Microsoft.Win32.OpenFileDialog exe_filedlg = new Microsoft.Win32.OpenFileDialog(); exe_filedlg.DefaultExt = ".exe"; exe_filedlg.Filter = "Executable Files (*.exe)|*.exe;"; Nullable <bool> result = exe_filedlg.ShowDialog(); if (result.HasValue && result == true) { string filename = System.IO.Path.GetFileName(exe_filedlg.FileName.ToLowerInvariant()); if (Global.Configuration.additional_profiles.ContainsKey(filename)) { System.Windows.MessageBox.Show("Profile for this application already exists."); } else { GenericApplicationProfileManager gen_app_pm = new GenericApplicationProfileManager(filename); System.Drawing.Icon ico = System.Drawing.Icon.ExtractAssociatedIcon(exe_filedlg.FileName.ToLowerInvariant()); if (!System.IO.Directory.Exists(gen_app_pm.GetProfileFolderPath())) { System.IO.Directory.CreateDirectory(gen_app_pm.GetProfileFolderPath()); } using (var icon_asbitmap = ico.ToBitmap()) { icon_asbitmap.Save(Path.Combine(gen_app_pm.GetProfileFolderPath(), "icon.png"), System.Drawing.Imaging.ImageFormat.Png); } ico.Dispose(); Global.Configuration.additional_profiles.Add(filename, gen_app_pm); ConfigManager.Save(Global.Configuration); GenerateProfileStack(); } this.content_grid.Children.Clear(); this.content_grid.Children.Add(new Profiles.Generic_Application.Control_GenericApplication(filename)); current_color = desktop_color_scheme; transitionamount = 0.0f; } }
private void ProfileImage_MouseDown(object sender, MouseButtonEventArgs e) { if (sender != null && sender is Image && (sender as Image).Tag != null && (sender as Image).Tag is UserControl) { UserControl tagged_control = (sender as Image).Tag as UserControl; this.content_grid.Children.Clear(); this.content_grid.Children.Add(tagged_control); var bitmap = (BitmapSource)(sender as Image).Source; var color = GetAverageColor(bitmap); current_color = new EffectColor(color); current_color *= 0.85f; transitionamount = 0.0f; UpdateProfileStackBackground(sender as FrameworkElement); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (!settingsloaded) { virtual_keyboard_timer = new Timer(100); virtual_keyboard_timer.Elapsed += new ElapsedEventHandler(virtual_keyboard_timer_Tick); virtual_keyboard_timer.Start(); settingsloaded = true; } this.keyboard_record_message.Visibility = Visibility.Hidden; this.content_grid.Children.Clear(); this.content_grid.Children.Add(desktop_control); current_color = desktop_color_scheme; bg_grid.Background = new SolidColorBrush(Color.FromRgb(desktop_color_scheme.Red, desktop_color_scheme.Green, desktop_color_scheme.Blue)); virtial_kb = Global.kbLayout.Virtual_keyboard; keyboard_grid.Children.Clear(); keyboard_grid.Children.Add(virtial_kb); keyboard_grid.Children.Add(new LayerEditor()); keyboard_grid.Width = virtial_kb.Width; this.MaxWidth = max_width + (virtial_kb.Width - virtual_keyboard_width); this.Width = this.MaxWidth; keyboard_grid.Height = virtial_kb.Height; this.MaxHeight = max_height + (virtial_kb.Height - virtual_keyboard_height); this.Height = this.MaxHeight; keyboard_grid.UpdateLayout(); this.UpdateLayout(); Global.input_subscriptions.Initialize(); }
public override void UpdateLights(EffectFrame frame) { previoustime = currenttime; currenttime = Utils.Time.GetMillisecondsSinceEpoch(); Queue <EffectLayer> layers = new Queue <EffectLayer>(); EffectLayer layer; effect_cfg.speed = Global.Configuration.idle_speed; switch (Global.Configuration.idle_type) { case IdleEffects.Dim: layer = new EffectLayer("Idle - Dim"); layer.Fill(Color.FromArgb(125, 0, 0, 0)); layers.Enqueue(layer); break; case IdleEffects.ColorBreathing: layer = new EffectLayer("Idle - Color Breathing"); Color breathe_bg_color = Global.Configuration.idle_effect_secondary_color; layer.Fill(breathe_bg_color); float sine = (float)Math.Pow(Math.Sin((double)((currenttime % 10000L) / 10000.0f) * 2 * Math.PI * Global.Configuration.idle_speed), 2); layer.Fill(Color.FromArgb((byte)(sine * 255), Global.Configuration.idle_effect_primary_color)); layers.Enqueue(layer); break; case IdleEffects.RainbowShift_Horizontal: layer = new EffectLayer("Idle - Rainbow Shift (Horizontal)", LayerEffects.RainbowShift_Horizontal, effect_cfg); layers.Enqueue(layer); break; case IdleEffects.RainbowShift_Vertical: layer = new EffectLayer("Idle - Rainbow Shift (Vertical)", LayerEffects.RainbowShift_Vertical, effect_cfg); layers.Enqueue(layer); break; case IdleEffects.StarFall: layer = new EffectLayer("Idle - Starfall"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (stars.ContainsKey(star)) { stars[star] = 1.0f; } else { stars.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); Devices.DeviceKeys[] stars_keys = stars.Keys.ToArray(); foreach (Devices.DeviceKeys star in stars_keys) { layer.Set(star, Utils.ColorUtils.MultiplyColorByScalar(Global.Configuration.idle_effect_primary_color, stars[star])); stars[star] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; } layers.Enqueue(layer); break; case IdleEffects.RainFall: layer = new EffectLayer("Idle - Rainfall"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (raindrops.ContainsKey(star)) { raindrops[star] = 1.0f; } else { raindrops.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); Devices.DeviceKeys[] raindrops_keys = raindrops.Keys.ToArray(); ColorSpectrum drop_spec = new ColorSpectrum(Global.Configuration.idle_effect_primary_color, Color.FromArgb(0, Global.Configuration.idle_effect_primary_color)); foreach (Devices.DeviceKeys raindrop in raindrops_keys) { PointF pt = Effects.GetBitmappingFromDeviceKey(raindrop).Center; float transition_value = 1.0f - raindrops[raindrop]; float radius = transition_value * Effects.canvas_biggest; layer.GetGraphics().DrawEllipse(new Pen(drop_spec.GetColorAt(transition_value), 2), pt.X - radius, pt.Y - radius, 2 * radius, 2 * radius); raindrops[raindrop] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; } layers.Enqueue(layer); break; case IdleEffects.Blackout: layer = new EffectLayer("Idle - Blackout"); layer.Fill(Color.Black); layers.Enqueue(layer); break; case IdleEffects.Matrix: layer = new EffectLayer("Idle - Matrix"); if (nextstarset < currenttime) { Color darker_primary = Utils.ColorUtils.MultiplyColorByScalar(Global.Configuration.idle_effect_primary_color, 0.50); for (int x = 0; x < Global.Configuration.idle_amount; x++) { int width_start = randomizer.Next(Effects.canvas_width); float delay = randomizer.Next(550) / 100.0f; int random_id = randomizer.Next(125536789); //Create animation AnimationTrack matrix_line = new AnimationTrack("Matrix Line (Head) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, -3, width_start, 0, Global.Configuration.idle_effect_primary_color, 3)).SetFrame( 0.5f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height + 3, Global.Configuration.idle_effect_primary_color, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); AnimationTrack matrix_line_trail = new AnimationTrack("Matrix Line (Trail) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, -12, width_start, -3, darker_primary, 3)).SetFrame( 0.5f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height - 12, width_start, Effects.canvas_height, darker_primary, 3)).SetFrame( 0.75f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height, darker_primary, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); matrix_lines.AddTrack(matrix_line); matrix_lines.AddTrack(matrix_line_trail); } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); using (Graphics g = layer.GetGraphics()) { matrix_lines.Draw(g, (currenttime % 1000000L) / 1000.0f); } layers.Enqueue(layer); break; case IdleEffects.RainFallSmooth: layer = new EffectLayer("Idle - RainfallSmooth"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (raindrops.ContainsKey(star)) { raindrops[star] = 1.0f; } else { raindrops.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); ColorSpectrum drop_spec2 = new ColorSpectrum( Global.Configuration.idle_effect_primary_color, Color.FromArgb(0, Global.Configuration.idle_effect_primary_color)); var drops = raindrops.Keys.ToArray().Select(d => { PointF pt = Effects.GetBitmappingFromDeviceKey(d).Center; float transitionValue = 1.0f - raindrops[d]; float radius = transitionValue * Effects.canvas_biggest; raindrops[d] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; return(new Tuple <Devices.DeviceKeys, PointF, float, float>(d, pt, transitionValue, radius)); }).Where(d => d.Item3 <= 1.5).ToArray(); float circleHalfThickness = 1f; foreach (var key in allKeys) { var keyInfo = Effects.GetBitmappingFromDeviceKey(key); // For easy calculation every button considered as circle with this radius var btnRadius = ((keyInfo.Width + keyInfo.Height) / 4f); if (btnRadius <= 0) { continue; } foreach (var raindrop in drops) { float circleInEdge = (raindrop.Item4 - circleHalfThickness); float circleOutEdge = (raindrop.Item4 + circleHalfThickness); circleInEdge *= circleInEdge; circleOutEdge *= circleOutEdge; float xKey = Math.Abs(keyInfo.Center.X - raindrop.Item2.X); float yKey = Math.Abs(keyInfo.Center.Y - raindrop.Item2.Y); float xKeyInEdge = xKey - btnRadius; float xKeyOutEdge = xKey + btnRadius; float yKeyInEdge = yKey - btnRadius; float yKeyOutEdge = yKey + btnRadius; float keyInEdge = xKeyInEdge * xKeyInEdge + yKeyInEdge * yKeyInEdge; float keyOutEdge = xKeyOutEdge * xKeyOutEdge + yKeyOutEdge * yKeyOutEdge; var btnDiameter = keyOutEdge - keyInEdge; var inEdgePercent = (circleOutEdge - keyInEdge) / btnDiameter; var outEdgePercent = (keyOutEdge - circleInEdge) / btnDiameter; var percent = Math.Min(1, Math.Max(0, inEdgePercent)) + Math.Min(1, Math.Max(0, outEdgePercent)) - 1f; if (percent > 0) { layer.Set(key, (Color)EffectColor.BlendColors( new EffectColor(layer.Get(key)), new EffectColor(drop_spec2.GetColorAt(raindrop.Item3)), percent)); } } } layers.Enqueue(layer); break; default: break; } frame.AddOverlayLayers(layers.ToArray()); }
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, EffectColor componentEffectColor, bool componentTemporary) { if (ComponentExists(componentType, componentName)) { return(Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType)); } var component = new EffectColorThemeComponent(componentType, componentName, componentEffectColor, componentTemporary); Items.Add(component); return(component); }
public PlayEffectBlockItem(EffectColor effectColor, bool temporary) : base(effectColor, temporary) { }
public ColorEffect(IEnumerable <int> fixtures, EffectColor color) { Fixtures = fixtures; Color = color; }
protected EffectColorBlockItem(EffectColor color, bool temporary) { Color = color; Temporary = temporary; }