mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-09 00:34:14 +08:00
* BitBlt 优化 * BitBlt恢复Top-down * 渲染时翻转图像 * CaptureSession引用计数 * 恢复成无拷贝Mat * 合法性检查 * 优化截图预览窗口 * 保存截图文件必要时需要克隆一份Mat * BitBlt内存池 * 返回拷贝就不用对Session做引用计数了 * 移除CaptureImageRes * 优化DirectX * 更好地处理padding * BitBlt去掉padding 1920*1080的游戏窗口是4字节对齐的,因此不会有性能影响。这里主要用于测试。 * 修复修改窗口大小 * 合并CreateStagingTexture * 修复设备丢失崩溃 * WGC截图支持HDR * fix typo * CodeQA * 去掉1px窗口边框 * DirectX截图去掉A通道 * HDR转换使用GPU加速 --------- Co-authored-by: 辉鸭蛋 <huiyadanli@gmail.com>
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using BetterGenshinImpact.GameTask.Model.Area;
|
|
using System;
|
|
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; }
|
|
|
|
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();
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
~CaptureContent()
|
|
{
|
|
Dispose();
|
|
}
|
|
}
|