当前位置: 首页>>代码示例>>C#>>正文


C# CaptureType类代码示例

本文整理汇总了C#中CaptureType的典型用法代码示例。如果您正苦于以下问题:C# CaptureType类的具体用法?C# CaptureType怎么用?C# CaptureType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CaptureType类属于命名空间,在下文中一共展示了CaptureType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Capture

        public override void Capture(CaptureType captureType, TaskSettings taskSettings, bool autoHideForm = true)
        {
            DoCapture(() =>
            {
                Image img;
                string activeWindowTitle = NativeMethods.GetForegroundWindowText();
                string activeProcessName = null;

                using (Process process = NativeMethods.GetForegroundWindowProcess())
                {
                    if (process != null)
                    {
                        activeProcessName = process.ProcessName;
                    }
                }

                if (taskSettings.CaptureSettings.CaptureTransparent && !taskSettings.CaptureSettings.CaptureClientArea)
                {
                    img = Screenshot.CaptureActiveWindowTransparent();
                }
                else
                {
                    img = Screenshot.CaptureActiveWindow();
                }

                img.Tag = new ImageTag
                {
                    ActiveWindowTitle = activeWindowTitle,
                    ActiveProcessName = activeProcessName
                };

                return img;
            }, CaptureType.ActiveWindow, taskSettings, autoHideForm);
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:34,代码来源:CaptureActiveWindow.cs

示例2: CaptureScreenshot

        public static void CaptureScreenshot(CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
        {
            if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();

            switch (captureType)
            {
                case CaptureType.Fullscreen:
                    DoCapture(TaskHelpers.GetScreenshot(taskSettings).CaptureFullscreen, CaptureType.Fullscreen, taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveWindow:
                    CaptureActiveWindow(taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveMonitor:
                    DoCapture(TaskHelpers.GetScreenshot(taskSettings).CaptureActiveMonitor, CaptureType.ActiveMonitor, taskSettings, autoHideForm);
                    break;
                case CaptureType.Region:
                    CaptureRegion(taskSettings, autoHideForm);
                    break;
                case CaptureType.CustomRegion:
                    CaptureCustomRegion(taskSettings, autoHideForm);
                    break;
                case CaptureType.LastRegion:
                    CaptureLastRegion(taskSettings, autoHideForm);
                    break;
            }
        }
开发者ID:L1Q,项目名称:ShareX,代码行数:26,代码来源:CaptureTaskHelpers.cs

示例3: CaptureScreenshot

        public void CaptureScreenshot(CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
        {
            if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();

            switch (captureType)
            {
                case CaptureType.Screen:
                    DoCapture(Screenshot.CaptureFullscreen, CaptureType.Screen, taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveWindow:
                    CaptureActiveWindow(taskSettings, autoHideForm);
                    break;
                case CaptureType.ActiveMonitor:
                    DoCapture(Screenshot.CaptureActiveMonitor, CaptureType.ActiveMonitor, taskSettings, autoHideForm);
                    break;
                case CaptureType.Rectangle:
                case CaptureType.RectangleWindow:
                case CaptureType.RoundedRectangle:
                case CaptureType.Ellipse:
                case CaptureType.Triangle:
                case CaptureType.Diamond:
                case CaptureType.Polygon:
                case CaptureType.Freehand:
                    CaptureRegion(captureType, taskSettings, autoHideForm);
                    break;
                case CaptureType.LastRegion:
                    CaptureLastRegion(taskSettings, autoHideForm);
                    break;
            }
        }
开发者ID:jakesyl,项目名称:ShareX,代码行数:30,代码来源:MainForm_Capture.cs

示例4: GetStrategy

        public CaptureStrategy GetStrategy(CaptureType captureType, MainForm mainForm)
        {
            CaptureStrategy strategy = null;

            switch (captureType)
            {
                case CaptureType.Screen:
                    strategy = new CaptureScreen(mainForm);
                    break;
                case CaptureType.ActiveWindow:
                    strategy = new CaptureActiveWindow(mainForm);
                    break;
                case CaptureType.ActiveMonitor:
                    strategy = new CaptureActiveMonitor(mainForm);
                    break;
                case CaptureType.Rectangle:
                case CaptureType.RectangleWindow:
                case CaptureType.Polygon:
                case CaptureType.Freehand:
                    strategy = new CaptureRegion(mainForm);
                    break;
                case CaptureType.CustomRegion:
                    strategy = new CaptureCustomRegion(mainForm);
                    break;
                case CaptureType.LastRegion:
                    strategy = new CaptureLastRegion(mainForm);
                    break;
            }
            return strategy;
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:30,代码来源:CaptureFactory.cs

示例5: ParseHidReport

 protected override void ParseHidReport(byte[] report)
 {
     if (Capture != CaptureType.Default)
     {
         _dumper.DumpArray(Capture.ToString(), report, report.Length);
         Capture = CaptureType.Default;
     }
 }
开发者ID:CheesyKek,项目名称:ScpToolkit,代码行数:8,代码来源:UsbBlankGamepad.cs

示例6: Capture

        public override void Capture(CaptureType captureType, TaskSettings taskSettings, bool autoHideForm = true)
        {
            DoCapture(() =>
            {
                Rectangle regionBounds = taskSettings.CaptureSettings.CaptureCustomRegion;
                Image img = Screenshot.CaptureRectangle(regionBounds);

                return img;
            }, CaptureType.CustomRegion, taskSettings, autoHideForm);
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:10,代码来源:CaptureCustomRegion.cs

示例7: VideoCapture

        /// <summary>
        /// 空の状態で初期化. 後でOpenが必要.
        /// </summary>
        /// <returns></returns>
#else
        /// <summary>
        /// Initializes empty capture.
        /// To use this, you should call Open. 
        /// </summary>
        /// <returns></returns>
#endif
        public VideoCapture()
        {
            try
            {
                ptr = NativeMethods.videoio_VideoCapture_new1();
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create VideoCapture", e);
            }
            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Failed to create VideoCapture");
            
            captureType = CaptureType.NotSpecified;
        }
开发者ID:Bobanaut,项目名称:opencvsharp,代码行数:26,代码来源:VideoCapture.cs

示例8: CvCapture

        /// <summary>
        /// カメラからのビデオキャプチャを初期化する.
        /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). 
        /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). 
        /// </summary>
        /// <param name="index">使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. 
        /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
        /// </summary>
        /// <param name="index">Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. </param>
        /// <returns></returns>
#endif
        public CvCapture(int index)
        {
            try
            {
                this._ptr = CvInvoke.cvCreateCameraCapture(index);
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create CvCapture", e);
            }
            if (this._ptr == IntPtr.Zero)
            {
                throw new OpenCvSharpException("Failed to create CvCapture");
            }
            this._captureType = CaptureType.Camera;
        }
开发者ID:sanglin307,项目名称:UnityOpenCV,代码行数:31,代码来源:CvCapture.cs

示例9: CvCapture

        /// <summary>
        /// カメラからのビデオキャプチャを初期化する.
        /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). 
        /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). 
        /// </summary>
        /// <param name="index">使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. 
        /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
        /// </summary>
        /// <param name="index">Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. </param>
        /// <returns></returns>
#endif
        public CvCapture(int index)
        {
            try
            {
                ptr = NativeMethods.cvCreateCameraCapture(index);
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create CvCapture", e);
            }

            if (ptr == IntPtr.Zero)
                throw new OpenCvSharpException("Failed to create CvCapture");
            
            captureType = CaptureType.Camera;
        }
开发者ID:0sv,项目名称:opencvsharp,代码行数:31,代码来源:CvCapture.cs

示例10: Capture

 public static Image Capture(CaptureType type, Point origin = default(Point), Size size = default(Size), IntPtr handle = default(IntPtr))
 {
     Image result;
     switch (type) {
         case CaptureType.Range:
             result = CaptureRange(origin, size);
             break;
         case CaptureType.Window:
             result = CaptureWindow(handle);
             break;
         default:
             result = CaptureFullScreen();
             break;
     }
     Clipboard.SetImage(result);
     return result;
 }
开发者ID:curtisrutland,项目名称:ScreenGrabber,代码行数:17,代码来源:ScreenCapture.cs

示例11: ExecuteJob

        private async void ExecuteJob(CaptureType captureType, bool withDelay)
        {
            if (withDelay)
                await Task.Delay(250);

            switch (captureType)
            {
                case CaptureType.PrintScreen:
                    DoCaptureWork(Screenshot.CaptureFullscreen);
                    break;
                case CaptureType.ActiveWindow:
                    DoCaptureWork(Screenshot.CaptureActiveWindow);
                    break;
                case CaptureType.Rectangle:
                    DoCaptureWork(CaptureRectangle);
                    break;
            }
        }
开发者ID:CrazyJo,项目名称:ScreenShotShooter,代码行数:18,代码来源:ScreenShotEngine.cs

示例12: DoCapture

        public static void DoCapture(ScreenCaptureDelegate capture, CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
        {
            if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();

            if (taskSettings.CaptureSettings.IsDelayScreenshot && taskSettings.CaptureSettings.DelayScreenshot > 0)
            {
                TaskEx.Run(() =>
                {
                    int sleep = (int)(taskSettings.CaptureSettings.DelayScreenshot * 1000);
                    Thread.Sleep(sleep);
                },
                () =>
                {
                    DoCaptureWork(capture, captureType, taskSettings, autoHideForm);
                });
            }
            else
            {
                DoCaptureWork(capture, captureType, taskSettings, autoHideForm);
            }
        }
开发者ID:L1Q,项目名称:ShareX,代码行数:21,代码来源:CaptureTaskHelpers.cs

示例13: AfterCapture

        protected void AfterCapture(Image img, CaptureType captureType, TaskSettings taskSettings)
        {
            if (img != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    TaskHelpers.PlayCaptureSound(taskSettings);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                string customFileName;

                if (TaskHelpers.ShowAfterCaptureForm(taskSettings, out customFileName, img))
                {
                    UploadManager.RunImageTask(img, taskSettings, customFileName);
                }
            }
        }
开发者ID:harley1011,项目名称:ShareX,代码行数:22,代码来源:CaptureStrategy.cs

示例14: AfterCapture

        private void AfterCapture(Image img, CaptureType captureType, TaskSettings taskSettings)
        {
            if (img != null)
            {
                if (taskSettings.GeneralSettings.PlaySoundAfterCapture)
                {
                    Helpers.PlaySoundAsync(Resources.CameraSound);
                }

                if (taskSettings.ImageSettings.ImageEffectOnlyRegionCapture && !IsRegionCapture(captureType))
                {
                    taskSettings.AfterCaptureJob = taskSettings.AfterCaptureJob.Remove(AfterCaptureTasks.AddImageEffects);
                }

                if (taskSettings.GeneralSettings.ShowAfterCaptureTasksForm)
                {
                    using (AfterCaptureForm afterCaptureForm = new AfterCaptureForm(img, taskSettings))
                    {
                        afterCaptureForm.ShowDialog();

                        switch (afterCaptureForm.Result)
                        {
                            case AfterCaptureFormResult.Continue:
                                taskSettings.AfterCaptureJob = afterCaptureForm.AfterCaptureTasks;
                                break;
                            case AfterCaptureFormResult.Copy:
                                taskSettings.AfterCaptureJob = AfterCaptureTasks.CopyImageToClipboard;
                                break;
                            case AfterCaptureFormResult.Cancel:
                                if (img != null) img.Dispose();
                                return;
                        }
                    }
                }

                UploadManager.RunImageTask(img, taskSettings);
            }
        }
开发者ID:kennethisom,项目名称:ShareX,代码行数:38,代码来源:MainForm_Capture.cs

示例15: Open

        /// <summary>
        /// カメラからのビデオキャプチャを初期化する.
        /// Windows では,次の二つのカメラインタフェースが利用できる:Video for Windows(VFW),Matrox Imaging Library(MIL). 
        /// Linux では,次の二つカメラインタフェースが利用できる:Video for Linux(V4L),FireWire(IEEE1394). 
        /// </summary>
        /// <param name="index">使われるカメラのインデックス.使用するカメラが1台のとき,あるいは,何台のカメラを使うかが重要でないときは,-1 でも問題ない場合もある.</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Allocates and initialized the CvCapture structure for reading a video stream from the camera. 
        /// Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
        /// </summary>
        /// <param name="index">Index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed. </param>
        /// <returns></returns>
#endif
        public void Open(int index)
        {
            ThrowIfDisposed();
            try
            {
                NativeMethods.videoio_VideoCapture_open2(ptr, index);
            }
            catch (AccessViolationException e)
            {
                throw new OpenCvSharpException("Failed to create CvCapture", e);
            }
            captureType = CaptureType.Camera;
        }
开发者ID:Bobanaut,项目名称:opencvsharp,代码行数:28,代码来源:VideoCapture.cs


注:本文中的CaptureType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。