mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
* to mat init * BitBlt 加锁 * 使用读写锁重构 Windows.Graphics.Capture,删除BGI自己命名的缓存设置 * dwm加锁并返回mat * 队伍中没有对应元素角色修复日志问题 * 清除所有 DispatcherTimerOperationEnum 内容 * 修复单测的编译错误 * HDR Support * 清理无用的截图器模式
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using BetterGenshinImpact.GameTask.Model.Area;
|
|
using System;
|
|
using System.Drawing;
|
|
using OpenCvSharp;
|
|
|
|
namespace BetterGenshinImpact.GameTask;
|
|
|
|
/// <summary>
|
|
/// 捕获的内容
|
|
/// 以及一些多个trigger会用到的内容
|
|
/// </summary>
|
|
public class CaptureContent : IDisposable
|
|
{
|
|
public static readonly int MaxFrameIndexSecond = 60;
|
|
public int FrameIndex { get; }
|
|
public double TimerInterval { get; }
|
|
|
|
public int FrameRate => (int)(1000 / TimerInterval);
|
|
|
|
public ImageRegion CaptureRectArea { get; private set; }
|
|
|
|
public CaptureContent(Mat image, int frameIndex, double interval)
|
|
{
|
|
FrameIndex = frameIndex;
|
|
TimerInterval = interval;
|
|
var systemInfo = TaskContext.Instance().SystemInfo;
|
|
|
|
var gameCaptureRegion = systemInfo.DesktopRectArea.Derive(image, systemInfo.CaptureAreaRect.X, systemInfo.CaptureAreaRect.Y);
|
|
CaptureRectArea = gameCaptureRegion.DeriveTo1080P();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 用于兼容新的 ImageRegion
|
|
/// </summary>
|
|
/// <param name="ra"></param>
|
|
public CaptureContent(ImageRegion ra)
|
|
{
|
|
CaptureRectArea = ra;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
CaptureRectArea.Dispose();
|
|
}
|
|
} |