You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hub/apps/develop/win2d/custom-effects.md
+17-14Lines changed: 17 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -341,7 +341,7 @@ And this part is done! This shader will generate our custom noise texture whenev
341
341
### Creating a custom effect
342
342
343
343
For our easy to use, packaged effect, we can use the `CanvasEffect` type from ComputeSharp. This type provides a straightforward way to setup all the necessary logic to create an effect graph and update it via public properties that users of the effect can interact with. There are two main methods we'll need to implement:
344
-
-`BuildEffectGraph`: this method is responsible for building the effect graph and returning the output `ICanvasImage`that we want to draw (ie. the `ICanvasImage` object representing the output node of the effect graph being constructed). It also needs to store any effects that can be updated at a later time into fields of the effect class, so they can be accessed when needed.
344
+
-`BuildEffectGraph`: this method is responsible for building the effect graph that we want to draw. That is, it needs to create all effects we need, and register the output node for the graph. For effects that can be updated at a later time, the registration is done with an associated `EffectNode<T>` value, which acts as lookup key to retrieve the effects from the graph when needed.
345
345
-`ConfigureEffectGraph`: this method refreshes the effect graph by applying the settings that the user has configured. This method is automatically invoked when needed, right before drawing the effect, and only if at least one effect property has been modified since the last time the effect was used.
346
346
347
347
Our custom effect can be defined as follows:
@@ -353,8 +353,9 @@ using Microsoft.Graphics.Canvas.Effects;
0 commit comments