csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.2 KiB
68 lines
2.2 KiB
using Avalonia.Platform;
|
|
using Avalonia.Visuals.Media.Imaging;
|
|
|
|
namespace Avalonia.Rendering.SceneGraph
|
|
{
|
|
/// <summary>
|
|
/// A node in the scene graph which represents an bitmap blending mode push or pop.
|
|
/// </summary>
|
|
internal class BitmapBlendModeNode : IDrawOperation
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="BitmapBlendModeNode"/> class that represents an
|
|
/// <see cref="BitmapBlendingMode"/> push.
|
|
/// </summary>
|
|
/// <param name="bitmapBlend">The <see cref="BitmapBlendingMode"/> to push.</param>
|
|
public BitmapBlendModeNode(BitmapBlendingMode bitmapBlend)
|
|
{
|
|
BlendingMode = bitmapBlend;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="BitmapBlendModeNode"/> class that represents an
|
|
/// <see cref="BitmapBlendingMode"/> pop.
|
|
/// </summary>
|
|
public BitmapBlendModeNode()
|
|
{
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public Rect Bounds => Rect.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets the BitmapBlend to be pushed or null if the operation represents a pop.
|
|
/// </summary>
|
|
public BitmapBlendingMode? BlendingMode { get; }
|
|
|
|
/// <inheritdoc/>
|
|
public bool HitTest(Point p) => false;
|
|
|
|
/// <summary>
|
|
/// Determines if this draw operation equals another.
|
|
/// </summary>
|
|
/// <param name="blendingMode">the <see cref="BitmapBlendModeNode"/> how to compare</param>
|
|
/// <returns>True if the draw operations are the same, otherwise false.</returns>
|
|
/// <remarks>
|
|
/// The properties of the other draw operation are passed in as arguments to prevent
|
|
/// allocation of a not-yet-constructed draw operation object.
|
|
/// </remarks>
|
|
public bool Equals(BitmapBlendingMode? blendingMode) => BlendingMode == blendingMode;
|
|
|
|
/// <inheritdoc/>
|
|
public void Render(IDrawingContextImpl context)
|
|
{
|
|
if (BlendingMode.HasValue)
|
|
{
|
|
context.PushBitmapBlendMode(BlendingMode.Value);
|
|
}
|
|
else
|
|
{
|
|
context.PopBitmapBlendMode();
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|