Ejemplo n.º 1
0
        public static Process GenerateVideoFile(string previewFileName, int seconds, int width, int height, Color color, bool checkered, decimal frameRate, Bitmap bitmap, DataReceivedEventHandler dataReceivedHandler = null)
        {
            Process processMakeVideo;

            if (bitmap != null)
            {
                var tempImageFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".png");
                var backgroundImage   = ExportPngXml.ResizeBitmap(bitmap, width, height);
                backgroundImage.Save(tempImageFileName, ImageFormat.Png);
                processMakeVideo = GetFFmpegProcess(tempImageFileName, previewFileName, backgroundImage.Width, backgroundImage.Height, seconds, frameRate);
            }
            else if (checkered)
            {
                const int rectangleSize     = 9;
                var       backgroundImage   = TextDesigner.MakeBackgroundImage(width, height, rectangleSize, Configuration.Settings.General.UseDarkTheme);
                var       tempImageFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".png");
                backgroundImage.Save(tempImageFileName, ImageFormat.Png);
                processMakeVideo = GetFFmpegProcess(tempImageFileName, previewFileName, backgroundImage.Width, backgroundImage.Height, seconds, frameRate);
            }
            else
            {
                processMakeVideo = GetFFmpegProcess(color, previewFileName, width, height, seconds, frameRate);
            }

            SetupDataReceiveHandler(dataReceivedHandler, processMakeVideo);

            return(processMakeVideo);
        }
Ejemplo n.º 2
0
        private void trackBarResize_Scroll(object sender, EventArgs e)
        {
            Factor           = trackBarResize.Value / 100.0m;
            labelResize.Text = string.Format(LanguageSettings.Current.BinEdit.ResizeX, trackBarResize.Value);
            var bmp = ExportPngXml.ResizeBitmap(_bitmap, (int)Math.Round(_bitmap.Width * Factor), (int)Math.Round(_bitmap.Height * Factor));

            pictureBoxResized.Image?.Dispose();
            pictureBoxResized.Image = bmp;

            comboBoxAlignment.Items.Clear();
            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.TopLeft);
            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.TopCenter);
            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.TopRight);

            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.MiddleLeft);
            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.MiddleCenter);
            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.MiddleRight);

            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.BottomLeft);
            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.BottomCenter);
            comboBoxAlignment.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.BottomRight);

            comboBoxAlignment.SelectedIndex = 7;
        }