예제 #1
0
        private static IEnumerable <Rectangle> GenerateLayout(Point center, int rectanglesCount)
        {
            var layouter = new CircularCloudLayouter(center);

            for (var i = 0; i < rectanglesCount; i++)
            {
                var randomSize    = GetRandomSize();
                var nextRectangle = layouter.PutNextRectangle(randomSize);
                yield return(nextRectangle);
            }
        }
예제 #2
0
 private static Result <Rectangle> GetRectangleForWord(
     CircularCloudLayouter layouter,
     WordInfo wordInfo,
     ImageCreatingOptions options)
 {
     if (wordInfo.Scale.HasNoValue)
     {
         return(Result.Fail <Rectangle>("Scale has no value"));
     }
     using (var font = new Font(options.FontName, wordInfo.Scale.Value))
     {
         var size      = TextRenderer.MeasureText(wordInfo.Word, font);
         var rectangle = layouter.PutNextRectangle(size);
         return(rectangle);
     }
 }