Add Transparency to bitmap

This commit is contained in:
2025-06-27 09:15:35 -04:00
parent 2c036092fa
commit bd93d7af44

View File

@@ -414,9 +414,26 @@ namespace MarketData.CNNProcessing
/// <param name="color"></param>
public void Fill(SKColor color)
{
Validate();
SKRectI rect = new SKRectI(0, 0, Width, Height); // x, y, width, height
bitmap.Erase(color, rect);
}
/// <summary>
/// Make the bitmap transparent
/// </summary>
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;
}
/// <summary>
/// DrawPoint - With translation