private static void ProcessBitmapImage(CliOptions options, ITagsCloudVisualizator visualizator) { var image = new Bitmap(options.Width, options.Height); var graphics = Graphics.FromImage(image); visualizator.CreateTagsCloud(graphics); image.Save(options.OutputFilename); }
private IEnumerable <ITagsPreparer> GetPreparers(CliOptions options) { yield return(new NormalizeTagsTransformer()); yield return(new LetterTagsFilter()); yield return(new StemTagTransform()); yield return(new StopWordsFilter()); if (options.MaxTagsCount.HasValue) { yield return(new FirstTagsTaker(options.MaxTagsCount.Value)); } }
public IContainer BuildDependencies(CliOptions options) { var builder = new ContainerBuilder(); builder.RegisterModule(new TagsCreatorBuild(options.InputFilename)); builder.RegisterModule(new StrictOrderEnumerationBuild <ITagsPreparer>(GetPreparers(options))); builder.RegisterInstance(new FixedFamilyFontProvider(FontFamily.GenericMonospace)) .As <IFontProvider>(); builder.RegisterInstance(options.Layouter).As <ITagsCloudLayouter>(); builder.RegisterModule(new StrictOrderEnumerationBuild <ITagsDecorator>(GetDecorators(options))); builder.RegisterModule( new StrictOrderEnumerationBuild <IBackgroundDecorator>(GetBackgroundDecorators(options))); builder.RegisterModule(new FrequencyTagsCloudWrapperBuild(options.MaximumFontSize)); builder.RegisterModule(new TagsCloudVisualizatorBuild()); return(builder.Build()); }
private static void ProcessWinFormsApplication(CliOptions options, ITagsCloudVisualizator visualizator) { Application.Run( new TagsCloudDisplayForm(visualizator, options.Width, options.Height) ); }
private IEnumerable <IBackgroundDecorator> GetBackgroundDecorators(CliOptions options) { yield return(new SolidBackgroundDecorator(options.BackgroundColor)); }
private IEnumerable <ITagsDecorator> GetDecorators(CliOptions options) { yield return(new SolidColorTagsDecorator(options.ForegroundColor)); }