当前位置: 首页> 文旅> 酒店 > 免费大型网站_免费制作软件的网站_我想开个网站平台怎么开呢_宁波seo公司排名

免费大型网站_免费制作软件的网站_我想开个网站平台怎么开呢_宁波seo公司排名

时间:2025/8/12 7:31:57来源:https://blog.csdn.net/qq_36437991/article/details/143227325 浏览次数:0次
免费大型网站_免费制作软件的网站_我想开个网站平台怎么开呢_宁波seo公司排名

错误信息

System.MissingMethodException: Method not found: 'System.Span`1<SixLabors.ImageSharp.PixelFormats.Rgba32> SixLabors.ImageSharp.Memory.Buffer2D`1.GetRowSpan(Int32)'.

需要升级项目

原来仅升级了SixLabors.ImageSharp没有升级drawing,都升级到最新版本
在这里插入图片描述
原来代码

//构建字体//装载字体(ttf)(而且字体一定要支持简体中文的)
var fonts = new FontCollection();
SixLabors.Fonts.FontFamily fontFamily = fonts.Install("/fonts/SourceHanSansK-Normal.ttf");
//设置为多行文本输出
SixLabors.Fonts.Font titleFont = new SixLabors.Fonts.Font(fontFamily, 60, SixLabors.Fonts.FontStyle.Regular);
//多行文本输出
var textOptions = new TextOptions()
{ApplyKerning = true,VerticalAlignment = VerticalAlignment.Top,HorizontalAlignment = HorizontalAlignment.Left,WrapTextWidth = 700
};
var graphicsOptions = new GraphicsOptions()
{Antialias = true
};
//沿着行尾的绕行路径绘制文本  
var options = new SixLabors.ImageSharp.Drawing.Processing.DrawingOptions
{GraphicsOptions = graphicsOptions,TextOptions = textOptions
};
//开始绘制文字
imageTemple.Mutate(ctx => ctx.DrawText(options, goodModel.name, titleFont, SixLabors.ImageSharp.Color.Red, new SixLabors.ImageSharp.PointF(30, 1350)));

修改后代码

//构建字体//装载字体(ttf)(而且字体一定要支持简体中文的)
var fonts = new FontCollection();
SixLabors.Fonts.FontFamily fontFamily = fonts.Add("/fonts/SourceHanSansK-Normal.ttf");
//设置为多行文本输出
SixLabors.Fonts.Font titleFont = new SixLabors.Fonts.Font(fontFamily, 60, SixLabors.Fonts.FontStyle.Regular);
//多行文本输出
var graphicsOptions = new GraphicsOptions()
{Antialias = true
};
//沿着行尾的绕行路径绘制文本  
var options = new SixLabors.ImageSharp.Drawing.Processing.DrawingOptions
{GraphicsOptions = graphicsOptions,
};
//开始绘制文字
imageTemple.Mutate(ctx => ctx.DrawText(options, goodModel.name, titleFont, SixLabors.ImageSharp.Color.Red, new SixLabors.ImageSharp.PointF(30, 1350)));

参考

https://stackoverflow.com/questions/76023548/imagesharp-watermark-net6
https://github.com/SixLabors/ImageSharp/issues/1237

关键字:免费大型网站_免费制作软件的网站_我想开个网站平台怎么开呢_宁波seo公司排名

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: