Commit Latest
This commit is contained in:
@@ -11,7 +11,7 @@ public static class TextMarkerImageGenerator
|
||||
public static Image GenerateImage(String text,int width=130, int height=24, int fontSize=12)
|
||||
{
|
||||
ImageHelper imageHelper = new ImageHelper();
|
||||
imageHelper.CreateImage(width, height); //, new PointMapping(width,height,width,0,height,0));
|
||||
imageHelper.CreateImage(width, height);
|
||||
imageHelper.Fill(SKColors.White);
|
||||
SKTextAlign align = SKTextAlign.Center;
|
||||
SKFont font = new SKFont(SKTypeface.FromFamilyName("Arial",500,5,SKFontStyleSlant.Upright), fontSize);
|
||||
@@ -20,7 +20,18 @@ public static class TextMarkerImageGenerator
|
||||
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(text, new SKPoint(width / 2, height-8), SKColors.Black, align, font);
|
||||
using MemoryStream memoryStream = new MemoryStream();
|
||||
imageHelper.ToStream().CopyTo(memoryStream);
|
||||
return new ScottPlot.Image(memoryStream.ToArray());
|
||||
}
|
||||
|
||||
public static Image GenerateImage(String text,int fontSize=12)
|
||||
{
|
||||
ImageHelper imageHelper = new ImageHelper();
|
||||
// SKFont font = new SKFont(SKTypeface.FromFamilyName(familyName: "Helvetica", weight: SKFontStyleWeight.Normal, width: SKFontStyleWidth.UltraCondensed, slant: SKFontStyleSlant.Italic), fontSize, .75f);
|
||||
SKFont font = new SKFont(SKTypeface.FromFamilyName("Helvetica",500,5,SKFontStyleSlant.Upright), fontSize);
|
||||
SKTextAlign align = SKTextAlign.Left;
|
||||
imageHelper.CreateBoundedText(text, SKColors.Black, SKColors.White, align, font);
|
||||
using MemoryStream memoryStream = new MemoryStream();
|
||||
imageHelper.ToStream().CopyTo(memoryStream);
|
||||
return new ScottPlot.Image(memoryStream.ToArray());
|
||||
|
||||
Reference in New Issue
Block a user