Skip to content

GardenHamster/WordCloud.NetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

简介

  • 一个使用SkiaSharp制作的,基于.net core 6.0 的跨平台词云库,思路和流程参考自AmmRage/WordCloudSharp

安装

生成矩形词云

using var wordCloud = new WordCloud.WordCloud(fontFile, true);
await wordCloud.Draw(words, 1000, 1000, "E:\\test\\wordcloud.jpg");

wordcloud3 wordcloud5

通过蒙版生成

  • 你需要准备一张黑色(#000000)的蒙版图片,比如这样:
  • 图片在经过等比例放大/缩小后,再将词填充到黑色(#000000)区域内
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");

wordcloud6 wordcloud7

自定义颜色

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");

wordcloud wordcloud

About

一个基于SkiaSharp的跨平台词云库

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages