Skip to content

Instantly share code, notes, and snippets.

View Sergio0694's full-sized avatar
๐Ÿš€
Coding all day

Sergio Pedri Sergio0694

๐Ÿš€
Coding all day
View GitHub Profile
@Sergio0694
Sergio0694 / GetAttachedSemiAcrylicEffectAsync.cs
Last active April 22, 2022 17:04
A method that combines Composition APIs and Win2D to replicate the Acrylic brush on Windows 10 Creator's Update
/// <summary>
/// Gets a shared semaphore to avoid loading multiple Win2D resources at the same time
/// </summary>
private static readonly SemaphoreSlim Win2DSemaphore = new SemaphoreSlim(1);
/// <summary>
/// Creates an effect brush that's similar to the official Acrylic brush in the Fall Creator's Update.
/// The pipeline uses the following effects: HostBackdropBrush > <see cref="LuminanceToAlphaEffect"/> >
/// <see cref="OpacityEffect"/> > <see cref="BlendEffect"/> > <see cref="ArithmeticCompositeEffect"/> >
/// <see cref="ColorSourceEffect"/> > <see cref="BorderEffect"/> with customizable blend factors for each couple of layers