mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Calibration - Initial color calibration
This commit is contained in:
1 parent
d5ff979cbb
commit
af99c256ab
5 files changed
+225
-32
No files matched your search
@@ -27,6 +27,9 @@ namespace Artemis.Core
|
||||
Rotation = 0;
|
||||
Scale = 1;
|
||||
ZIndex = 1;
|
||||
RedScale = 1;
|
||||
GreenScale = 1;
|
||||
BlueScale = 1;
|
||||
|
||||
deviceProvider.DeviceLayoutPaths.TryGetValue(rgbDevice, out string? layoutPath);
|
||||
LayoutPath = layoutPath;
|
||||
@@ -171,6 +174,36 @@ namespace Artemis.Core
|
||||
}
|
||||
}
|
||||
|
||||
public double RedScale
|
||||
{
|
||||
get => DeviceEntity.RedScale;
|
||||
set
|
||||
{
|
||||
DeviceEntity.RedScale = value;
|
||||
OnPropertyChanged(nameof(RedScale));
|
||||
}
|
||||
}
|
||||
|
||||
public double GreenScale
|
||||
{
|
||||
get => DeviceEntity.GreenScale;
|
||||
set
|
||||
{
|
||||
DeviceEntity.GreenScale = value;
|
||||
OnPropertyChanged(nameof(GreenScale));
|
||||
}
|
||||
}
|
||||
|
||||
public double BlueScale
|
||||
{
|
||||
get => DeviceEntity.BlueScale;
|
||||
set
|
||||
{
|
||||
DeviceEntity.BlueScale = value;
|
||||
OnPropertyChanged(nameof(BlueScale));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to where the layout of the device was (attempted to be) loaded from
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
@@ -101,7 +101,13 @@ namespace Artemis.Core
|
||||
{
|
||||
Point scaledLocation = renderTarget.Point * Scale;
|
||||
if (scaledLocation.X < Bitmap.Width && scaledLocation.Y < Bitmap.Height)
|
||||
RenderedTargets[renderTarget] = Bitmap.GetPixel(scaledLocation.X.RoundToInt(), scaledLocation.Y.RoundToInt()).ToRgbColor();
|
||||
{
|
||||
var pixel = Bitmap.GetPixel(scaledLocation.X.RoundToInt(), scaledLocation.Y.RoundToInt()).ToRgbColor();
|
||||
var artemisDevice = Surface?.GetArtemisLed(renderTarget.Led)?.Device;
|
||||
if (artemisDevice is not null)
|
||||
pixel = pixel.MultiplyRGB(artemisDevice.RedScale, artemisDevice.GreenScale, artemisDevice.BlueScale);
|
||||
RenderedTargets[renderTarget] = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,8 +154,13 @@ namespace Artemis.Core
|
||||
// Bitmap.SetPixel(x, y, new SKColor(0, 255, 0));
|
||||
}
|
||||
}
|
||||
var pixel = new Color(a / sampleSize, r / sampleSize, g / sampleSize, b / sampleSize);
|
||||
|
||||
RenderedTargets[renderTarget] = new Color(a / sampleSize, r / sampleSize, g / sampleSize, b / sampleSize);
|
||||
var artemisDevice = Surface?.GetArtemisLed(renderTarget.Led)?.Device;
|
||||
if (artemisDevice is not null)
|
||||
pixel = pixel.MultiplyRGB(artemisDevice.RedScale, artemisDevice.GreenScale, artemisDevice.BlueScale);
|
||||
|
||||
RenderedTargets[renderTarget] = pixel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user