Fix ImageHelper not rendering images due to issue in PointMapping.
Some checks failed
Build .NET Project / build (push) Has been cancelled

This commit is contained in:
2026-03-10 23:48:25 -04:00
parent 59b4fb0477
commit 8715bed4cf
4 changed files with 147 additions and 75 deletions

View File

@@ -597,7 +597,7 @@ namespace MarketData.CNNProcessing
using SKPaint paint = new SKPaint();
paint.Style = SKPaintStyle.Stroke;
paint.StrokeWidth = strokeWidth; // Set the desired stroke width
paint.Color = SKColors.Black;
paint.Color = color;
foreach (LineSegment lineSegment in lineSegments)
{
SKPoint txSrcPoint = pointMapping.MapPoint(lineSegment.P1);
@@ -605,7 +605,47 @@ namespace MarketData.CNNProcessing
canvas.DrawLine(txSrcPoint, txDstPoint, paint);
}
}
// public void DrawPath(SKColor color, float strokeWidth, LineSegments lineSegments)
// {
// Validate();
// using SKCanvas canvas = new SKCanvas(bitmap);
// using SKPaint paint = new SKPaint();
// paint.Style = SKPaintStyle.Stroke;
// paint.StrokeWidth = strokeWidth; // Set the desired stroke width
// paint.Color = SKColors.Black;
// foreach (LineSegment lineSegment in lineSegments)
// {
// SKPoint txSrcPoint = pointMapping.MapPoint(lineSegment.P1);
// SKPoint txDstPoint = pointMapping.MapPoint(lineSegment.P2);
// canvas.DrawLine(txSrcPoint, txDstPoint, paint);
// }
// }
public void DrawSeries(SKColor color, float strokeWidth, float[] data)
{
Validate();
if (data == null || data.Length < 2)
return;
using SKCanvas canvas = new SKCanvas(bitmap);
using SKPaint paint = new SKPaint
{
Style = SKPaintStyle.Stroke,
StrokeWidth = strokeWidth,
Color = color,
IsAntialias = false
};
using SKPath path = new SKPath();
SKPoint first = pointMapping.MapPoint(new SKPoint(0, data[0]));
path.MoveTo(first);
for (int i = 1; i < data.Length; i++)
{
SKPoint pt = pointMapping.MapPoint(new SKPoint(i, data[i]));
path.LineTo(pt);
}
canvas.DrawPath(path, paint);
}
/// <summary>
/// Draws a circle on the bitmap
/// </summary>