From bd93d7af44ae6815b134a9bbaada62398e0711e4 Mon Sep 17 00:00:00 2001 From: Sean Date: Fri, 27 Jun 2025 09:15:35 -0400 Subject: [PATCH] Add Transparency to bitmap --- .../MarketDataLib/CNNProcessing/ImageHelper.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs b/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs index aed5f53..9931baa 100644 --- a/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs +++ b/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs @@ -414,9 +414,26 @@ namespace MarketData.CNNProcessing /// public void Fill(SKColor color) { + Validate(); SKRectI rect = new SKRectI(0, 0, Width, Height); // x, y, width, height bitmap.Erase(color, rect); } + + /// + /// Make the bitmap transparent + /// + public void Transparent(SKColor color) + { + Validate(); + int pixelCount = Width * Height; + SKColor[] colors = new SKColor[pixelCount]; + SKColor transparent = new SKColor(color.Red, color.Green, color.Blue, 0); + for (int index = 0; index < pixelCount; index++) + { + colors[index] = transparent; + } + bitmap.Pixels = colors; + } /// /// DrawPoint - With translation