Ejemplo n.º 1
0
        public DrawingConfig(string fontName, string brushColor, Size size)
        {
            var color = DrawingConfig.GetColorByName(brushColor);

            Font  = new Font(fontName, 10);
            Brush = new SolidBrush(color);
            Size  = size;
        }
Ejemplo n.º 2
0
        public Bitmap DrawMap(IEnumerable <WordInRect> words, DrawingConfig config)
        {
            var mainRect        = layoutNormalizer.GetMainRect(words);
            var normalizedWords = layoutNormalizer.ShiftLayout(words, mainRect);
            var bitmap          = new Bitmap(mainRect.Width, mainRect.Height);
            var graphics        = Graphics.FromImage(bitmap);

            foreach (var word in normalizedWords)
            {
                graphics.DrawString(word.Word, word.Font, config.GenerateBrush(word), word.Rect,
                                    StringFormat.GenericTypographic);
            }
            return(new Bitmap(bitmap, config.Size));
        }