コード例 #1
0
 public void StartRecording()
 {
     // Start recording
     recorder    = new GIFRecorder(imageWidth, imageHeight, frameDuration);
     cameraInput = new CameraInput(recorder, new RealtimeClock(), Camera.main);
     // Get a real GIF look by skipping frames
     cameraInput.frameSkip = 4;
 }
コード例 #2
0
 public void StartRecording()
 {
     // Start recording
     gifRecorder = new GIFRecorder(imageWidth, imageHeight, frameDuration, OnGIF);
     // Create a camera input
     cameraInput = new CameraInput(gifRecorder, new RealtimeClock(), Camera.main);
     // Get a real GIF look by skipping frames
     cameraInput.recordEveryNthFrame = 5;
 }
コード例 #3
0
        public static async Task Create(Rect Region)
        {
            var controls = new CaptureControls();

            controls.captureRecordingFrame = new CaptureRecordingFrame();
            controls.Top  = Math.Min(Region.Bottom + 5, Screen.FromPoint(System.Windows.Forms.Cursor.Position).WorkingArea.Bottom - controls.Height);
            controls.Left = Region.Left + (Region.Width / 2) - (controls.Width / 2);
            controls.captureRecordingFrame.Top    = Math.Max(0, Region.Top - 5);
            controls.captureRecordingFrame.Left   = Math.Max(0, Region.Left - 5);
            controls.captureRecordingFrame.Width  = Region.Width + 10;
            controls.captureRecordingFrame.Height = Region.Height + 10;
            controls.Show();
            controls.captureRecordingFrame.Show();

            if (Settings.Current.RecordingDelay > 0)
            {
                await Task.Delay(1000);

                while (controls.captureRecordingFrame.countdownText.Text != "0")
                {
                    controls.captureRecordingFrame.countdownText.Text = (int.Parse(controls.captureRecordingFrame.countdownText.Text) - 1).ToString();
                    await Task.Delay(1000);
                }
            }

            controls.captureRecordingFrame.countdownText.Visibility = Visibility.Collapsed;
            do
            {
                await Task.Delay(100);
            }while (controls.captureRecordingFrame.countdownText.IsVisible);

            var timer = new System.Windows.Threading.DispatcherTimer();

            timer.Interval = TimeSpan.FromMilliseconds(100);
            var lastTick = DateTime.Now;

            timer.Tick += (send, arg) =>
            {
                if (GIFRecorder.State == GIFRecorder.RecordingState.Stopped)
                {
                    (send as System.Windows.Threading.DispatcherTimer).Stop();
                    return;
                }
                if (GIFRecorder.State == GIFRecorder.RecordingState.Recording)
                {
                    controls.CaptureDuration += DateTime.Now - lastTick;
                    controls.textTimer.Text   = controls.CaptureDuration.ToString("hh':'mm':'ss':'ff");
                    lastTick = DateTime.Now;
                }
            };
            timer.Start();

            GIFRecorder.Record(Capture.Current.GetDrawnRegion(true));
        }
コード例 #4
0
        private async void buttonStop_Click(object sender, RoutedEventArgs e)
        {
            textWait.Visibility = Visibility.Visible;
            GIFRecorder.State   = GIFRecorder.RecordingState.Stopped;
            await Task.Delay(100);

            buttonStop.IsEnabled   = false;
            buttonResume.IsEnabled = false;
            buttonPause.IsEnabled  = false;
            GIFRecorder.Encode();
            captureRecordingFrame.Close();
            this.Close();
        }
コード例 #5
0
    public void StartGIFRecording()
    {
        // Get screen size
        imageWidth  = GetComponent <Camera>().pixelWidth;
        imageHeight = GetComponent <Camera>().pixelHeight;

        // Start recording
        recorder    = new GIFRecorder(imageWidth, imageHeight, frameDuration);
        cameraInput = new CameraInput(recorder, new RealtimeClock(), Camera.main);

        // Get a real GIF look by skipping frames
        cameraInput.frameSkip = 4;
    }