- 一个使用
SkiaSharp
制作的,基于.net core 6.0
的跨平台词云库,思路和流程参考自AmmRage/WordCloudSharp
- 从Nuget中添加 WordCloud.NetCore 包引用
using var wordCloud = new WordCloud.WordCloud(fontFile, true);
await wordCloud.Draw(words, 1000, 1000, "E:\\test\\wordcloud.jpg");
var fontFile = new FileInfo("Fonts\\hywenhei85w.ttf");
var maskFile = new FileInfo("Mask\\mask.png");
using var wordCloud = new WordCloud.WordCloud(fontFile, true);
await wordCloud.Draw(words, maskFile, 1500, "E:\\test\\wordcloud.jpg");
var colors = new SKColor[] { SKColors.LightBlue, SKColors.LightGreen, SKColors.LightPink, SKColors.LightSeaGreen };
using var wordCloud = new WordCloud.WordCloud(fontFile, true, 3, SKColors.White, colors);
await wordCloud.Draw(words, 500, 500, "E:\\test\\wordcloud.jpg");