-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNativeMethods.cs
More file actions
48 lines (39 loc) · 1.29 KB
/
NativeMethods.cs
File metadata and controls
48 lines (39 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Runtime.InteropServices;
namespace RedLight;
internal static class NativeMethods
{
private const string MagnificationDll = "Magnification.dll";
public static readonly float[] IdentityMatrix =
[
1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1
];
[DllImport(MagnificationDll, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MagInitialize();
[DllImport(MagnificationDll, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MagUninitialize();
[DllImport(MagnificationDll, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MagSetFullscreenColorEffect(ref MagColorEffect pEffect);
public static void ResetColorEffect()
{
var effect = new MagColorEffect(IdentityMatrix);
MagSetFullscreenColorEffect(ref effect);
}
[StructLayout(LayoutKind.Sequential)]
public struct MagColorEffect
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)]
public float[] transform;
public MagColorEffect(float[] matrix)
{
transform = new float[25];
matrix.CopyTo(transform, 0);
}
}
}