mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile editor - Clarified which LEDs are part of the selected layer
Profile editor - Re-implemented LED dimming Profile editor - Hide layer bounds of unselected layers Profile editor - Dim layer shapes of unselected layers (option to hide them NYI) Profile editor - Disable edit tool when no layer is selected or the selected layer has no LEDs Gradient picker - Fixed the preview being at a slight angle Color brush - Fixed the gradient being at a 45 degree angle Settings - Added color scheme option to manually switch between light and dark
This commit is contained in:
1 parent
368aebe1d0
commit
21600a946c
17 files changed
+337
-99
No files matched your search
@@ -1,12 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using RGB.NET.Core;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Shared.Controls
|
||||
{
|
||||
@@ -18,6 +20,9 @@ namespace Artemis.UI.Shared.Controls
|
||||
public static readonly DependencyProperty ShowColorsProperty = DependencyProperty.Register(nameof(ShowColors), typeof(bool), typeof(DeviceVisualizer),
|
||||
new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.AffectsRender, ShowColorsPropertyChangedCallback));
|
||||
|
||||
public static readonly DependencyProperty HighlightedLedsProperty = DependencyProperty.Register(nameof(HighlightedLeds), typeof(IEnumerable<ArtemisLed>), typeof(DeviceVisualizer),
|
||||
new FrameworkPropertyMetadata(default(IEnumerable<ArtemisLed>)));
|
||||
|
||||
private readonly DrawingGroup _backingStore;
|
||||
private readonly List<DeviceVisualizerLed> _deviceVisualizerLeds;
|
||||
private BitmapImage _deviceImage;
|
||||
@@ -57,6 +62,12 @@ namespace Artemis.UI.Shared.Controls
|
||||
set => SetValue(ShowColorsProperty, value);
|
||||
}
|
||||
|
||||
public IEnumerable<ArtemisLed> HighlightedLeds
|
||||
{
|
||||
get => (IEnumerable<ArtemisLed>) GetValue(HighlightedLedsProperty);
|
||||
set => SetValue(HighlightedLedsProperty, value);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
RGBSurface.Instance.Updated -= RgbSurfaceOnUpdated;
|
||||
@@ -159,8 +170,17 @@ namespace Artemis.UI.Shared.Controls
|
||||
{
|
||||
var drawingContext = _backingStore.Open();
|
||||
|
||||
foreach (var deviceVisualizerLed in _deviceVisualizerLeds)
|
||||
deviceVisualizerLed.RenderColor(drawingContext);
|
||||
if (HighlightedLeds.Any())
|
||||
{
|
||||
foreach (var deviceVisualizerLed in _deviceVisualizerLeds)
|
||||
deviceVisualizerLed.RenderColor(drawingContext, !HighlightedLeds.Contains(deviceVisualizerLed.Led));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var deviceVisualizerLed in _deviceVisualizerLeds)
|
||||
deviceVisualizerLed.RenderColor(drawingContext, false);
|
||||
}
|
||||
|
||||
|
||||
drawingContext.Close();
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Artemis.UI.Shared.Controls
|
||||
|
||||
if (Led.RgbLed.Image != null && File.Exists(Led.RgbLed.Image.AbsolutePath))
|
||||
LedImage = new BitmapImage(Led.RgbLed.Image);
|
||||
|
||||
|
||||
CreateLedGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ArtemisLed Led { get; }
|
||||
public Rect LedRect { get; set; }
|
||||
public BitmapImage LedImage { get; set; }
|
||||
@@ -60,7 +60,6 @@ namespace Artemis.UI.Shared.Controls
|
||||
// Stroke geometry is the display geometry excluding the inner geometry
|
||||
DisplayGeometry.Transform = new TranslateTransform(Led.RgbLed.LedRectangle.Location.X, Led.RgbLed.LedRectangle.Location.Y);
|
||||
// Try to gain some performance
|
||||
DisplayGeometry = DisplayGeometry.GetFlattenedPathGeometry();
|
||||
DisplayGeometry.Freeze();
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ namespace Artemis.UI.Shared.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public void RenderColor(DrawingContext drawingContext)
|
||||
public void RenderColor(DrawingContext drawingContext, bool isDimmed)
|
||||
{
|
||||
if (DisplayGeometry == null)
|
||||
return;
|
||||
@@ -111,8 +110,10 @@ namespace Artemis.UI.Shared.Controls
|
||||
var r = Led.RgbLed.Color.GetR();
|
||||
var g = Led.RgbLed.Color.GetG();
|
||||
var b = Led.RgbLed.Color.GetB();
|
||||
|
||||
drawingContext.DrawRectangle(new SolidColorBrush(Color.FromRgb(r, g, b)), null, LedRect);
|
||||
|
||||
drawingContext.DrawRectangle(isDimmed
|
||||
? new SolidColorBrush(Color.FromArgb(100, r, g, b))
|
||||
: new SolidColorBrush(Color.FromRgb(r, g, b)), null, LedRect);
|
||||
}
|
||||
|
||||
public void RenderImage(DrawingContext drawingContext)
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
Background="{StaticResource Checkerboard}">
|
||||
<Rectangle Stroke="{DynamicResource NormalBorderBrush}" Cursor="Hand" MouseUp="UIElement_OnMouseUp">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush GradientStops="{Binding ColorGradient.Stops, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource ColorGradientToGradientStopsConverter}}" />
|
||||
<LinearGradientBrush GradientStops="{Binding ColorGradient.Stops, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource ColorGradientToGradientStopsConverter}}"
|
||||
EndPoint="1,0"
|
||||
StartPoint="0,0"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</Border>
|
||||
|
||||
@@ -53,7 +53,9 @@
|
||||
utilities:SizeObserver.ObservedWidth="{Binding PreviewWidth, Mode=OneWayToSource}">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush
|
||||
GradientStops="{Binding ColorGradient.Stops, Converter={StaticResource ColorGradientToGradientStopsConverter}}" />
|
||||
GradientStops="{Binding ColorGradient.Stops, Converter={StaticResource ColorGradientToGradientStopsConverter}}"
|
||||
EndPoint="1,0"
|
||||
StartPoint="0,0"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
|
||||
|
||||
Reference in new issue
Block a user