ScreenToGif/Controls/WebcamControl.xaml.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using ScreenToGif.Webcam.DirectX;

namespace ScreenToGif.Controls
{
    public partial class WebcamControl : UserControl
    {
        #region Variables

        public CaptureWebcam Capture { get; set; }

        public Filter VideoDevice { get; set; }

        #endregion

        #region Properties

        public int VideoWidth => Capture?.Width ?? -1;

        public int VideoHeight => Capture?.Height ?? -1;

        #endregion

        public WebcamControl()
        {
            InitializeComponent();
        }

        #region Private Methods

        private bool IsInDesignMode()
        {
            return DesignerProperties.GetIsInDesignMode(this);
        }

        private double Scale()
        {
            var source = PresentationSource.FromVisual(this);

            if (source != null)
                if (source.CompositionTarget != null)
                    return source.CompositionTarget.TransformToDevice.M11;

            return 1d;
        }

        #endregion

        #region Public Methods

        public void Refresh()
        {
            //To change the video device, a dispose is needed.
            if (Capture != null)
            {
                Capture.Dispose();
                Capture = null;
后面还有 46 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。