mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
To test, scaled down rendering to 25%
This commit is contained in:
1 parent
28fc7b5dcc
commit
c7790c1d82
5 files changed
+23
-11
No files matched your search
@@ -9,17 +9,20 @@ namespace Artemis.Core.RGB.NET
|
||||
{
|
||||
public class GraphicsDecorator : AbstractDecorator, IBrushDecorator, IDisposable
|
||||
{
|
||||
private readonly double _scale;
|
||||
private DirectBitmap _bitmap;
|
||||
|
||||
public GraphicsDecorator(ILedGroup ledGroup)
|
||||
public GraphicsDecorator(ILedGroup ledGroup, double scale)
|
||||
{
|
||||
_scale = scale;
|
||||
|
||||
var leds = ledGroup.GetLeds().ToList();
|
||||
if (!leds.Any())
|
||||
_bitmap = null;
|
||||
else
|
||||
{
|
||||
var width = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.X + l.AbsoluteLedRectangle.Width), 2000);
|
||||
var height = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.Y + l.AbsoluteLedRectangle.Height), 2000);
|
||||
var width = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.X + l.AbsoluteLedRectangle.Width) * scale, 4096);
|
||||
var height = Math.Min(leds.Max(l => l.AbsoluteLedRectangle.Y + l.AbsoluteLedRectangle.Height) * scale, 4096);
|
||||
|
||||
_bitmap = new DirectBitmap((int) width, (int) height);
|
||||
}
|
||||
@@ -27,10 +30,11 @@ namespace Artemis.Core.RGB.NET
|
||||
|
||||
public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color)
|
||||
{
|
||||
var point = renderTarget.Led.AbsoluteLedRectangle.Center;
|
||||
if (_bitmap != null && _bitmap.Width - 1 >= point.X && _bitmap.Height - 1 >= point.Y)
|
||||
var x = renderTarget.Led.AbsoluteLedRectangle.Center.X * _scale;
|
||||
var y = renderTarget.Led.AbsoluteLedRectangle.Center.Y * _scale;
|
||||
if (_bitmap != null && _bitmap.Width - 1 >= x && _bitmap.Height - 1 >= y)
|
||||
{
|
||||
var pixel = _bitmap.GetPixel((int) point.X, (int) point.Y);
|
||||
var pixel = _bitmap.GetPixel((int) x, (int) y);
|
||||
return new Color(pixel.A, pixel.R, pixel.G, pixel.B);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user