public CloudDrawer(ICloudLayouter cloudLayouter, IColorProvider colorProvider, IImageSaver imageSaver) { this.cloudLayouter = cloudLayouter; ChangeImageSize(300); cloudLayouter.ChangeCenter(new Point(ImageSize / 2, ImageSize / 2)); ImageSaver = imageSaver; ColorProvider = colorProvider; }
private List <Rectangle> MakeLayout(IEnumerable <WordWithFont> words, Graphics graphics) { cloudLayouter.Reset(); cloudLayouter.ChangeCenter(new Point(ImageSize / 2, ImageSize / 2)); foreach (var word in words) { var wordSize = graphics.MeasureString(word.Word, word.Font); cloudLayouter.PutNextRectangle(wordSize.ToSize()); } return((List <Rectangle>)cloudLayouter.Rectangles); }