예제 #1
0
        protected Image PreviewSlide(Song sng, string currentText, string currentTranslationText)
        {
            SongSlide slide = (SongSlide)sng.Parts[CurrentPartId].Slides[CurrentSlideId].Clone();

            slide.Text            = currentText;
            slide.TranslationText = currentTranslationText;
            SlideTextFormatting slideFormatting = new SlideTextFormatting();

            PreviewFormattingMapper.Map(sng, ref slideFormatting);

            // Disabled for performance
            slideFormatting.OutlineEnabled = false;
            slideFormatting.SmoothShadow   = false;

            slideFormatting.ScaleFontSize = Settings.ProjectionFontScaling;
            slideFormatting.SmoothShadow  = false;

            TextLayer sl = new TextLayer(slideFormatting)
            {
                MainText = slide.Lines.ToArray(),
                SubText  = slide.Translation.ToArray()
            };

            sl.DrawBordersForDebugging = Settings.Default.DebugMode;

            ImageLayer il = new ImageLayer(Settings.ProjectionBackColor);

            IBackground bg = sng.Parts[CurrentPartId].Slides[CurrentSlideId].Background;

            il.Image = ImgManager.GetImage(bg);

            var      bmp = new Bitmap(1024, 768);
            Graphics gr  = Graphics.FromImage(bmp);

            gr.CompositingQuality = CompositingQuality.HighSpeed;
            gr.SmoothingMode      = SmoothingMode.HighSpeed;

            il.WriteOut(gr, null);
            sl.WriteOut(gr, null);

            return(bmp);
        }