Calibration - Initial color calibration

This commit is contained in:
Diogo Trindade committed 2020-12-07 19:20:57 +00:00
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>
+14 -3
View File
@@ -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;
}
}