From 9fc8e613f109ecad308671e6a159c1e13d894d9d Mon Sep 17 00:00:00 2001 From: Sean Date: Sun, 29 Jun 2025 17:01:07 -0400 Subject: [PATCH] Taking alook at DrawText in the ImageHelper. --- .../CNNProcessing/ImageHelper.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs b/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs index 9931baa..dd6e549 100644 --- a/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs +++ b/MarketData/MarketDataLib/CNNProcessing/ImageHelper.cs @@ -525,7 +525,35 @@ namespace MarketData.CNNProcessing paint.Color = color; canvas.DrawText(text,srcPoint, align, font, paint); } + + public void DrawBoundedText(String text, SKPoint srcPoint, SKColor color, SKTextAlign align, SKFont font,SKPaintStyle paintStyle=SKPaintStyle.Fill,float strokeWidth = 1) + { +// Validate(); +// SKPoint txSrcPoint = pointMapping.MapPoint(srcPoint); + + using SKPaint paint = new SKPaint(); + paint.Style = paintStyle; + paint.StrokeWidth = strokeWidth; // Set the desired stroke width + paint.Color = color; + SKRect rect = new SKRect(0, 0, 0, 0); + float textSize = font.MeasureText(text,out rect,paint); + CreateImage((int)rect.Width+1,(int)rect.Height+1); + SKPoint txSrcPoint = pointMapping.MapPoint(srcPoint); + using SKCanvas canvas = new SKCanvas(bitmap); + + + canvas.DrawText(text,srcPoint, align, font, paint); + } + + // float textSize = fonts[0].MeasureText(displayText,out rect,SKPaint); + // imageHelper.CreateImage(width, height); + // imageHelper.Fill(SKColors.White); + // imageHelper.DrawLine(SKColors.Black, 1, new SKPoint(0, 0), new SKPoint(width - 1, 0)); // bottom left to right + // imageHelper.DrawLine(SKColors.Black, 1, new SKPoint(width - 1, 0), new SKPoint(width - 1, height - 1)); // up lefthand side + // imageHelper.DrawLine(SKColors.Black, 1, new SKPoint(0, height - 1), new SKPoint(width - 1, height - 1)); // top left to right + // imageHelper.DrawLine(SKColors.Black, 1, new SKPoint(0, height - 1), new SKPoint(0, 0)); // left hand side top to bottom + // imageHelper.DrawText(displayText, new SKPoint(2, 16), SKColors.White, align, fonts[index]); /// /// Draws the path along the line segments ///