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"); }
public void TearDown() { if (TestContext.CurrentContext.Result.Outcome != ResultState.Failure) { return; } var failedTestsPath = TestContext.CurrentContext.TestDirectory + @"\FailedTests"; if (!Directory.Exists(failedTestsPath)) { Directory.CreateDirectory(failedTestsPath); } var cloudDrawer = new RectangleCloudDrawer(Color.Teal, Brushes.Peru, Brushes.Black); var filename = failedTestsPath + $"\\{TestContext.CurrentContext.Test.FullName}.png"; var bitmap = cloudDrawer.DrawRectangles(rectangles); bitmap.Save(filename); TestContext.WriteLine($"Tag cloud visualisation saved to file: '{filename}'"); }
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)); })); }