private static void PlaceTextOnPicture(Slide slide, Bitmap resizedBackground)
        {
            var offset = new Offset(100, 150, WordStyles.CommonFontSize, 400);

            SlideStyle.TryParse(slide.Text, out var slideStyle);

            for (int i = 0; i < slideStyle.Texts.Count; ++i)
            {
                WordStyle wordStyle = WordStyles.GetWordStyle(
                    slideStyle.Styles[i],
                    slideStyle.Colors[i],
                    slideStyle.Backgrounds[i],
                    WordStyles.CommonFontSize);

                var words = ExtractWordsFromText(slideStyle.Texts[i]);
                for (var j = 0; j < words.Length; j++)
                {
                    var word = words[j];
                    if (word.Contains('\n'))
                    {
                        word = word.Replace("\n", "");
                        offset.NewLine();
                    }

                    DrawWord(resizedBackground, word, wordStyle, offset);
                    offset.TryMakeNewLine();
                }
            }
        }
示例#2
0
        private static void PlaceTextOnPicture(Slide slide, Bitmap resizedBackground)
        {
            var offset    = new Offset(100, 150, WordStyles.CommonFontSize, 400);
            var words     = ExtractWordsFromText(slide);
            var wordStyle = WordStyles.CommonTextStyle;

            for (var i = 0; i < words.Length; i++)
            {
                var word = words[i];
                if (words[i].Contains("<"))
                {
                    wordStyle = WordStyles.GetWordStyle(words[i], WordStyles.CommonFontSize);
                    word      = words[i].Remove(0, words[i].IndexOf('>') + 1);
                }
                word = word.Replace("$]", "");
                if (word.Contains('\n'))
                {
                    word = word.Replace("\n", "");
                    offset.NewLine();
                }

                DrawWord(resizedBackground, word, wordStyle, offset);
                if (words[i].Contains("$]"))
                {
                    wordStyle = WordStyles.CommonTextStyle;
                }
                offset.TryMakeNewLine();
            }
        }