Ejemplo n.º 1
0
        public static void CreateWords(string applicationDirectory, string fileName, string[] text)
        {
            var height = 600;
            var width  = 600;
            var center = new Point(width / 2, height / 2);
            var cloud  = new TagsCloud(text, center, width, height);

            cloud.CreateRectanglesForWords();

            var filePathToOpen = Path.Combine(applicationDirectory, fileName);

            cloud.CreateBirmapWithWords(filePathToOpen);
        }
Ejemplo n.º 2
0
        public void RenderIntoFile(string filePath, ITagsCloud tagsCloud)
        {
            var shiftedRectangles = ShiftRectanglesToMainQuarter(tagsCloud.AddedRectangles);
            var tagCloudToDraw    = new TagsCloud(tagsCloud.Center, shiftedRectangles);
            var pictureSize       = GetPictureSize(tagCloudToDraw);
            var btm = new Bitmap(pictureSize.Width, pictureSize.Height);
            var obj = Graphics.FromImage(btm);

            foreach (var r in tagCloudToDraw.AddedRectangles)
            {
                obj.DrawRectangle(new Pen(Color.Brown), r);
            }

            btm.Save(filePath);
        }