sgur
7/8/2015 - 7:44 PM

C# structures to implement "Aero Glass" blur on Windows 10

C# structures to implement "Aero Glass" blur on Windows 10

[DllImport("user32.dll")]
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);

[StructLayout(LayoutKind.Sequential)]
internal struct WindowCompositionAttributeData
{
	public WindowCompositionAttribute Attribute;
	public IntPtr Data;
	public int SizeOfData;
}

internal enum WindowCompositionAttribute
{
	// ...
	WCA_ACCENT_POLICY = 19
	// ...
}

internal enum AccentState
{
	ACCENT_DISABLED = 0,
	ACCENT_ENABLE_GRADIENT = 1,
	ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
	ACCENT_ENABLE_BLURBEHIND = 3,
	ACCENT_INVALID_STATE = 4
}

[StructLayout(LayoutKind.Sequential)]
internal struct AccentPolicy
{
	public AccentState AccentState;
	public int AccentFlags;
	public int GradientColor;
	public int AnimationId;
}