mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Reworked rendering
This commit is contained in:
parent
d5c9ec2e26
commit
13afc29987
@ -1,121 +0,0 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using RGB.NET.Brushes.Gradients;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes
|
||||
{
|
||||
/// <inheritdoc cref="AbstractBrush" />
|
||||
/// <inheritdoc cref="IGradientBrush" />
|
||||
/// <summary>
|
||||
/// Represents a brush drawing a conical gradient.
|
||||
/// </summary>
|
||||
public class ConicalGradientBrush : AbstractBrush, IGradientBrush
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private float _origin = (float)Math.Atan2(-1, 0);
|
||||
/// <summary>
|
||||
/// Gets or sets the origin (radian-angle) this <see cref="ConicalGradientBrush"/> is drawn to. (default: -π/2)
|
||||
/// </summary>
|
||||
public float Origin
|
||||
{
|
||||
get => _origin;
|
||||
set => SetProperty(ref _origin, value);
|
||||
}
|
||||
|
||||
private Point _center = new(0.5, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the center <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="ConicalGradientBrush"/>. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
public Point Center
|
||||
{
|
||||
get => _center;
|
||||
set => SetProperty(ref _center, value);
|
||||
}
|
||||
|
||||
private IGradient? _gradient;
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Gets or sets the gradient drawn by the brush. If null it will default to full transparent.
|
||||
/// </summary>
|
||||
public IGradient? Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.ConicalGradientBrush" /> class.
|
||||
/// </summary>
|
||||
public ConicalGradientBrush()
|
||||
{ }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.ConicalGradientBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Brushes.ConicalGradientBrush" />.</param>
|
||||
public ConicalGradientBrush(IGradient gradient)
|
||||
{
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.ConicalGradientBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="center">The center <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Brushes.ConicalGradientBrush" />.</param>
|
||||
public ConicalGradientBrush(Point center, IGradient gradient)
|
||||
{
|
||||
this.Center = center;
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.ConicalGradientBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="center">The center <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="origin">The origin (radian-angle) the <see cref="T:RGB.NET.Core.IBrush" /> is drawn to.</param>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Brushes.ConicalGradientBrush" />.</param>
|
||||
public ConicalGradientBrush(Point center, float origin, IGradient gradient)
|
||||
{
|
||||
this.Center = center;
|
||||
this.Origin = origin;
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget)
|
||||
{
|
||||
if (Gradient == null) return Color.Transparent;
|
||||
|
||||
double centerX = rectangle.Size.Width * Center.X;
|
||||
double centerY = rectangle.Size.Height * Center.Y;
|
||||
|
||||
double angle = Math.Atan2(renderTarget.Point.Y - centerY, renderTarget.Point.X - centerX) - Origin;
|
||||
if (angle < 0) angle += Math.PI * 2;
|
||||
double offset = angle / (Math.PI * 2);
|
||||
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
using RGB.NET.Brushes.Gradients;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a basic gradient-brush.
|
||||
/// </summary>
|
||||
public interface IGradientBrush : IBrush
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IGradient"/> used by this <see cref="IGradientBrush"/>.
|
||||
/// </summary>
|
||||
IGradient? Gradient { get; }
|
||||
}
|
||||
}
|
||||
@ -1,109 +0,0 @@
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using RGB.NET.Brushes.Gradients;
|
||||
using RGB.NET.Brushes.Helper;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes
|
||||
{
|
||||
/// <inheritdoc cref="AbstractBrush" />
|
||||
/// <inheritdoc cref="IGradientBrush" />
|
||||
/// <summary>
|
||||
/// Represents a brush drawing a linear gradient.
|
||||
/// </summary>
|
||||
public class LinearGradientBrush : AbstractBrush, IGradientBrush
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _startPoint = new(0, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the start <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="LinearGradientBrush"/>. (default: 0.0, 0.5)
|
||||
/// </summary>
|
||||
public Point StartPoint
|
||||
{
|
||||
get => _startPoint;
|
||||
set => SetProperty(ref _startPoint, value);
|
||||
}
|
||||
|
||||
private Point _endPoint = new(1, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the end <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="LinearGradientBrush"/>. (default: 1.0, 0.5)
|
||||
/// </summary>
|
||||
public Point EndPoint
|
||||
{
|
||||
get => _endPoint;
|
||||
set => SetProperty(ref _endPoint, value);
|
||||
}
|
||||
|
||||
private IGradient? _gradient;
|
||||
/// <inheritdoc />
|
||||
public IGradient? Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.LinearGradientBrush" /> class.
|
||||
/// </summary>
|
||||
public LinearGradientBrush()
|
||||
{ }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.LinearGradientBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Brushes.LinearGradientBrush" />.</param>
|
||||
public LinearGradientBrush(IGradient gradient)
|
||||
{
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.LinearGradientBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="startPoint">The start <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="endPoint">The end <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Brushes.LinearGradientBrush" />.</param>
|
||||
public LinearGradientBrush(Point startPoint, Point endPoint, IGradient gradient)
|
||||
{
|
||||
this.StartPoint = startPoint;
|
||||
this.EndPoint = endPoint;
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Gets the color at an specific point assuming the brush is drawn into the given rectangle.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The rectangle in which the brush should be drawn.</param>
|
||||
/// <param name="renderTarget">The target (key/point) from which the color should be taken.</param>
|
||||
/// <returns>The color at the specified point.</returns>
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget)
|
||||
{
|
||||
if (Gradient == null) return Color.Transparent;
|
||||
|
||||
Point startPoint = new(StartPoint.X * rectangle.Size.Width, StartPoint.Y * rectangle.Size.Height);
|
||||
Point endPoint = new(EndPoint.X * rectangle.Size.Width, EndPoint.Y * rectangle.Size.Height);
|
||||
|
||||
double offset = GradientHelper.CalculateLinearGradientOffset(startPoint, endPoint, renderTarget.Point);
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,97 +0,0 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using RGB.NET.Brushes.Gradients;
|
||||
using RGB.NET.Brushes.Helper;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes
|
||||
{
|
||||
/// <inheritdoc cref="AbstractBrush" />
|
||||
/// <inheritdoc cref="IGradientBrush" />
|
||||
/// <summary>
|
||||
/// Represents a brush drawing a radial gradient around a center point.
|
||||
/// </summary>
|
||||
public class RadialGradientBrush : AbstractBrush, IGradientBrush
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _center = new(0.5, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the center <see cref="Point"/> (as percentage in the range [0..1]) around which the <see cref="RadialGradientBrush"/> should be drawn. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
public Point Center
|
||||
{
|
||||
get => _center;
|
||||
set => SetProperty(ref _center, value);
|
||||
}
|
||||
|
||||
private IGradient? _gradient;
|
||||
/// <inheritdoc />
|
||||
public IGradient? Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.RadialGradientBrush" /> class.
|
||||
/// </summary>
|
||||
public RadialGradientBrush()
|
||||
{ }
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.RadialGradientBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="gradient">The gradient drawn by the brush.</param>
|
||||
public RadialGradientBrush(IGradient gradient)
|
||||
{
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.RadialGradientBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="center">The center point (as percentage in the range [0..1]).</param>
|
||||
/// <param name="gradient">The gradient drawn by the brush.</param>
|
||||
public RadialGradientBrush(Point center, IGradient gradient)
|
||||
{
|
||||
this.Center = center;
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget)
|
||||
{
|
||||
if (Gradient == null) return Color.Transparent;
|
||||
|
||||
Point centerPoint = new(rectangle.Location.X + (rectangle.Size.Width * Center.X), rectangle.Location.Y + (rectangle.Size.Height * Center.Y));
|
||||
|
||||
// Calculate the distance to the farthest point from the center as reference (this has to be a corner)
|
||||
// ReSharper disable once RedundantCast - never trust this ...
|
||||
double refDistance = Math.Max(Math.Max(Math.Max(GradientHelper.CalculateDistance(rectangle.Location, centerPoint),
|
||||
GradientHelper.CalculateDistance(new Point(rectangle.Location.X + rectangle.Size.Width, rectangle.Location.Y), centerPoint)),
|
||||
GradientHelper.CalculateDistance(new Point(rectangle.Location.X, rectangle.Location.Y + rectangle.Size.Height), centerPoint)),
|
||||
GradientHelper.CalculateDistance(new Point(rectangle.Location.X + rectangle.Size.Width, rectangle.Location.Y + rectangle.Size.Height), centerPoint));
|
||||
|
||||
double distance = GradientHelper.CalculateDistance(renderTarget.Point, centerPoint);
|
||||
double offset = distance / refDistance;
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<Authors>Darth Affe</Authors>
|
||||
<Company>Wyrez</Company>
|
||||
<Language>en-US</Language>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Title>RGB.NET.Brushes</Title>
|
||||
<AssemblyName>RGB.NET.Brushes</AssemblyName>
|
||||
<AssemblyTitle>RGB.NET.Brushes</AssemblyTitle>
|
||||
<PackageId>RGB.NET.Brushes</PackageId>
|
||||
<RootNamespace>RGB.NET.Brushes</RootNamespace>
|
||||
<Description>Brushes-Presets of RGB.NET</Description>
|
||||
<Summary>Brushes-Presets of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
|
||||
<Copyright>Copyright © Darth Affe 2020</Copyright>
|
||||
<PackageCopyright>Copyright © Darth Affe 2020</PackageCopyright>
|
||||
<PackageIconUrl>http://lib.arge.be/icon.png</PackageIconUrl>
|
||||
<PackageProjectUrl>https://github.com/DarthAffe/RGB.NET</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE</PackageLicenseUrl>
|
||||
<RepositoryType>Github</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/DarthAffe/RGB.NET</RepositoryUrl>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
|
||||
<PackageReleaseNotes></PackageReleaseNotes>
|
||||
|
||||
<Version>0.0.1</Version>
|
||||
<AssemblyVersion>0.0.1</AssemblyVersion>
|
||||
<FileVersion>0.0.1</FileVersion>
|
||||
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IncludeSource>True</IncludeSource>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -11,6 +11,6 @@ namespace RGB.NET.Core
|
||||
/// Applies the <see cref="IColorCorrection"/> to the given <see cref="Color"/>.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="Color"/> to correct.</param>
|
||||
Color ApplyTo(Color color);
|
||||
void ApplyTo(ref Color color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@
|
||||
/// <param name="rectangle">The rectangle in which the <see cref="IBrush"/> should be drawn.</param>
|
||||
/// <param name="renderTarget">The target (key/point) from which the <see cref="Color"/> should be taken.</param>
|
||||
/// <param name="color">The <see cref="Color"/> to be modified.</param>
|
||||
Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color);
|
||||
void ManipulateColor(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,9 @@ namespace RGB.NET.Core
|
||||
/// <inheritdoc />
|
||||
IRGBDeviceInfo IRGBDevice.DeviceInfo => DeviceInfo;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IList<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the device needs to be flushed on every update.
|
||||
/// </summary>
|
||||
|
||||
@ -20,6 +20,8 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
IRGBDeviceInfo DeviceInfo { get; }
|
||||
|
||||
IList<IColorCorrection> ColorCorrections { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Indexer
|
||||
|
||||
@ -59,7 +59,7 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
/// <param name="intersectingRect">The intersecting rectangle.</param>
|
||||
/// <returns>The percentage of intersection.</returns>
|
||||
public static double CalculateIntersectPercentage(this Rectangle rect, Rectangle intersectingRect)
|
||||
public static double CalculateIntersectPercentage(this Rectangle rect, in Rectangle intersectingRect)
|
||||
{
|
||||
if (rect.IsEmpty || intersectingRect.IsEmpty) return 0;
|
||||
|
||||
@ -72,7 +72,7 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
/// <param name="intersectingRectangle">The intersecting <see cref="Rectangle"/></param>
|
||||
/// <returns>A new <see cref="Rectangle"/> representing the intersection this <see cref="Rectangle"/> and the one provided as parameter.</returns>
|
||||
public static Rectangle CalculateIntersection(this Rectangle rect, Rectangle intersectingRectangle)
|
||||
public static Rectangle CalculateIntersection(this Rectangle rect, in Rectangle intersectingRectangle)
|
||||
{
|
||||
double x1 = Math.Max(rect.Location.X, intersectingRectangle.Location.X);
|
||||
double x2 = Math.Min(rect.Location.X + rect.Size.Width, intersectingRectangle.Location.X + intersectingRectangle.Size.Width);
|
||||
@ -91,7 +91,7 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
/// <param name="point">The <see cref="Point"/> to test.</param>
|
||||
/// <returns><c>true</c> if the rectangle contains the given point; otherwise <c>false</c>.</returns>
|
||||
public static bool Contains(this Rectangle rect, Point point) => rect.Contains(point.X, point.Y);
|
||||
public static bool Contains(this Rectangle rect, in Point point) => rect.Contains(point.X, point.Y);
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the specified location is contained within this <see cref="Rectangle"/>.
|
||||
@ -107,7 +107,7 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
/// <param name="rect">The <see cref="Rectangle"/> to test.</param>
|
||||
/// <returns><c>true</c> if the rectangle contains the given rect; otherwise <c>false</c>.</returns>
|
||||
public static bool Contains(this Rectangle rect, Rectangle rect2) => (rect.Location.X <= rect2.Location.X) && ((rect2.Location.X + rect2.Size.Width) <= (rect.Location.X + rect.Size.Width))
|
||||
public static bool Contains(this Rectangle rect, in Rectangle rect2) => (rect.Location.X <= rect2.Location.X) && ((rect2.Location.X + rect2.Size.Width) <= (rect.Location.X + rect.Size.Width))
|
||||
&& (rect.Location.Y <= rect2.Location.Y) && ((rect2.Location.Y + rect2.Size.Height) <= (rect.Location.Y + rect.Size.Height));
|
||||
|
||||
/// <summary>
|
||||
@ -116,7 +116,7 @@ namespace RGB.NET.Core
|
||||
/// <param name="rect">The <see cref="Rectangle"/> to move.</param>
|
||||
/// <param name="point">The amount to move.</param>
|
||||
/// <returns>The moved rectangle.</returns>
|
||||
public static Rectangle Translate(this Rectangle rect, Point point) => rect.Translate(point.X, point.Y);
|
||||
public static Rectangle Translate(this Rectangle rect, in Point point) => rect.Translate(point.X, point.Y);
|
||||
|
||||
/// <summary>
|
||||
/// Moves the specified <see cref="Rectangle"/> by the given amount.
|
||||
@ -141,7 +141,7 @@ namespace RGB.NET.Core
|
||||
/// <param name="rotation">The rotation.</param>
|
||||
/// <param name="origin">The origin to rotate around. [0,0] if not set.</param>
|
||||
/// <returns>A array of <see cref="Point"/> containing the new locations of the corners of the original rectangle.</returns>
|
||||
public static Point[] Rotate(this Rectangle rect, Rotation rotation, Point origin = new())
|
||||
public static Point[] Rotate(this Rectangle rect, in Rotation rotation, in Point origin = new())
|
||||
{
|
||||
Point[] points = {
|
||||
rect.Location, // top left
|
||||
|
||||
@ -2,9 +2,8 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Groups
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
@ -151,18 +151,6 @@ namespace RGB.NET.Core
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the <see cref="Led"/> back to default.
|
||||
/// </summary>
|
||||
internal void Reset()
|
||||
{
|
||||
_color = Color.Transparent;
|
||||
RequestedColor = null;
|
||||
|
||||
// ReSharper disable once ExplicitCallerInfoArgument
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
@ -179,7 +179,7 @@ namespace RGB.NET.Core
|
||||
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Rectangle" /> equivalent to this <see cref="Rectangle" />; otherwise, <c>false</c>.</returns>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (!(obj is Rectangle compareRect))
|
||||
if (obj is not Rectangle compareRect)
|
||||
return false;
|
||||
|
||||
if (GetType() != compareRect.GetType())
|
||||
@ -222,6 +222,15 @@ namespace RGB.NET.Core
|
||||
/// <returns><c>true</c> if <paramref name="rectangle1" /> and <paramref name="rectangle2" /> are not equal; otherwise, <c>false</c>.</returns>
|
||||
public static bool operator !=(Rectangle rectangle1, Rectangle rectangle2) => !(rectangle1 == rectangle2);
|
||||
|
||||
// DarthAffe 20.02.2021: Used for normalization
|
||||
public static Rectangle operator /(Rectangle rectangle1, Rectangle rectangle2)
|
||||
{
|
||||
double x = rectangle1.Location.X / (rectangle2.Size.Width - rectangle2.Location.X);
|
||||
double y = rectangle1.Location.Y / (rectangle2.Size.Height - rectangle2.Location.Y);
|
||||
Size size = rectangle1.Size / rectangle2.Size;
|
||||
return new Rectangle(new Point(x, y), size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=leds/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mvvm/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=positioning/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rendering/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rendering_005Cbrushes/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rendering_005Ctextures/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rendering_005Ctextures_005Csampler/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=surfaces/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=update/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=update_005Cdevices/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@ -201,6 +201,7 @@ namespace RGB.NET.Core
|
||||
/// Renders a ledgroup.
|
||||
/// </summary>
|
||||
/// <param name="ledGroup">The led group to render.</param>
|
||||
/// <exception cref="ArgumentException">Thrown if the <see cref="IBrush.CalculationMode"/> of the Brush is not valid.</exception>
|
||||
private void Render(ILedGroup ledGroup)
|
||||
{
|
||||
IList<Led> leds = ledGroup.GetLeds().ToList();
|
||||
@ -208,26 +209,30 @@ namespace RGB.NET.Core
|
||||
|
||||
if ((brush == null) || !brush.IsEnabled) return;
|
||||
|
||||
switch (brush.BrushCalculationMode)
|
||||
IEnumerable<(RenderTarget renderTarget, Color color)> render;
|
||||
switch (brush.CalculationMode)
|
||||
{
|
||||
case BrushCalculationMode.Relative:
|
||||
case RenderMode.Relative:
|
||||
Rectangle brushRectangle = new(leds.Select(led => led.AbsoluteBoundary));
|
||||
Point offset = new(-brushRectangle.Location.X, -brushRectangle.Location.Y);
|
||||
brushRectangle = brushRectangle.SetLocation(new Point(0, 0));
|
||||
brush.PerformRender(brushRectangle, leds.Select(led => new BrushRenderTarget(led, led.AbsoluteBoundary.Translate(offset))));
|
||||
render = brush.Render(brushRectangle, leds.Select(led => new RenderTarget(led, led.AbsoluteBoundary.Translate(offset))));
|
||||
break;
|
||||
case BrushCalculationMode.Absolute:
|
||||
brush.PerformRender(Boundary, leds.Select(led => new BrushRenderTarget(led, led.AbsoluteBoundary)));
|
||||
case RenderMode.Absolute:
|
||||
render = brush.Render(Boundary, leds.Select(led => new RenderTarget(led, led.AbsoluteBoundary)));
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException();
|
||||
throw new ArgumentException($"The CalculationMode '{brush.CalculationMode}' is not valid.");
|
||||
}
|
||||
|
||||
//brush.UpdateEffects();
|
||||
brush.PerformFinalize();
|
||||
foreach ((RenderTarget renderTarget, Color c) in render)
|
||||
{
|
||||
Color color = c;
|
||||
foreach (IColorCorrection colorCorrection in renderTarget.Led.Device.ColorCorrections)
|
||||
colorCorrection.ApplyTo(ref color);
|
||||
|
||||
foreach (KeyValuePair<BrushRenderTarget, Color> renders in brush.RenderedTargets)
|
||||
renders.Key.Led.Color = renders.Value;
|
||||
renderTarget.Led.Color = color;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -303,7 +308,7 @@ namespace RGB.NET.Core
|
||||
{
|
||||
lock (_devices)
|
||||
{
|
||||
if (!_devices.Contains(device)) throw new RGBSurfaceException($"The device '{device.DeviceInfo.Manufacturer} {device.DeviceInfo.Model}' isn't not attached to this surface.");
|
||||
if (!_devices.Contains(device)) throw new RGBSurfaceException($"The device '{device.DeviceInfo.Manufacturer} {device.DeviceInfo.Model}' is not attached to this surface.");
|
||||
|
||||
device.BoundaryChanged -= DeviceOnBoundaryChanged;
|
||||
device.Surface = null;
|
||||
|
||||
@ -20,7 +20,7 @@ namespace RGB.NET.Core
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public BrushCalculationMode BrushCalculationMode { get; set; } = BrushCalculationMode.Relative;
|
||||
public RenderMode CalculationMode { get; set; } = RenderMode.Relative;
|
||||
|
||||
/// <inheritdoc />
|
||||
public double Brightness { get; set; }
|
||||
@ -28,15 +28,6 @@ namespace RGB.NET.Core
|
||||
/// <inheritdoc />
|
||||
public double Opacity { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IList<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public Rectangle RenderedRectangle { get; protected set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<BrushRenderTarget, Color> RenderedTargets { get; } = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -56,17 +47,14 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void PerformRender(Rectangle rectangle, IEnumerable<BrushRenderTarget> renderTargets)
|
||||
public IEnumerable<(RenderTarget renderTarget, Color color)> Render(Rectangle rectangle, IEnumerable<RenderTarget> renderTargets)
|
||||
{
|
||||
RenderedRectangle = rectangle;
|
||||
RenderedTargets.Clear();
|
||||
|
||||
foreach (BrushRenderTarget renderTarget in renderTargets)
|
||||
foreach (RenderTarget renderTarget in renderTargets)
|
||||
{
|
||||
Color color = GetColorAtPoint(rectangle, renderTarget);
|
||||
color = ApplyDecorators(rectangle, renderTarget, color);
|
||||
RenderedTargets[renderTarget] = color;
|
||||
ApplyDecorators(rectangle, renderTarget, ref color);
|
||||
FinalizeColor(ref color);
|
||||
yield return (renderTarget, color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,22 +64,12 @@ namespace RGB.NET.Core
|
||||
/// <param name="rectangle">The rectangle in which the brush should be drawn.</param>
|
||||
/// <param name="renderTarget">The target (key/point) from which the color should be taken.</param>
|
||||
/// <param name="color">The <see cref="Color"/> to be modified.</param>
|
||||
protected virtual Color ApplyDecorators(Rectangle rectangle, BrushRenderTarget renderTarget, Color color)
|
||||
protected virtual void ApplyDecorators(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color)
|
||||
{
|
||||
lock (Decorators)
|
||||
foreach (IBrushDecorator decorator in Decorators)
|
||||
if (decorator.IsEnabled)
|
||||
color = decorator.ManipulateColor(rectangle, renderTarget, color);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void PerformFinalize()
|
||||
{
|
||||
List<BrushRenderTarget> renderTargets = RenderedTargets.Keys.ToList();
|
||||
foreach (BrushRenderTarget renderTarget in renderTargets)
|
||||
RenderedTargets[renderTarget] = FinalizeColor(RenderedTargets[renderTarget]);
|
||||
decorator.ManipulateColor(rectangle, renderTarget, ref color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -100,20 +78,15 @@ namespace RGB.NET.Core
|
||||
/// <param name="rectangle">The rectangle in which the brush should be drawn.</param>
|
||||
/// <param name="renderTarget">The target (key/point) from which the color should be taken.</param>
|
||||
/// <returns>The color at the specified point.</returns>
|
||||
protected abstract Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget);
|
||||
protected abstract Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget);
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes the color by appliing the overall brightness and opacity.<br/>
|
||||
/// This method should always be the last call of a <see cref="GetColorAtPoint" /> implementation.
|
||||
/// </summary>
|
||||
/// <param name="color">The color to finalize.</param>
|
||||
/// <returns>The finalized color.</returns>
|
||||
protected virtual Color FinalizeColor(Color color)
|
||||
protected virtual void FinalizeColor(ref Color color)
|
||||
{
|
||||
if (ColorCorrections.Count > 0)
|
||||
foreach (IColorCorrection colorCorrection in ColorCorrections)
|
||||
color = colorCorrection.ApplyTo(color);
|
||||
|
||||
// Since we use HSV to calculate there is no way to make a color 'brighter' than 100%
|
||||
// Be carefull with the naming: Since we use HSV the correct term is 'value' but outside we call it 'brightness'
|
||||
// THIS IS NOT A HSB CALCULATION!!!
|
||||
@ -122,8 +95,6 @@ namespace RGB.NET.Core
|
||||
|
||||
if (Opacity < 1)
|
||||
color = color.MultiplyA(Opacity.Clamp(0, 1));
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -19,7 +19,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Gets or sets the calculation mode used for the rectangle/points used for color-selection in brushes.
|
||||
/// </summary>
|
||||
BrushCalculationMode BrushCalculationMode { get; set; }
|
||||
RenderMode CalculationMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the overall percentage brightness of the <see cref="IBrush"/>.
|
||||
@ -32,30 +32,10 @@ namespace RGB.NET.Core
|
||||
double Opacity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="IColorCorrection"/> used to correct the colors of the <see cref="IBrush"/>.
|
||||
/// </summary>
|
||||
IList<IColorCorrection> ColorCorrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="RenderedRectangle"/> used in the last render pass.
|
||||
/// </summary>
|
||||
Rectangle RenderedRectangle { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a dictionary containing all <see cref="Color"/> for <see cref="BrushRenderTarget"/> calculated in the last render pass.
|
||||
/// </summary>
|
||||
Dictionary<BrushRenderTarget, Color> RenderedTargets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Performs the render pass of the <see cref="IBrush"/> and calculates the raw <see cref="Color"/> for all requested <see cref="BrushRenderTarget"/>.
|
||||
/// Performs the render pass of the <see cref="IBrush"/> and calculates the raw <see cref="Color"/> for all requested <see cref="RenderTarget"/>.
|
||||
/// </summary>
|
||||
/// <param name="rectangle">The <see cref="Rectangle"/> in which the brush should be drawn.</param>
|
||||
/// <param name="renderTargets">The <see cref="BrushRenderTarget"/> (keys/points) of which the color should be calculated.</param>
|
||||
void PerformRender(Rectangle rectangle, IEnumerable<BrushRenderTarget> renderTargets);
|
||||
|
||||
/// <summary>
|
||||
/// Performs the finalize pass of the <see cref="IBrush"/> and calculates the final <see cref="ColorCorrections"/> for all previously calculated <see cref="BrushRenderTarget"/>.
|
||||
/// </summary>
|
||||
void PerformFinalize();
|
||||
/// <param name="renderTargets">The <see cref="RenderTarget"/> (keys/points) of which the color should be calculated.</param>
|
||||
IEnumerable<(RenderTarget renderTarget, Color color)> Render(Rectangle rectangle, IEnumerable<RenderTarget> renderTargets);
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
@ -29,9 +27,9 @@ namespace RGB.NET.Brushes
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.SolidColorBrush" /> class.
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Core.SolidColorBrush" /> class.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="P:RGB.NET.Brushes.SolidColorBrush.Color" /> drawn by this <see cref="T:RGB.NET.Brushes.SolidColorBrush" />.</param>
|
||||
/// <param name="color">The <see cref="P:RGB.NET.Core.SolidColorBrush.Color" /> drawn by this <see cref="T:RGB.NET.Core.SolidColorBrush" />.</param>
|
||||
public SolidColorBrush(Color color)
|
||||
{
|
||||
this.Color = color;
|
||||
@ -42,7 +40,7 @@ namespace RGB.NET.Brushes
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget) => Color;
|
||||
protected override Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget) => Color;
|
||||
|
||||
#endregion
|
||||
|
||||
35
RGB.NET.Core/Rendering/Brushes/TextureBrush.cs
Normal file
35
RGB.NET.Core/Rendering/Brushes/TextureBrush.cs
Normal file
@ -0,0 +1,35 @@
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
public class TextureBrush : AbstractBrush
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private ITexture _texture = ITexture.Empty;
|
||||
public ITexture Texture
|
||||
{
|
||||
get => _texture;
|
||||
set => SetProperty(ref _texture, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public TextureBrush(ITexture texture)
|
||||
{
|
||||
this.Texture = texture;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget)
|
||||
{
|
||||
Rectangle normalizedRect = renderTarget.Rectangle / rectangle;
|
||||
return Texture[normalizedRect];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Contains a list of all brush calculation modes.
|
||||
/// </summary>
|
||||
public enum BrushCalculationMode
|
||||
public enum RenderMode
|
||||
{
|
||||
/// <summary>
|
||||
/// The calculation <see cref="Rectangle"/> for <see cref="IBrush"/> will be the rectangle around the <see cref="ILedGroup"/> the <see cref="IBrush"/> is applied to.
|
||||
@ -13,7 +13,7 @@ namespace RGB.NET.Core
|
||||
Relative,
|
||||
|
||||
/// <summary>
|
||||
/// The calculation <see cref="Rectangle"/> for <see cref="IBrush"/> will always be the rectangle completly containing all affected <see cref="IRGBDevice"/>.
|
||||
/// The calculation <see cref="Rectangle"/> for <see cref="IBrush"/> will always be the whole <see cref="RGBSurface"/>.
|
||||
/// </summary>
|
||||
Absolute
|
||||
}
|
||||
@ -6,7 +6,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Represents a single target of a brush render.
|
||||
/// </summary>
|
||||
public class BrushRenderTarget
|
||||
public readonly struct RenderTarget
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
@ -23,23 +23,21 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Gets the <see cref="Core.Point"/> representing the position to render the target-<see cref="Core.Led"/>.
|
||||
/// </summary>
|
||||
public Point Point { get; }
|
||||
public Point Point => Rectangle.Center;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BrushRenderTarget"/> class.
|
||||
/// Initializes a new instance of the <see cref="RenderTarget"/> class.
|
||||
/// </summary>
|
||||
/// <param name="led">The target-<see cref="Core.Led"/>.</param>
|
||||
/// <param name="rectangle">The <see cref="Core.Rectangle"/> representing the area to render the target-<see cref="Core.Led"/>.</param>
|
||||
public BrushRenderTarget(Led led, Rectangle rectangle)
|
||||
public RenderTarget(Led led, Rectangle rectangle)
|
||||
{
|
||||
this.Led = led;
|
||||
this.Rectangle = rectangle;
|
||||
|
||||
this.Point = rectangle.Center;
|
||||
}
|
||||
|
||||
#endregion
|
||||
13
RGB.NET.Core/Rendering/Textures/EmptyTexture.cs
Normal file
13
RGB.NET.Core/Rendering/Textures/EmptyTexture.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
internal class EmptyTexture : ITexture
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public Size Size { get; } = new(0, 0);
|
||||
public Color this[in Point point] => Color.Transparent;
|
||||
public Color this[in Rectangle rectangle] => Color.Transparent;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
12
RGB.NET.Core/Rendering/Textures/ITexture.cs
Normal file
12
RGB.NET.Core/Rendering/Textures/ITexture.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
public interface ITexture
|
||||
{
|
||||
static ITexture Empty => new EmptyTexture();
|
||||
|
||||
Size Size { get; }
|
||||
|
||||
Color this[in Point point] { get; }
|
||||
Color this[in Rectangle rectangle] { get; }
|
||||
}
|
||||
}
|
||||
66
RGB.NET.Core/Rendering/Textures/PixelTexture.cs
Normal file
66
RGB.NET.Core/Rendering/Textures/PixelTexture.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
public sealed class PixelTexture : ITexture
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly int _dataWidth;
|
||||
private readonly int _dataHeight;
|
||||
private readonly ReadOnlyMemory<Color> _data;
|
||||
private readonly ISampler _sampler;
|
||||
|
||||
public Size Size { get; }
|
||||
|
||||
public Color this[in Point point]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_data.IsEmpty) return Color.Transparent;
|
||||
|
||||
int x = (int)Math.Round(Size.Width * point.X.Clamp(0, 1));
|
||||
int y = (int)Math.Round(Size.Height * point.Y.Clamp(0, 1));
|
||||
|
||||
return _data.Span[(y * _dataWidth) + x];
|
||||
}
|
||||
}
|
||||
|
||||
public Color this[in Rectangle rectangle]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_data.IsEmpty) return Color.Transparent;
|
||||
|
||||
int x = (int)Math.Round(Size.Width * rectangle.Location.X.Clamp(0, 1));
|
||||
int y = (int)Math.Round(Size.Height * rectangle.Location.Y.Clamp(0, 1));
|
||||
int width = (int)Math.Round(Size.Width * rectangle.Size.Width.Clamp(0, 1));
|
||||
int height = (int)Math.Round(Size.Height * rectangle.Size.Height.Clamp(0, 1));
|
||||
|
||||
return _sampler.SampleColor(in _data, x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public PixelTexture(int with, int height, ReadOnlyMemory<Color> data)
|
||||
: this(with, height, data, new AverageSampler())
|
||||
{ }
|
||||
|
||||
public PixelTexture(int with, int height, ReadOnlyMemory<Color> data, ISampler sampler)
|
||||
{
|
||||
this._data = data;
|
||||
this._dataWidth = with;
|
||||
this._dataHeight = height;
|
||||
this._sampler = sampler;
|
||||
|
||||
if (_data.Length != (with * height)) throw new ArgumentException($"Data-Length {_data.Length} differs from the given size {with}x{height} ({with * height}).");
|
||||
|
||||
Size = new Size(with, height);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
77
RGB.NET.Core/Rendering/Textures/Sampler/AverageSampler.cs
Normal file
77
RGB.NET.Core/Rendering/Textures/Sampler/AverageSampler.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
public class AverageSampler : ISampler
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Func<ReadOnlyMemory<Color>, int, int, int, int, Color> _sampleMethod = SampleWithoutAlpha;
|
||||
|
||||
private bool _sampleAlpha;
|
||||
public bool SampleAlpha
|
||||
{
|
||||
get => _sampleAlpha;
|
||||
set
|
||||
{
|
||||
_sampleAlpha = value;
|
||||
_sampleMethod = value ? SampleWithAlpha : SampleWithoutAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public Color SampleColor(in ReadOnlyMemory<Color> data, int x, int y, int width, int height) => _sampleMethod(data, x, y, width, height);
|
||||
|
||||
private static Color SampleWithAlpha(ReadOnlyMemory<Color> data, int x, int y, int width, int height)
|
||||
{
|
||||
ReadOnlySpan<Color> span = data.Span;
|
||||
|
||||
int maxY = y + height;
|
||||
int count = width * height;
|
||||
double a = 0, r = 0, g = 0, b = 0;
|
||||
for (int yPos = y; yPos < maxY; yPos++)
|
||||
{
|
||||
ReadOnlySpan<Color> line = span.Slice((yPos * width) + x, width);
|
||||
foreach (Color color in line)
|
||||
{
|
||||
a += color.A;
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) return Color.Transparent;
|
||||
|
||||
return new Color(a / count, r / count, g / count, b / count);
|
||||
}
|
||||
|
||||
private static Color SampleWithoutAlpha(ReadOnlyMemory<Color> data, int x, int y, int width, int height)
|
||||
{
|
||||
ReadOnlySpan<Color> span = data.Span;
|
||||
|
||||
int maxY = y + height;
|
||||
int count = width * height;
|
||||
double r = 0, g = 0, b = 0;
|
||||
for (int yPos = y; yPos < maxY; yPos++)
|
||||
{
|
||||
ReadOnlySpan<Color> line = span.Slice((yPos * width) + x, width);
|
||||
foreach (Color color in line)
|
||||
{
|
||||
r += color.R;
|
||||
g += color.G;
|
||||
b += color.B;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) return Color.Transparent;
|
||||
|
||||
return new Color(r / count, g / count, b / count);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
9
RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs
Normal file
9
RGB.NET.Core/Rendering/Textures/Sampler/ISampler.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
public interface ISampler
|
||||
{
|
||||
Color SampleColor(in ReadOnlyMemory<Color> data, int x, int y, int width, int height);
|
||||
}
|
||||
}
|
||||
94
RGB.NET.Core/Update/ManualUpdateTrigger.cs
Normal file
94
RGB.NET.Core/Update/ManualUpdateTrigger.cs
Normal file
@ -0,0 +1,94 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents an <see cref="T:RGB.NET.Core.IUpdateTrigger" />
|
||||
/// </summary>
|
||||
public sealed class ManualUpdateTrigger : AbstractUpdateTrigger
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private AutoResetEvent _mutex = new(false);
|
||||
private Task? UpdateTask { get; set; }
|
||||
private CancellationTokenSource? UpdateTokenSource { get; set; }
|
||||
private CancellationToken UpdateToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time it took the last update-loop cycle to run.
|
||||
/// </summary>
|
||||
public double LastUpdateTime { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ManualUpdateTrigger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="autostart">A value indicating if the trigger should automatically <see cref="Start"/> right after construction.</param>
|
||||
public ManualUpdateTrigger()
|
||||
{
|
||||
Start();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Starts the trigger if needed, causing it to performing updates.
|
||||
/// </summary>
|
||||
private void Start()
|
||||
{
|
||||
if (UpdateTask == null)
|
||||
{
|
||||
UpdateTokenSource?.Dispose();
|
||||
UpdateTokenSource = new CancellationTokenSource();
|
||||
UpdateTask = Task.Factory.StartNew(UpdateLoop, (UpdateToken = UpdateTokenSource.Token), TaskCreationOptions.LongRunning, TaskScheduler.Default);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the trigger if running, causing it to stop performing updates.
|
||||
/// </summary>
|
||||
private void Stop()
|
||||
{
|
||||
if (UpdateTask != null)
|
||||
{
|
||||
UpdateTokenSource?.Cancel();
|
||||
// ReSharper disable once MethodSupportsCancellation
|
||||
UpdateTask.Wait();
|
||||
UpdateTask.Dispose();
|
||||
UpdateTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerUpdate() => _mutex.Set();
|
||||
|
||||
private void UpdateLoop()
|
||||
{
|
||||
OnStartup();
|
||||
|
||||
while (!UpdateToken.IsCancellationRequested)
|
||||
{
|
||||
if (_mutex.WaitOne(100))
|
||||
{
|
||||
long preUpdateTicks = Stopwatch.GetTimestamp();
|
||||
OnUpdate();
|
||||
LastUpdateTime = ((Stopwatch.GetTimestamp() - preUpdateTicks) / 10000.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Dispose() => Stop();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<Authors>Darth Affe</Authors>
|
||||
<Company>Wyrez</Company>
|
||||
<Language>en-US</Language>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Title>RGB.NET.Decorators</Title>
|
||||
<AssemblyName>RGB.NET.Decorators</AssemblyName>
|
||||
<AssemblyTitle>RGB.NET.Decorators</AssemblyTitle>
|
||||
<PackageId>RGB.NET.Decorators</PackageId>
|
||||
<RootNamespace>RGB.NET.Decorators</RootNamespace>
|
||||
<Description>Decorators-Presets of RGB.NET</Description>
|
||||
<Summary>Decorators-Presets of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
|
||||
<Copyright>Copyright © Darth Affe 2020</Copyright>
|
||||
<PackageCopyright>Copyright © Darth Affe 2020</PackageCopyright>
|
||||
<PackageIconUrl>http://lib.arge.be/icon.png</PackageIconUrl>
|
||||
<PackageProjectUrl>https://github.com/DarthAffe/RGB.NET</PackageProjectUrl>
|
||||
<PackageLicenseUrl>https://raw.githubusercontent.com/DarthAffe/RGB.NET/master/LICENSE</PackageLicenseUrl>
|
||||
<RepositoryType>Github</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/DarthAffe/RGB.NET</RepositoryUrl>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
|
||||
<PackageReleaseNotes></PackageReleaseNotes>
|
||||
|
||||
<Version>0.0.1</Version>
|
||||
<AssemblyVersion>0.0.1</AssemblyVersion>
|
||||
<FileVersion>0.0.1</FileVersion>
|
||||
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IncludeSource>True</IncludeSource>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RGB.NET.Brushes\RGB.NET.Brushes.csproj" />
|
||||
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1,3 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=extensions/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=groups/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@ -5,7 +5,7 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Decorators.Brush
|
||||
namespace RGB.NET.Presets.Decorators
|
||||
{
|
||||
/// <inheritdoc cref="AbstractUpdateAwareDecorator" />
|
||||
/// <inheritdoc cref="IBrushDecorator" />
|
||||
@ -85,7 +85,7 @@ namespace RGB.NET.Decorators.Brush
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color) => color.SetA(_currentValue);
|
||||
public void ManipulateColor(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color) => color = color.SetA(_currentValue);
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(double deltaTime)
|
||||
@ -1,10 +1,10 @@
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes
|
||||
namespace RGB.NET.Presets.Decorators
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a basic decorator decorating a <see cref="T:RGB.NET.Brushes.Gradients.IGradient" />.
|
||||
/// Represents a basic decorator decorating a <see cref="T:RGB.NET.Presets.Gradients.IGradient" />.
|
||||
/// </summary>
|
||||
public interface IGradientDecorator : IDecorator
|
||||
{ }
|
||||
@ -1,13 +1,12 @@
|
||||
using RGB.NET.Brushes;
|
||||
using RGB.NET.Brushes.Gradients;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Textures.Gradients;
|
||||
|
||||
namespace RGB.NET.Decorators.Gradient
|
||||
namespace RGB.NET.Presets.Decorators
|
||||
{
|
||||
/// <inheritdoc cref="AbstractUpdateAwareDecorator" />
|
||||
/// <inheritdoc cref="IGradientDecorator" />
|
||||
/// <summary>
|
||||
/// Represents a decorator which allows to move an <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> by modifying his offset.
|
||||
/// Represents a decorator which allows to move an <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> by modifying his offset.
|
||||
/// </summary>
|
||||
public class MoveGradientDecorator : AbstractUpdateAwareDecorator, IGradientDecorator
|
||||
{
|
||||
@ -37,13 +36,13 @@ namespace RGB.NET.Decorators.Gradient
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Decorators.Gradient.MoveGradientDecorator" /> class.
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Decorators.MoveGradientDecorator" /> class.
|
||||
/// </summary>
|
||||
/// <param name="speed">The speed of the movement in units per second.
|
||||
/// The meaning of units differs for the different <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> but 360 units will always be one complete cycle:
|
||||
/// <see cref="T:RGB.NET.Brushes.Gradients.LinearGradient" />: 360 unit = 1 offset.
|
||||
/// <see cref="T:RGB.NET.Brushes.Gradients.RainbowGradient" />: 1 unit = 1 degree.</param>
|
||||
/// <param name="direction">The direction the <see cref="T:RGB.NET.Brushes.Gradients.IGradient" /> is moved.
|
||||
/// The meaning of units differs for the different <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> but 360 units will always be one complete cycle:
|
||||
/// <see cref="T:RGB.NET.Presets.Gradients.LinearGradient" />: 360 unit = 1 offset.
|
||||
/// <see cref="T:RGB.NET.Presets.Gradients.RainbowGradient" />: 1 unit = 1 degree.</param>
|
||||
/// <param name="direction">The direction the <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> is moved.
|
||||
/// True leads to an offset-increment (normaly moving to the right), false to an offset-decrement (normaly moving to the left).</param>
|
||||
public MoveGradientDecorator(RGBSurface surface, double speed = 180.0, bool direction = true)
|
||||
: base(surface)
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Groups
|
||||
namespace RGB.NET.Presets.Groups
|
||||
{
|
||||
/// <summary>
|
||||
/// Offers some extensions and helper-methods for <see cref="ILedGroup"/> related things.
|
||||
@ -6,11 +6,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Groups
|
||||
namespace RGB.NET.Presets.Groups
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a <see cref="T:RGB.NET.Groups.RectangleLedGroup" /> containing <see cref="T:RGB.NET.Core.Led" /> which physically lay inside a <see cref="T:RGB.NET.Core.Rectangle" />.
|
||||
/// Represents a <see cref="T:RGB.NET.Presets.Groups.RectangleLedGroup" /> containing <see cref="T:RGB.NET.Core.Led" /> which physically lay inside a <see cref="T:RGB.NET.Core.Rectangle" />.
|
||||
/// </summary>
|
||||
public class RectangleLedGroup : AbstractLedGroup
|
||||
{
|
||||
@ -114,9 +114,9 @@ namespace RGB.NET.Groups
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Gets a list containing all <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Groups.RectangleLedGroup" />.
|
||||
/// Gets a list containing all <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Presets.Groups.RectangleLedGroup" />.
|
||||
/// </summary>
|
||||
/// <returns>The list containing all <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Groups.RectangleLedGroup" />.</returns>
|
||||
/// <returns>The list containing all <see cref="T:RGB.NET.Core.Led" /> of this <see cref="T:RGB.NET.Presets.Groups.RectangleLedGroup" />.</returns>
|
||||
public override IList<Led> GetLeds() => _ledCache ??= (Surface?.Leds.Where(led => led.AbsoluteBoundary.CalculateIntersectPercentage(Rectangle) >= MinOverlayPercentage).ToList() ?? new List<Led>());
|
||||
|
||||
private void InvalidateCache() => _ledCache = null;
|
||||
@ -3,7 +3,7 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes.Helper
|
||||
namespace RGB.NET.Presets.Helper
|
||||
{
|
||||
/// <summary>
|
||||
/// Offers some extensions and helper-methods for gradient related things.
|
||||
@ -20,13 +20,13 @@ namespace RGB.NET.Brushes.Helper
|
||||
/// <param name="endPoint">The end <see cref="Point"/> of the gradient.</param>
|
||||
/// <param name="point">The <see cref="Point"/> on the gradient to which the offset is calculated.</param>
|
||||
/// <returns>The offset of the <see cref="Point"/> on the gradient.</returns>
|
||||
public static double CalculateLinearGradientOffset(Point startPoint, Point endPoint, Point point)
|
||||
public static double CalculateLinearGradientOffset(in Point startPoint, in Point endPoint, in Point point)
|
||||
{
|
||||
Point intersectingPoint;
|
||||
if (startPoint.Y.Equals(endPoint.Y)) // Horizontal case
|
||||
if (startPoint.Y.EqualsInTolerance(endPoint.Y)) // Horizontal case
|
||||
intersectingPoint = new Point(point.X, startPoint.Y);
|
||||
|
||||
else if (startPoint.X.Equals(endPoint.X)) // Vertical case
|
||||
else if (startPoint.X.EqualsInTolerance(endPoint.X)) // Vertical case
|
||||
intersectingPoint = new Point(startPoint.X, point.Y);
|
||||
|
||||
else // Diagonal case
|
||||
@ -57,15 +57,15 @@ namespace RGB.NET.Brushes.Helper
|
||||
/// <param name="origin">The origin of the vector.</param>
|
||||
/// <param name="direction">The direction of the vector.</param>
|
||||
/// <returns>The signed magnitude of a <see cref="Point"/> on a vector.</returns>
|
||||
public static double CalculateDistance(Point point, Point origin, Point direction)
|
||||
public static double CalculateDistance(in Point point, in Point origin, in Point direction)
|
||||
{
|
||||
double distance = CalculateDistance(point, origin);
|
||||
|
||||
return (((point.Y < origin.Y) && (direction.Y > origin.Y)) ||
|
||||
((point.Y > origin.Y) && (direction.Y < origin.Y)) ||
|
||||
((point.Y.Equals(origin.Y)) && (point.X < origin.X) && (direction.X > origin.X)) ||
|
||||
((point.Y.Equals(origin.Y)) && (point.X > origin.X) && (direction.X < origin.X)))
|
||||
? -distance : distance;
|
||||
return (((point.Y < origin.Y) && (direction.Y > origin.Y))
|
||||
|| ((point.Y > origin.Y) && (direction.Y < origin.Y))
|
||||
|| ((point.Y.EqualsInTolerance(origin.Y)) && (point.X < origin.X) && (direction.X > origin.X))
|
||||
|| ((point.Y.EqualsInTolerance(origin.Y)) && (point.X > origin.X) && (direction.X < origin.X)))
|
||||
? -distance : distance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -74,7 +74,12 @@ namespace RGB.NET.Brushes.Helper
|
||||
/// <param name="point1">The first <see cref="Point"/>.</param>
|
||||
/// <param name="point2">The second <see cref="Point"/>.</param>
|
||||
/// <returns>The distance between the two <see cref="Point"/>.</returns>
|
||||
public static double CalculateDistance(Point point1, Point point2) => Math.Sqrt(((point1.Y - point2.Y) * (point1.Y - point2.Y)) + ((point1.X - point2.X) * (point1.X - point2.X)));
|
||||
public static double CalculateDistance(in Point point1, in Point point2)
|
||||
{
|
||||
double x = point1.X - point2.X;
|
||||
double y = point1.Y - point2.Y;
|
||||
return Math.Sqrt((y * y) + (x * x));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -8,13 +8,13 @@
|
||||
<Company>Wyrez</Company>
|
||||
<Language>en-US</Language>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Title>RGB.NET.Groups</Title>
|
||||
<AssemblyName>RGB.NET.Groups</AssemblyName>
|
||||
<AssemblyTitle>RGB.NET.Groups</AssemblyTitle>
|
||||
<PackageId>RGB.NET.Groups</PackageId>
|
||||
<RootNamespace>RGB.NET.Groups</RootNamespace>
|
||||
<Description>Group-Presets of RGB.NET</Description>
|
||||
<Summary>Group-Presets of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
|
||||
<Title>RGB.NET.Presets</Title>
|
||||
<AssemblyName>RGB.NET.Presets</AssemblyName>
|
||||
<AssemblyTitle>RGB.NET.Presets</AssemblyTitle>
|
||||
<PackageId>RGB.NET.Presets</PackageId>
|
||||
<RootNamespace>RGB.NET.Presets</RootNamespace>
|
||||
<Description>Presets-Presets of RGB.NET</Description>
|
||||
<Summary>Presets for RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
|
||||
<Copyright>Copyright © Darth Affe 2020</Copyright>
|
||||
<PackageCopyright>Copyright © Darth Affe 2020</PackageCopyright>
|
||||
<PackageIconUrl>http://lib.arge.be/icon.png</PackageIconUrl>
|
||||
@ -1,3 +1,4 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=brushes/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=decorators/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=brushes/@EntryIndexedValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=decorators/@EntryIndexedValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=groups_005Cextensions/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
42
RGB.NET.Presets/Textures/AbstractGradientTexture.cs
Normal file
42
RGB.NET.Presets/Textures/AbstractGradientTexture.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Textures.Gradients;
|
||||
|
||||
namespace RGB.NET.Presets.Textures
|
||||
{
|
||||
public abstract class AbstractGradientTexture : AbstractBindable, ITexture
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gradient drawn by the brush.
|
||||
/// </summary>
|
||||
public IGradient Gradient { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Size Size { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Color this[in Point point] => GetColor(point);
|
||||
|
||||
/// <inheritdoc />
|
||||
public Color this[in Rectangle rectangle] => GetColor(rectangle.Center);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
protected AbstractGradientTexture(Size size, IGradient gradient)
|
||||
{
|
||||
this.Size = size;
|
||||
this.Gradient = gradient;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected abstract Color GetColor(in Point point);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
98
RGB.NET.Presets/Textures/ConicalGradientTexture.cs
Normal file
98
RGB.NET.Presets/Textures/ConicalGradientTexture.cs
Normal file
@ -0,0 +1,98 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Textures.Gradients;
|
||||
|
||||
namespace RGB.NET.Presets.Textures
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a brush drawing a conical gradient.
|
||||
/// </summary>
|
||||
public sealed class ConicalGradientTexture : AbstractGradientTexture
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const double PI2 = Math.PI * 2;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private double _origin = Math.Atan2(-1, 0);
|
||||
/// <summary>
|
||||
/// Gets or sets the origin (radian-angle) this <see cref="ConicalGradientTexture"/> is drawn to. (default: -π/2)
|
||||
/// </summary>
|
||||
public double Origin
|
||||
{
|
||||
get => _origin;
|
||||
set => SetProperty(ref _origin, value);
|
||||
}
|
||||
|
||||
private Point _center = new(0.5, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the center <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="ConicalGradientTexture"/>. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
public Point Center
|
||||
{
|
||||
get => _center;
|
||||
set => SetProperty(ref _center, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.ConicalGradientTexture" /> class.
|
||||
/// </summary>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Presets.Textures.ConicalGradientTexture" />.</param>
|
||||
public ConicalGradientTexture(Size size, IGradient gradient)
|
||||
: base(size, gradient)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.ConicalGradientTexture" /> class.
|
||||
/// </summary>
|
||||
/// <param name="center">The center <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Presets.Textures.ConicalGradientTexture" />.</param>
|
||||
public ConicalGradientTexture(Size size, IGradient gradient, Point center)
|
||||
: base(size, gradient)
|
||||
{
|
||||
this.Center = center;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.ConicalGradientTexture" /> class.
|
||||
/// </summary>
|
||||
/// <param name="center">The center <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="origin">The origin (radian-angle) the <see cref="T:RGB.NET.Core.IBrush" /> is drawn to.</param>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Presets.Textures.ConicalGradientTexture" />.</param>
|
||||
public ConicalGradientTexture(Size size, IGradient gradient, Point center, float origin)
|
||||
: base(size, gradient)
|
||||
{
|
||||
this.Center = center;
|
||||
this.Origin = origin;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override Color GetColor(in Point point)
|
||||
{
|
||||
double angle = Math.Atan2(point.Y - Center.Y, point.X - Center.X) - Origin;
|
||||
if (angle < 0) angle += PI2;
|
||||
double offset = angle / PI2;
|
||||
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -8,8 +8,9 @@ using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Decorators;
|
||||
|
||||
namespace RGB.NET.Brushes.Gradients
|
||||
namespace RGB.NET.Presets.Textures.Gradients
|
||||
{
|
||||
/// <inheritdoc cref="AbstractDecoratable{T}" />
|
||||
/// <inheritdoc cref="IGradient" />
|
||||
@ -97,11 +98,11 @@ namespace RGB.NET.Brushes.Gradients
|
||||
/// <returns></returns>
|
||||
protected double ClipOffset(double offset)
|
||||
{
|
||||
double max = GradientStops.Max(n => n.Offset);
|
||||
double max = GradientStops.Max(stop => stop.Offset);
|
||||
if (offset > max)
|
||||
return max;
|
||||
|
||||
double min = GradientStops.Min(n => n.Offset);
|
||||
double min = GradientStops.Min(stop => stop.Offset);
|
||||
return offset < min ? min : offset;
|
||||
}
|
||||
|
||||
@ -116,11 +117,11 @@ namespace RGB.NET.Brushes.Gradients
|
||||
foreach (GradientStop gradientStop in GradientStops)
|
||||
gradientStop.Offset += offset;
|
||||
|
||||
while (GradientStops.All(x => x.Offset > 1))
|
||||
while (GradientStops.All(stop => stop.Offset > 1))
|
||||
foreach (GradientStop gradientStop in GradientStops)
|
||||
gradientStop.Offset -= 1;
|
||||
|
||||
while (GradientStops.All(x => x.Offset < 0))
|
||||
while (GradientStops.All(stop => stop.Offset < 0))
|
||||
foreach (GradientStop gradientStop in GradientStops)
|
||||
gradientStop.Offset += 1;
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes.Gradients
|
||||
namespace RGB.NET.Presets.Textures.Gradients
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a stop on a gradient.
|
||||
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Decorators;
|
||||
|
||||
namespace RGB.NET.Brushes.Gradients
|
||||
namespace RGB.NET.Presets.Textures.Gradients
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a basic gradient.
|
||||
/// </summary>
|
||||
@ -5,7 +5,7 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Brushes.Gradients
|
||||
namespace RGB.NET.Presets.Textures.Gradients
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
@ -24,7 +24,7 @@ namespace RGB.NET.Brushes.Gradients
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.Gradients.LinearGradient" /> class.
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.Gradients.LinearGradient" /> class.
|
||||
/// </summary>
|
||||
public LinearGradient()
|
||||
{
|
||||
@ -33,7 +33,7 @@ namespace RGB.NET.Brushes.Gradients
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.Gradients.LinearGradient" /> class.
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.Gradients.LinearGradient" /> class.
|
||||
/// </summary>
|
||||
/// <param name="gradientStops">The stops with which the gradient should be initialized.</param>
|
||||
public LinearGradient(params GradientStop[] gradientStops)
|
||||
@ -44,9 +44,9 @@ namespace RGB.NET.Brushes.Gradients
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Brushes.Gradients.AbstractGradient" /> class.
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.Gradients.AbstractGradient" /> class.
|
||||
/// </summary>
|
||||
/// <param name="wrapGradient">Specifies whether the gradient should wrapp or not (see <see cref="P:RGB.NET.Brushes.Gradients.AbstractGradient.WrapGradient" /> for an example of what this means).</param>
|
||||
/// <param name="wrapGradient">Specifies whether the gradient should wrapp or not (see <see cref="P:RGB.NET.Presets.Textures.Gradients.AbstractGradient.WrapGradient" /> for an example of what this means).</param>
|
||||
/// <param name="gradientStops">The stops with which the gradient should be initialized.</param>
|
||||
public LinearGradient(bool wrapGradient, params GradientStop[] gradientStops)
|
||||
: base(wrapGradient, gradientStops)
|
||||
@ -3,8 +3,9 @@
|
||||
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Decorators;
|
||||
|
||||
namespace RGB.NET.Brushes.Gradients
|
||||
namespace RGB.NET.Presets.Textures.Gradients
|
||||
{
|
||||
/// <inheritdoc cref="AbstractDecoratable{T}" />
|
||||
/// <inheritdoc cref="IGradient" />
|
||||
79
RGB.NET.Presets/Textures/LinearGradientTexture.cs
Normal file
79
RGB.NET.Presets/Textures/LinearGradientTexture.cs
Normal file
@ -0,0 +1,79 @@
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Helper;
|
||||
using RGB.NET.Presets.Textures.Gradients;
|
||||
|
||||
namespace RGB.NET.Presets.Textures
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a brush drawing a linear gradient.
|
||||
/// </summary>
|
||||
public sealed class LinearGradientTexture : AbstractGradientTexture
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _startPoint = new(0, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the start <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="LinearGradientTexture"/>. (default: 0.0, 0.5)
|
||||
/// </summary>
|
||||
public Point StartPoint
|
||||
{
|
||||
get => _startPoint;
|
||||
set => SetProperty(ref _startPoint, value);
|
||||
}
|
||||
|
||||
private Point _endPoint = new(1, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the end <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="LinearGradientTexture"/>. (default: 1.0, 0.5)
|
||||
/// </summary>
|
||||
public Point EndPoint
|
||||
{
|
||||
get => _endPoint;
|
||||
set => SetProperty(ref _endPoint, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.LinearGradientTexture" /> class.
|
||||
/// </summary>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Presets.Textures.LinearGradientTexture" />.</param>
|
||||
public LinearGradientTexture(Size size, IGradient gradient)
|
||||
: base(size, gradient)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.LinearGradientTexture" /> class.
|
||||
/// </summary>
|
||||
/// <param name="startPoint">The start <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="endPoint">The end <see cref="T:RGB.NET.Core.Point" /> (as percentage in the range [0..1]).</param>
|
||||
/// <param name="gradient">The <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> drawn by this <see cref="T:RGB.NET.Presets.Textures.LinearGradientTexture" />.</param>
|
||||
public LinearGradientTexture(Size size, IGradient gradient, Point startPoint, Point endPoint)
|
||||
: base(size, gradient)
|
||||
{
|
||||
this.StartPoint = startPoint;
|
||||
this.EndPoint = endPoint;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override Color GetColor(in Point point)
|
||||
{
|
||||
double offset = GradientHelper.CalculateLinearGradientOffset(StartPoint, EndPoint, point);
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
78
RGB.NET.Presets/Textures/RadialGradientTexture.cs
Normal file
78
RGB.NET.Presets/Textures/RadialGradientTexture.cs
Normal file
@ -0,0 +1,78 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Presets.Helper;
|
||||
using RGB.NET.Presets.Textures.Gradients;
|
||||
|
||||
namespace RGB.NET.Presets.Textures
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a brush drawing a radial gradient around a center point.
|
||||
/// </summary>
|
||||
public sealed class RadialGradientTexture : AbstractGradientTexture
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private double _referenceDistance = GradientHelper.CalculateDistance(new Point(0.5, 0.5), new Point(0, 0));
|
||||
|
||||
private Point _center = new(0.5, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the center <see cref="Point"/> (as percentage in the range [0..1]) around which the <see cref="RadialGradientTexture"/> should be drawn. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
public Point Center
|
||||
{
|
||||
get => _center;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _center, value))
|
||||
CalculateReferenceDistance();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.RadialGradientTexture" /> class.
|
||||
/// </summary>
|
||||
/// <param name="gradient">The gradient drawn by the brush.</param>
|
||||
public RadialGradientTexture(Size size, IGradient gradient)
|
||||
: base(size, gradient)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Presets.Textures.RadialGradientTexture" /> class.
|
||||
/// </summary>
|
||||
/// <param name="center">The center point (as percentage in the range [0..1]).</param>
|
||||
/// <param name="gradient">The gradient drawn by the brush.</param>
|
||||
public RadialGradientTexture(Size size, IGradient gradient, Point center)
|
||||
: base(size, gradient)
|
||||
{
|
||||
this.Center = center;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void CalculateReferenceDistance()
|
||||
{
|
||||
double referenceX = Center.X < 0.5 ? 1 : 0;
|
||||
double referenceY = Center.Y < 0.5 ? 1 : 0;
|
||||
_referenceDistance = GradientHelper.CalculateDistance(new Point(referenceX, referenceY), Center);
|
||||
}
|
||||
|
||||
protected override Color GetColor(in Point point)
|
||||
{
|
||||
double distance = GradientHelper.CalculateDistance(point, Center);
|
||||
double offset = distance / _referenceDistance;
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
19
RGB.NET.sln
19
RGB.NET.sln
@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.29424.173
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Devices", "Devices", "{D13032C6-432E-4F43-8A32-071133C22B16}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Presets", "Presets", "{EBC33090-8494-4DF4-B4B6-64D0E531E93F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Core", "RGB.NET.Core\RGB.NET.Core.csproj", "{F3ED5768-7251-4347-8D8F-2866313DA658}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.CoolerMaster", "RGB.NET.Devices.CoolerMaster\RGB.NET.Devices.CoolerMaster.csproj", "{E8F927F5-E7CF-464A-B9AE-824C2B29A7D1}"
|
||||
@ -25,11 +23,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Novation",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Razer", "RGB.NET.Devices.Razer\RGB.NET.Devices.Razer.csproj", "{2E162CB7-2C6C-4069-8356-06162F7BE0AA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Brushes", "RGB.NET.Brushes\RGB.NET.Brushes.csproj", "{B159FB51-5939-490E-A1BA-FB55D4D7ADDF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Decorators", "RGB.NET.Decorators\RGB.NET.Decorators.csproj", "{8725C448-818C-41F7-B23F-F97E062BF233}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Groups", "RGB.NET.Groups\RGB.NET.Groups.csproj", "{6FEBDC9E-909D-4EE2-B003-EDFBEF5FFF40}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Presets", "RGB.NET.Presets\RGB.NET.Presets.csproj", "{B159FB51-5939-490E-A1BA-FB55D4D7ADDF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.WS281X", "RGB.NET.Devices.WS281X\RGB.NET.Devices.WS281X.csproj", "{0AD382DA-E999-4F74-9658-8D402EE9BF3F}"
|
||||
EndProject
|
||||
@ -91,14 +85,6 @@ Global
|
||||
{B159FB51-5939-490E-A1BA-FB55D4D7ADDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B159FB51-5939-490E-A1BA-FB55D4D7ADDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B159FB51-5939-490E-A1BA-FB55D4D7ADDF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8725C448-818C-41F7-B23F-F97E062BF233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8725C448-818C-41F7-B23F-F97E062BF233}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8725C448-818C-41F7-B23F-F97E062BF233}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8725C448-818C-41F7-B23F-F97E062BF233}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6FEBDC9E-909D-4EE2-B003-EDFBEF5FFF40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6FEBDC9E-909D-4EE2-B003-EDFBEF5FFF40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6FEBDC9E-909D-4EE2-B003-EDFBEF5FFF40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6FEBDC9E-909D-4EE2-B003-EDFBEF5FFF40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0AD382DA-E999-4F74-9658-8D402EE9BF3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0AD382DA-E999-4F74-9658-8D402EE9BF3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0AD382DA-E999-4F74-9658-8D402EE9BF3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -136,9 +122,6 @@ Global
|
||||
{00BA7E8E-822A-42DA-9EB4-DDBBC7CB0E46} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
{19F701FD-5577-4873-9BE6-6775676FA185} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
{2E162CB7-2C6C-4069-8356-06162F7BE0AA} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
{B159FB51-5939-490E-A1BA-FB55D4D7ADDF} = {EBC33090-8494-4DF4-B4B6-64D0E531E93F}
|
||||
{8725C448-818C-41F7-B23F-F97E062BF233} = {EBC33090-8494-4DF4-B4B6-64D0E531E93F}
|
||||
{6FEBDC9E-909D-4EE2-B003-EDFBEF5FFF40} = {EBC33090-8494-4DF4-B4B6-64D0E531E93F}
|
||||
{0AD382DA-E999-4F74-9658-8D402EE9BF3F} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
{FFDE4387-60F2-47B6-9704-3A57D02B8C64} = {D13032C6-432E-4F43-8A32-071133C22B16}
|
||||
{A3FD5AD7-040A-47CA-A278-53493A25FF8A} = {92D7C263-D4C9-4D26-93E2-93C1F9C2CD16}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user