@@ -408,7 +408,7 @@ private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int c
408
408
var pixel = bmp . GetPixel ( x , y ) ;
409
409
var color = Math . Min ( ( pixel . R + pixel . G + pixel . B ) * contrast / 300 , 255 ) ;
410
410
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 ) ;
412
412
}
413
413
}
414
414
}
@@ -431,7 +431,7 @@ private void SetBitmapLinear(Bitmap bmp, int contrast = 100)
431
431
public void Text ( string text , float fontSize = 10 , int x = 0 , int y = 0 )
432
432
{
433
433
434
- int width = MaxRows - FullRows ;
434
+ int width = MaxRows ;
435
435
int height = MaxRows - FullRows ;
436
436
int textHeight , textWidth ;
437
437
@@ -501,8 +501,11 @@ public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY
501
501
502
502
public void GenerateFrameDiagonal ( Image image , float zoom = 100 , int panX = 0 , int panY = 0 , InterpolationMode quality = InterpolationMode . Default , int contrast = 100 )
503
503
{
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
+
506
509
float scale ;
507
510
508
511
using ( Bitmap bmp = new Bitmap ( width , height ) )
@@ -518,7 +521,7 @@ public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, i
518
521
graph . CompositingQuality = CompositingQuality . HighQuality ;
519
522
graph . SmoothingMode = SmoothingMode . AntiAlias ;
520
523
521
- graph . DrawImage ( image , width - scaleWidth , height - scaleHeight , scaleWidth , scaleHeight ) ;
524
+ graph . DrawImage ( image , ( width - scaleWidth ) / 2 , height - scaleHeight , scaleWidth , scaleHeight ) ;
522
525
523
526
}
524
527
0 commit comments