Add Transparency to bitmap
This commit is contained in:
@@ -414,9 +414,26 @@ namespace MarketData.CNNProcessing
|
|||||||
/// <param name="color"></param>
|
/// <param name="color"></param>
|
||||||
public void Fill(SKColor color)
|
public void Fill(SKColor color)
|
||||||
{
|
{
|
||||||
|
Validate();
|
||||||
SKRectI rect = new SKRectI(0, 0, Width, Height); // x, y, width, height
|
SKRectI rect = new SKRectI(0, 0, Width, Height); // x, y, width, height
|
||||||
bitmap.Erase(color, rect);
|
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>
|
/// <summary>
|
||||||
/// DrawPoint - With translation
|
/// DrawPoint - With translation
|
||||||
|
|||||||
Reference in New Issue
Block a user