Rename nested 'CanvasEffect' types
このコミットが含まれているのは:
1 親
2c609f7a2f
コミット
a544636358
8ファイル変更
+143
-143
検索条件に一致するファイルはありません
@@ -10,7 +10,7 @@ partial class CanvasEffect
|
||||
/// <summary>
|
||||
/// An object representing an effect graph being built or configured.
|
||||
/// </summary>
|
||||
protected readonly ref struct EffectGraph
|
||||
protected readonly ref struct CanvasEffectGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// The owning <see cref="CanvasEffect"/> instance.
|
||||
@@ -18,10 +18,10 @@ partial class CanvasEffect
|
||||
private readonly CanvasEffect owner;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="EffectGraph"/> instance with the specified parameters.
|
||||
/// Creates a new <see cref="CanvasEffectGraph"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="owner">The owning <see cref="CanvasEffect"/> instance.</param>
|
||||
internal EffectGraph(CanvasEffect owner)
|
||||
internal CanvasEffectGraph(CanvasEffect owner)
|
||||
{
|
||||
this.owner = owner;
|
||||
}
|
||||
@@ -29,12 +29,12 @@ partial class CanvasEffect
|
||||
/// <summary>
|
||||
/// Gets a previously registered <see cref="ICanvasImage"/> object associated with a given effect graph node.
|
||||
/// </summary>
|
||||
/// <param name="effectNode">The <see cref="IEffectNode"/> instance to use to lookup the <see cref="ICanvasImage"/> object to retrieve.</param>
|
||||
/// <param name="effectNode">The <see cref="ICanvasEffectNode"/> instance to use to lookup the <see cref="ICanvasImage"/> object to retrieve.</param>
|
||||
/// <returns>The <see cref="ICanvasImage"/> object associated with <paramref name="effectNode"/> in the effect graph.</returns>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="effectNode"/> is <see langword="null"/>.</exception>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="effectNode"/> is not currently registered in the effect graph.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the current <see cref="EffectGraph"/> instance is not valid.</exception>
|
||||
public ICanvasImage GetNode(IEffectNode effectNode)
|
||||
/// <exception cref="InvalidOperationException">Thrown if the current <see cref="CanvasEffectGraph"/> instance is not valid.</exception>
|
||||
public ICanvasImage GetNode(ICanvasEffectNode effectNode)
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
@@ -53,12 +53,12 @@ partial class CanvasEffect
|
||||
/// Gets a previously registered <typeparamref name="T"/> object (an <see cref="ICanvasImage"/> instance) associated with a given effect graph node.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="ICanvasImage"/> object to retrieve.</typeparam>
|
||||
/// <param name="effectNode">The <see cref="IEffectNode{T}"/> instance to use to lookup the <see cref="ICanvasImage"/> object to retrieve.</param>
|
||||
/// <param name="effectNode">The <see cref="ICanvasEffectNode{T}"/> instance to use to lookup the <see cref="ICanvasImage"/> object to retrieve.</param>
|
||||
/// <returns>The <typeparamref name="T"/> object associated with <paramref name="effectNode"/> in the effect graph.</returns>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="effectNode"/> is <see langword="null"/>.</exception>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="effectNode"/> is not currently registered in the effect graph.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the current <see cref="EffectGraph"/> instance is not valid.</exception>
|
||||
public T GetNode<T>(IEffectNode<T> effectNode)
|
||||
/// <exception cref="InvalidOperationException">Thrown if the current <see cref="CanvasEffectGraph"/> instance is not valid.</exception>
|
||||
public T GetNode<T>(ICanvasEffectNode<T> effectNode)
|
||||
where T : class, ICanvasImage
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
@@ -81,24 +81,24 @@ partial class CanvasEffect
|
||||
/// <param name="canvasImage">The <see cref="ICanvasImage"/> object to register in the effect graph.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="canvasImage"/> is <see langword="null"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown if the current <see cref="EffectGraph"/> instance is not valid or if the effect graph does not support modifications at this time.
|
||||
/// Thrown if the current <see cref="CanvasEffectGraph"/> instance is not valid or if the effect graph does not support modifications at this time.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// <para><inheritdoc cref="RegisterNode{T}(EffectNode{T}, T)" path="/remarks/node()"/></para>
|
||||
/// <para><inheritdoc cref="RegisterNode{T}(CanvasEffectNode{T}, T)" path="/remarks/node()"/></para>
|
||||
/// <para>
|
||||
/// This method can be used when <paramref name="canvasImage"/> doesn't need to be retrieved from <see cref="ConfigureEffectGraph"/>, ie.
|
||||
/// when it has no properties that the current effect instance will need to mutate over it. Using this method still allows the effect to
|
||||
/// correctly track the image ownership, so that it can be disposed when the current effect instance is disposed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If performing lookups on <paramref name="canvasImage"/> is required, use the <see cref="RegisterNode{T}(EffectNode{T}, T)"/> overload.
|
||||
/// If performing lookups on <paramref name="canvasImage"/> is required, use the <see cref="RegisterNode{T}(CanvasEffectNode{T}, T)"/> overload.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public void RegisterNode(ICanvasImage canvasImage)
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != CanvasEffectInvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
|
||||
// Use a new dummy object as key to register the anonymous effect node. This is cheaper than having to maintain a different
|
||||
// data structure (eg. a HashSet<ICanvasImage> instance) just to hold the anonymous effects that may be registered. This way,
|
||||
@@ -107,27 +107,27 @@ partial class CanvasEffect
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers an <see cref="ICanvasImage"/> object in the effect graph, associated with a given <see cref="EffectNode{T}"/> instance.
|
||||
/// Registers an <see cref="ICanvasImage"/> object in the effect graph, associated with a given <see cref="CanvasEffectNode{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="ICanvasImage"/> object to register.</typeparam>
|
||||
/// <param name="effectNode">The <see cref="EffectNode{T}"/> instance to use to register <paramref name="canvasImage"/>.</param>
|
||||
/// <param name="effectNode">The <see cref="CanvasEffectNode{T}"/> instance to use to register <paramref name="canvasImage"/>.</param>
|
||||
/// <param name="canvasImage">The <see cref="ICanvasImage"/> object to register in the effect graph.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="effectNode"/> or <paramref name="canvasImage"/> are <see langword="null"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown if the current <see cref="EffectGraph"/> instance is not valid or if the effect graph does not support modifications at this time.
|
||||
/// Thrown if the current <see cref="CanvasEffectGraph"/> instance is not valid or if the effect graph does not support modifications at this time.
|
||||
/// </exception>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="effectNode"/> is already registered in the effect graph.</exception>
|
||||
/// <remarks>
|
||||
/// This method can only be called from an <see cref="EffectGraph"/> value being passed to <see cref="BuildEffectGraph"/>. If this
|
||||
/// This method can only be called from an <see cref="CanvasEffectGraph"/> value being passed to <see cref="BuildEffectGraph"/>. If this
|
||||
/// method is called from within <see cref="ConfigureEffectGraph"/>, it will fail, as the effect graph cannot be mutated from there.
|
||||
/// </remarks>
|
||||
public void RegisterNode<T>(EffectNode<T> effectNode, T canvasImage)
|
||||
public void RegisterNode<T>(CanvasEffectNode<T> effectNode, T canvasImage)
|
||||
where T : class, ICanvasImage
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != CanvasEffectInvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
|
||||
// Try to add the new canvas image associated with the input effect node marker.
|
||||
// This must not have been previously added from another RegisterNode call.
|
||||
@@ -141,14 +141,14 @@ partial class CanvasEffect
|
||||
/// Registers an <see cref="ICanvasImage"/> object in the effect graph, and marks it as the output node for the effect graph being built.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para><inheritdoc cref="RegisterNode{T}(EffectNode{T}, T)" path="/remarks/node()"/></para>
|
||||
/// <para><inheritdoc cref="RegisterNode{T}(CanvasEffectNode{T}, T)" path="/remarks/node()"/></para>
|
||||
/// <para>
|
||||
/// This method can be used when <paramref name="canvasImage"/> doesn't need to be retrieved from <see cref="ConfigureEffectGraph"/>, ie.
|
||||
/// when it has no properties that the current effect instance will need to mutate over it. Using this method still allows the effect to
|
||||
/// correctly track the image ownership, so that it can be disposed when the current effect instance is disposed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If performing lookups on <paramref name="canvasImage"/> is required, use the <see cref="RegisterOutputNode{T}(EffectNode{T}, T)"/> overload.
|
||||
/// If performing lookups on <paramref name="canvasImage"/> is required, use the <see cref="RegisterOutputNode{T}(CanvasEffectNode{T}, T)"/> overload.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <inheritdoc cref="RegisterNode(ICanvasImage)"/>
|
||||
@@ -156,7 +156,7 @@ partial class CanvasEffect
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != CanvasEffectInvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
|
||||
// Register the anonymous effect node with a dummy object, same as above
|
||||
_ = this.owner.transformNodes.TryAdd(new object(), canvasImage);
|
||||
@@ -166,17 +166,17 @@ partial class CanvasEffect
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers an <see cref="ICanvasImage"/> object in the effect graph, associated with a given <see cref="EffectNode{T}"/> instance.
|
||||
/// Registers an <see cref="ICanvasImage"/> object in the effect graph, associated with a given <see cref="CanvasEffectNode{T}"/> instance.
|
||||
/// Additionally, it also marks the input <see cref="ICanvasImage"/> object as the output node for the effect graph being built.
|
||||
/// </summary>
|
||||
/// <inheritdoc cref="RegisterNode"/>
|
||||
public void RegisterOutputNode<T>(EffectNode<T> effectNode, T canvasImage)
|
||||
public void RegisterOutputNode<T>(CanvasEffectNode<T> effectNode, T canvasImage)
|
||||
where T : class, ICanvasImage
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
default(ArgumentNullException).ThrowIfNull(canvasImage);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != InvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
default(InvalidOperationException).ThrowIf(this.owner.invalidationType != CanvasEffectInvalidationType.Creation, "The effect graph cannot be modified after its creation.");
|
||||
|
||||
// Try to add the output node as in the method above (but with an extra check before doing so)
|
||||
if (!this.owner.transformNodes.TryAdd(effectNode, canvasImage))
|
||||
@@ -189,18 +189,18 @@ partial class CanvasEffect
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets a previously registered <see cref="IEffectNode"/> instance as the output node for the effect graph.
|
||||
/// Sets a previously registered <see cref="ICanvasEffectNode"/> instance as the output node for the effect graph.
|
||||
/// </summary>
|
||||
/// <param name="effectNode">The <see cref="IEffectNode"/> instance to set as output node for the effect graph.</param>
|
||||
/// <param name="effectNode">The <see cref="ICanvasEffectNode"/> instance to set as output node for the effect graph.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="effectNode"/> is <see langword="null"/>.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the current <see cref="EffectGraph"/> instance is not valid.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the current <see cref="CanvasEffectGraph"/> instance is not valid.</exception>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="effectNode"/> is not registered in the effect graph.</exception>
|
||||
/// <remarks>
|
||||
/// This method can be called from both <see cref="BuildEffectGraph"/> and <see cref="ConfigureEffectGraph"/>. It can be used for
|
||||
/// efficiently changing the output node of a graph, without having to rebuild it. For instance, this can be used for effects that
|
||||
/// have multiple paths that can be taken for their inputs, depending on the value of some property describing the effect behavior.
|
||||
/// </remarks>
|
||||
public void SetOutputNode(IEffectNode effectNode)
|
||||
public void SetOutputNode(ICanvasEffectNode effectNode)
|
||||
{
|
||||
default(ArgumentNullException).ThrowIfNull(effectNode);
|
||||
default(InvalidOperationException).ThrowIf(this.owner is null);
|
||||
@@ -217,39 +217,39 @@ partial class CanvasEffect
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A marker interface for an effect node that was registered from an <see cref="EffectGraph"/> value.
|
||||
/// A marker interface for an effect node that was registered from an <see cref="CanvasEffectGraph"/> value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This interface allows using <see cref="EffectGraph.GetNode"/> and <see cref="EffectGraph.SetOutputNode"/> in more scenarios,
|
||||
/// This interface allows using <see cref="CanvasEffectGraph.GetNode"/> and <see cref="CanvasEffectGraph.SetOutputNode"/> in more scenarios,
|
||||
/// including where the concrete type of the image being used (eg. to set the output node) is not known (or needed) by the caller.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This interface only implemented by <see cref="EffectNode{T}"/> and it's not meant to be implemented by external types.
|
||||
/// This interface only implemented by <see cref="CanvasEffectNode{T}"/> and it's not meant to be implemented by external types.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
protected interface IEffectNode;
|
||||
protected interface ICanvasEffectNode;
|
||||
|
||||
/// <summary>
|
||||
/// A marker interface for a generic effect node that was registered from an <see cref="EffectGraph"/> value.
|
||||
/// A marker interface for a generic effect node that was registered from an <see cref="CanvasEffectGraph"/> value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The covariant type of <see cref="ICanvasImage"/> associated with the current effect node.</typeparam>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This interface allows using <see cref="EffectGraph.GetNode"/> and <see cref="EffectGraph.SetOutputNode"/> in more scenarios,
|
||||
/// including with ternary expressions returning multiple concrete <see cref="EffectNode{T}"/> instances with a common image type.
|
||||
/// This interface allows using <see cref="CanvasEffectGraph.GetNode"/> and <see cref="CanvasEffectGraph.SetOutputNode"/> in more scenarios,
|
||||
/// including with ternary expressions returning multiple concrete <see cref="CanvasEffectNode{T}"/> instances with a common image type.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// This interface only implemented by <see cref="EffectNode{T}"/> and it's not meant to be implemented by external types.
|
||||
/// This interface only implemented by <see cref="CanvasEffectNode{T}"/> and it's not meant to be implemented by external types.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
protected interface IEffectNode<out T> : IEffectNode
|
||||
protected interface ICanvasEffectNode<out T> : ICanvasEffectNode
|
||||
where T : ICanvasImage;
|
||||
|
||||
/// <summary>
|
||||
/// A marker type for an effect node that can be registered and retrieved from an <see cref="EffectGraph"/> value.
|
||||
/// A marker type for an effect node that can be registered and retrieved from an <see cref="CanvasEffectGraph"/> value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="ICanvasImage"/> associated with the current effect node.</typeparam>
|
||||
protected sealed class EffectNode<T> : IEffectNode<T>
|
||||
protected sealed class CanvasEffectNode<T> : ICanvasEffectNode<T>
|
||||
where T : class, ICanvasImage;
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする