예제 #1
0
 public CaptureAction(DxRender.DxDeviceContext devices,
                      DxRender.IDxRenderer render,
                      States states,
                      CaptureSettings settings)
     : this(devices, render, states, new Context(devices, settings))
 {
 }
예제 #2
0
        static internal bool CreateAndShow(IEnumerable <CaptureOptions.ImageSize> imageSizes,
                                           IEnumerable <CaptureOptions.ImageContainer> imageContainers,
                                           IEnumerable <CaptureOptions.VideoCompression> videoCompressions,
                                           IEnumerable <CaptureOptions.VideoSize> videoSizes,
                                           IEnumerable <CaptureOptions.VideoFPS> videoFPSs,
                                           CaptureSettings settings)
        {
            List <String> _imageSizes, _imageContainers, _videoCompressions, _videoSizes, _videoFPSs;
            int           _selectedImageSize, _selectedImageContainer, _selectedVideoCompression,
                          _selectedVideoSize, _selectedVideoFPS;

            GenerateItems <CaptureOptions.ImageSize>(imageSizes, settings.ImageSize,
                                                     out _imageSizes, out _selectedImageSize);
            GenerateItems <CaptureOptions.ImageContainer>(imageContainers, settings.ImageContainer,
                                                          out _imageContainers, out _selectedImageContainer);
            GenerateItems <CaptureOptions.VideoCompression>(videoCompressions, settings.VideoCompression,
                                                            out _videoCompressions, out _selectedVideoCompression);
            GenerateItems <CaptureOptions.VideoSize>(videoSizes, settings.VideoSize,
                                                     out _videoSizes, out _selectedVideoSize);
            GenerateItems <CaptureOptions.VideoFPS>(videoFPSs, settings.VideoFPS,
                                                    out _videoFPSs, out _selectedVideoFPS);

            CaptureSettingsForm form = new CaptureSettingsForm(_imageSizes, _selectedImageSize,
                                                               _imageContainers, _selectedImageContainer,
                                                               _videoCompressions, _selectedVideoCompression,
                                                               _videoSizes, _selectedVideoSize,
                                                               _videoFPSs, _selectedVideoFPS,
                                                               settings.NamePrefix, settings.OutDirectory);

            form.ShowDialog();

            if (form._shouldApply)
            {
                settings.ImageSize
                    = new List <CaptureOptions.ImageSize>(imageSizes)[Math.Max(0, form.cbImageSize.SelectedIndex)];
                settings.ImageContainer
                    = new List <CaptureOptions.ImageContainer>(imageContainers)[Math.Max(0, form.cbImageContainer.SelectedIndex)];
                settings.VideoCompression
                    = new List <CaptureOptions.VideoCompression>(videoCompressions)[Math.Max(0, form.cbVideoCompression.SelectedIndex)];
                settings.VideoSize
                    = new List <CaptureOptions.VideoSize>(videoSizes)[Math.Max(0, form.cbVideoSize.SelectedIndex)];
                settings.VideoFPS
                    = new List <CaptureOptions.VideoFPS>(videoFPSs)[Math.Max(0, form.cbVideoFPS.SelectedIndex)];
                settings.NamePrefix   = form.tbNamePrefix.Text;
                settings.OutDirectory = form.tbOutFolder.Text;
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        public override object Clone()
        {
            CaptureSettings res = new CaptureSettings();

            res.ImageSize        = ImageSize;
            res.ImageContainer   = ImageContainer;
            res.VideoSize        = VideoSize;
            res.VideoFPS         = VideoFPS;
            res.VideoCompression = VideoCompression;
            res.NamePrefix       = NamePrefix;
            res.OutDirectory     = OutDirectory;

            return(res);
        }
예제 #4
0
            public Context(DxRender.DxDeviceContext devices, CaptureSettings settings)
            {
                IFileNamingTemplate fnt = new DateTimeFileNamingTemplate(settings.OutDirectory, settings.NamePrefix);

                KeyValuePair <int, int> iSize = CaptureOptions.ToValue(settings.ImageSize);

                ImageWidth  = iSize.Key;
                ImageHeight = iSize.Value;
                ImageSaver  = new ImageSaver(fnt, settings.ImageContainer);

                KeyValuePair <int, int> vSize = CaptureOptions.ToValue(settings.VideoSize);

                VideoWidth  = vSize.Key;
                VideoHeight = vSize.Value;
                VideoSaver  = new VideoSaver(fnt, settings.VideoSize, settings.VideoFPS, settings.VideoCompression);

                StateProviders = new List <IStateProvider>();
                StateProviders.Add(new DelegateStateProvider <bool>(StateType.IsVideoRecording, IsVideoCapturing));
            }