本文整理汇总了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);
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例5: ParseHidReport
protected override void ParseHidReport(byte[] report)
{
if (Capture != CaptureType.Default)
{
_dumper.DumpArray(Capture.ToString(), report, report.Length);
Capture = CaptureType.Default;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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;
}