Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions CustomFilter/CustomFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Numerics;
using System.Collections.Generic;
using System.Numerics;
using AngouriMath;
using AngouriMath.Core;
using AngouriMath.Extensions;
Expand Down Expand Up @@ -100,6 +101,8 @@ public void Consume(IDeviceReport value)
Vector2 tilt = Vector2.Zero;
uint distance = 0;

//Log.Debug("Custom Filter", String.Format("got report type {0}", value.ToString()));

if (value is ITiltReport r1)
{
tilt = r1.Tilt;
Expand All @@ -117,36 +120,44 @@ public void Consume(IDeviceReport value)
pressure = report.Pressure;

if (CalcX != null)
{
pos.X = (float)CalcX.Call(report.Position.X, report.Position.Y, report.Pressure, tilt.X, tilt.Y, distance, LastPos.X, LastPos.Y, LastP, LastT.X, LastT.Y, LastD, digitizer.MaxX, digitizer.MaxY, pen.MaxPressure, LastComputedPos.X, LastComputedPos.Y, LastComputedPressure).Real;

}
if (CalcY != null)
{
pos.Y = (float)CalcY.Call(report.Position.X, report.Position.Y, report.Pressure, tilt.X, tilt.Y, distance, LastPos.X, LastPos.Y, LastP, LastT.X, LastT.Y, LastD, digitizer.MaxX, digitizer.MaxY, pen.MaxPressure, LastComputedPos.X, LastComputedPos.Y, LastComputedPressure).Real;

}
if (CalcP != null)
{
pressure = (uint)CalcP.Call(report.Position.X, report.Position.Y, report.Pressure, tilt.X, tilt.Y, distance, LastPos.X, LastPos.Y, LastP, LastT.X, LastT.Y, LastD, digitizer.MaxX, digitizer.MaxY, pen.MaxPressure, LastComputedPos.X, LastComputedPos.Y, LastComputedPressure).Real;

}

LastPos = report.Position;
LastP = report.Pressure;
report.Pressure = pressure;
report.Position = pos;

LastComputedPos = pos;
LastComputedPressure = pressure;

value = report;
}

if (value is ITiltReport r3)
{
LastT = r3.Tilt;
r3.Tilt = tilt;
value = r3;
}

if (value is IProximityReport r4)
{
LastD = r4.HoverDistance;
r4.HoverDistance = distance;
value = r4;
}

Emit?.Invoke(value);

LastComputedPos = pos;
LastComputedPressure = pressure;
}

public event Action<IDeviceReport>? Emit;
Expand Down