Beispiel #1
0
        private static void GenerateTagCloud(IEnumerable <TagInfo> tags, string filename)
        {
            var cloudDrawer = new RectangleCloudDrawer(Color.Teal, Brushes.Peru);
            var bitmap      = cloudDrawer.DrawCloud(tags.ToList(), true);

            bitmap.Save(Environment.CurrentDirectory + $"\\Examples\\{filename}.png");
        }
Beispiel #2
0
        private static Result <None> Run(Options options)
        {
            var palette     = options.ColorTheme.Palette();
            var cloudDrawer =
                new RectangleCloudDrawer(palette.BackgroundColor, new SolidBrush(palette.PrimaryColor));

            return(TextToTagsTranslatorFactory.Create(options.Alpha, options.Phi)
                   .Then(translator => translator.TranslateTextToTags(
                             File.ReadLines(options.InputFilename),
                             new HashSet <string>(),
                             options.FontFamily,
                             options.MinFontSize))
                   .Then(tags => cloudDrawer.DrawCloud(tags.ToList()))
                   .Then(bitmap => {
                bitmap = ImageUtils.ResizeImage(bitmap, options.Width, options.Height);
                bitmap.Save(options.OutputFilename,
                            ImageFormatUtils.GetImageFormatByExtension(options.ImageExtension));
            }));
        }