Skip to content

Commit a3768bc

Browse files
committed
Anime Matrix tweaks #1648
1 parent ef1a823 commit a3768bc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/AnimeMatrix/AnimeMatrixDevice.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int c
408408
var pixel = bmp.GetPixel(x, y);
409409
var color = Math.Min((pixel.R + pixel.G + pixel.B) * contrast / 300, 255);
410410
if (color > 20)
411-
SetLedDiagonal(x, y, (byte)color, deltaX + (FullRows / 2) + 1, deltaY - (FullRows / 2) - 1);
411+
SetLedDiagonal(x, y, (byte)color, deltaX, deltaY - (FullRows / 2) - 1);
412412
}
413413
}
414414
}
@@ -431,7 +431,7 @@ private void SetBitmapLinear(Bitmap bmp, int contrast = 100)
431431
public void Text(string text, float fontSize = 10, int x = 0, int y = 0)
432432
{
433433

434-
int width = MaxRows - FullRows;
434+
int width = MaxRows;
435435
int height = MaxRows - FullRows;
436436
int textHeight, textWidth;
437437

@@ -501,8 +501,11 @@ public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY
501501

502502
public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100)
503503
{
504-
int width = MaxRows - FullRows;
505-
int height = MaxRows - FullRows*2;
504+
int width = MaxRows + FullRows;
505+
int height = MaxColumns + FullRows;
506+
507+
if ((image.Height / image.Width) > (height / width)) height = MaxColumns;
508+
506509
float scale;
507510

508511
using (Bitmap bmp = new Bitmap(width, height))
@@ -518,7 +521,7 @@ public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, i
518521
graph.CompositingQuality = CompositingQuality.HighQuality;
519522
graph.SmoothingMode = SmoothingMode.AntiAlias;
520523

521-
graph.DrawImage(image, width - scaleWidth, height - scaleHeight, scaleWidth, scaleHeight);
524+
graph.DrawImage(image, (width - scaleWidth) / 2, height - scaleHeight, scaleWidth, scaleHeight);
522525

523526
}
524527

0 commit comments

Comments
 (0)