Пример #1
0
            protected void DrawPosition(Graphics graphics, float scale)
            {
                var report = data?.GetData(AppInfo.PluginManager);

                if (report is ITabletReport tabletReport && tablet.Digitizer.ActiveReportID.IsInRange(tabletReport.ReportID))
                {
                    var tabletMm    = new SizeF(tablet.Digitizer.Width, tablet.Digitizer.Height);
                    var tabletPx    = new SizeF(tablet.Digitizer.MaxX, tablet.Digitizer.MaxY);
                    var tabletScale = tabletMm / tabletPx * scale;
                    var position    = new PointF(tabletReport.Position.X, tabletReport.Position.Y) * tabletScale;

                    var drawRect = RectangleF.FromCenter(position, new SizeF(5, 5));
                    graphics.FillEllipse(AccentColor, drawRect);
                }
            }
Пример #2
0
        private void HandleReport(object sender, RpcData rpcData)
        {
            var report = rpcData.GetData(AppInfo.PluginManager);

            tabletVisualizer.SetData(rpcData);

            if (report is IDeviceReport deviceReport)
            {
                reportPeriod += (stopwatch.Restart().TotalMilliseconds - reportPeriod) / 10.0f;
                reportRateBox.Update($"{(uint)(1000 / reportPeriod)}hz");

                string formatted = ReportFormatter.GetStringFormat(deviceReport);
                tabletBox.Update(formatted);

                string raw = ReportFormatter.GetStringRaw(deviceReport);
                rawTabletBox.Update(raw);
            }
        }