private static void HandlePenBinding(DigitizerIdentifier identifier, ITabletReport report) { if (TipBinding != null) { float pressurePercent = (float)report.Pressure / identifier.MaxPressure * 100f; if (pressurePercent > TipActivationPressure && !TipState) { TipBinding.Press(); } else if (pressurePercent <= TipActivationPressure && TipState) { TipBinding.Release(); } TipState = pressurePercent > TipActivationPressure; } for (var penButton = 0; penButton < report.PenButtons.Length; penButton++) { if (PenButtonBindings.TryGetValue(penButton, out var binding) && binding != null) { if (report.PenButtons[penButton] && !PenButtonStates[penButton]) { binding.Press(); } else if (!report.PenButtons[penButton] && PenButtonStates[penButton]) { binding.Release(); } } PenButtonStates[penButton] = report.PenButtons[penButton]; } }
public TabletState( TabletConfiguration tabletProperties, DigitizerIdentifier digitizer, DeviceIdentifier auxiliary ) { TabletProperties = tabletProperties; Digitizer = digitizer; Auxiliary = auxiliary; }
private static void HandleTabletReport(DigitizerIdentifier identifier, ITabletReport report) { float pressurePercent = (float)report.Pressure / (float)identifier.MaxPressure * 100f; if (report is IEraserReport eraserReport && eraserReport.Eraser) { bool threshold = pressurePercent > EraserActivationPressure; InvokeBinding(report, EraserBinding, EraserState, threshold); EraserState = threshold; }
public TabletStatus( TabletConfiguration tabletProperties, DigitizerIdentifier tabletIdentifier, DeviceIdentifier auxiliaryIdentifier ) { TabletProperties = tabletProperties; TabletIdentifier = tabletIdentifier; AuxiliaryIdentifier = auxiliaryIdentifier; }
private static void HandleTabletReport(DigitizerIdentifier identifier, ITabletReport report) { if (TipBinding != null) { float pressurePercent = (float)report.Pressure / (float)identifier.MaxPressure * 100f; InvokeBinding(report, TipBinding, TipState, pressurePercent > TipActivationPressure); TipState = pressurePercent > TipActivationPressure; } HandleBindingCollection(report, PenButtonStates, report.PenButtons, PenButtonBindings); }
public void SetSettings(Settings settings) { var digitizer = new DigitizerIdentifier { MaxX = 2000, MaxY = 2000, Width = 20, Height = 20, ActiveReportID = new DetectionRange(null, null) }; OutputMode.Tablet = new TabletState(null, digitizer, null); OutputMode.Output = new Area { Width = settings.DisplayWidth, Height = settings.DisplayHeight, Position = new Vector2 { X = settings.DisplayX, Y = settings.DisplayY } }; OutputMode.Input = new Area { Width = settings.TabletWidth, Height = settings.TabletHeight, Position = new Vector2 { X = settings.TabletX, Y = settings.TabletY }, Rotation = settings.TabletRotation }; var data = new byte[8]; var randGen = new Random(); randGen.NextBytes(data); var parser = new TabletReportParser(); Report = parser.Parse(data); }