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.
44 lines
1.2 KiB
44 lines
1.2 KiB
using System;
|
|
using Avalonia.Media;
|
|
using Avalonia.Platform;
|
|
|
|
namespace Avalonia.Rendering.SceneGraph
|
|
{
|
|
internal sealed class CustomDrawOperation : DrawOperation
|
|
{
|
|
public Matrix Transform { get; }
|
|
public ICustomDrawOperation Custom { get; }
|
|
public CustomDrawOperation(ICustomDrawOperation custom, Matrix transform)
|
|
: base(custom.Bounds, transform)
|
|
{
|
|
Transform = transform;
|
|
Custom = custom;
|
|
}
|
|
|
|
public override bool HitTest(Point p)
|
|
{
|
|
if (Transform.HasInverse)
|
|
{
|
|
return Custom.HitTest(p * Transform.Invert());
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void Render(IDrawingContextImpl context)
|
|
{
|
|
context.Transform = Transform;
|
|
Custom.Render(context);
|
|
}
|
|
|
|
public override void Dispose() => Custom.Dispose();
|
|
|
|
public bool Equals(Matrix transform, ICustomDrawOperation custom) =>
|
|
Transform == transform && Custom?.Equals(custom) == true;
|
|
}
|
|
|
|
public interface ICustomDrawOperation : IDrawOperation, IEquatable<ICustomDrawOperation>
|
|
{
|
|
|
|
}
|
|
}
|
|
|