From 4571978a9b84f02886bfee539d07a020454e24d6 Mon Sep 17 00:00:00 2001 From: tznind Date: Wed, 25 Sep 2024 18:59:17 +0100 Subject: [PATCH] Fix fill area - y is not in sixels its in pixels --- Terminal.Gui/Drawing/SixelEncoder.cs | 15 ++------------- UnitTests/Drawing/SixelEncoderTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Terminal.Gui/Drawing/SixelEncoder.cs b/Terminal.Gui/Drawing/SixelEncoder.cs index c8a50a54b..65924bb4c 100644 --- a/Terminal.Gui/Drawing/SixelEncoder.cs +++ b/Terminal.Gui/Drawing/SixelEncoder.cs @@ -204,20 +204,9 @@ public class SixelEncoder private string GetFillArea (Color [,] pixels) { - int widthInChars = GetWidthInChars (pixels); - int heightInChars = GetHeightInChars (pixels); + int widthInChars = pixels.GetLength (0); + int heightInChars = pixels.GetLength (1); return $"{widthInChars};{heightInChars}"; } - - private int GetHeightInChars (Color [,] pixels) - { - int height = pixels.GetLength (1); - return (height + 5) / 6; - } - - private int GetWidthInChars (Color [,] pixels) - { - return pixels.GetLength (0); - } } \ No newline at end of file diff --git a/UnitTests/Drawing/SixelEncoderTests.cs b/UnitTests/Drawing/SixelEncoderTests.cs index 12b1a90e2..3e84f5b8c 100644 --- a/UnitTests/Drawing/SixelEncoderTests.cs +++ b/UnitTests/Drawing/SixelEncoderTests.cs @@ -10,7 +10,7 @@ public class SixelEncoderTests string expected = "\u001bP" // Start sixel sequence + "0;0;0" // Defaults for aspect ratio and grid size + "q" // Signals beginning of sixel image data - + "\"1;1;12;2" // no scaling factors (1x1) and filling 12px width with 2 'sixel' height = 12 px high + + "\"1;1;12;12" // no scaling factors (1x1) and filling 12x12 pixel area /* * Definition of the color palette * #;;;;" - 2 means RGB. The values range 0 to 100 @@ -82,7 +82,7 @@ public class SixelEncoderTests string expected = "\u001bP" // Start sixel sequence + "0;0;0" // Defaults for aspect ratio and grid size + "q" // Signals beginning of sixel image data - + "\"1;1;12;2" // no scaling factors (1x1) and filling 12px width with 2 'sixel' height = 12 px high + + "\"1;1;12;12" // no scaling factors (1x1) and filling 12x12 pixel area /* * Definition of the color palette */