Skip to content

Commit

Permalink
Added custom acrylic brush cache mode parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Jul 13, 2017
1 parent 336b1aa commit 030ef35
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions UICompositionAnimations/Brushes/CustomAcrylicBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,15 @@ private static async void OnTintMixPropertyChanged(DependencyObject d, Dependenc
}

/// <summary>
/// Gets the <see cref="Uri"/> to the noise texture to use (NOTE: this must be initialized before using the brush)
/// Gets or sets the <see cref="Uri"/> to the noise texture to use (NOTE: this must be initialized before using the brush)
/// </summary>
public Uri NoiseTextureUri { get; set; }

/// <summary>
/// Gets or sets whether or not the noise texture should be loaded from the internal cache, if possible
/// </summary>
public bool EnableCaching { get; set; } = true;

#endregion

// Initialization semaphore (due to the Win2D image loading being asynchronous)
Expand Down Expand Up @@ -247,7 +252,7 @@ private async Task SetupEffectAsync()

// Get the noise brush using Win2D
IGraphicsEffect source = await AcrylicEffectHelper.ConcatenateEffectWithTintAndBorderAsync(Window.Current.Compositor,
baseEffect, sourceParameters, Tint, (float)TintMix, null, NoiseTextureUri);
baseEffect, sourceParameters, Tint, (float)TintMix, null, NoiseTextureUri, reload: !EnableCaching);

// Extract and setup the tint and color effects
ArithmeticCompositeEffect tint = source as ArithmeticCompositeEffect ?? source.To<BlendEffect>().Background as ArithmeticCompositeEffect;
Expand Down

0 comments on commit 030ef35

Please sign in to comment.