diff --git a/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs b/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs index 0bedaf1..03c7e97 100644 --- a/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs +++ b/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs @@ -611,5 +611,29 @@ namespace MarketData.CNNProcessing canvas.DrawCircle(txPointCenter, radius, paint); return true; } + + /// + /// Draw a triangle centered inside the bounded area defined by imageWidth, imageHeight + /// + /// The width of the bounded area + /// The height of the bounded area + /// The paint stroke to to use to outline the triangle + /// The paint stroke to use to fill the triangle + public void DrawTriangle(int imageWidth, int imageHeight, SKPaint paintStroke, SKPaint paintFill) + { + using SKPath path = new SKPath(); + float hLength = (float)imageWidth / 2f; + CreateImage(imageWidth,imageHeight); + Transparent(SKColors.White); + SKPoint txOrigin = pointMapping.MapPoint(new SKPoint(imageWidth/2.0f,imageHeight)); + using SKCanvas canvas = new SKCanvas(bitmap); + path.MoveTo(txOrigin.X, txOrigin.Y); + path.LineTo(txOrigin.X - hLength, (txOrigin.Y + imageHeight)-1f); + path.LineTo((txOrigin.X + hLength)-1f, (txOrigin.Y + imageHeight)-1f); + path.LineTo(txOrigin.X, txOrigin.Y); + path.Close(); + canvas.DrawPath(path, paintStroke); + canvas.DrawPath(path, paintFill); + } } } \ No newline at end of file