// <Snippet15> // Collect the points as the user draws the stroke. protected override void OnStylusDown(RawStylusInput rawStylusInput) { // If points is not null, there is already a stroke taking place // on the digitizer, so don't create a new StylusPointsCollection. if (points == null) { points = new StylusPointCollection(rawStylusInput.GetStylusPoints().Description); points.Add(rawStylusInput.GetStylusPoints()); currentStylus = rawStylusInput.StylusDeviceId; } }
private void Filter(RawStylusInput rawStylusInput) { StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints(); for (int i = 0; i < stylusPoints.Count; i++) { StylusPoint sp = stylusPoints[i]; if (sp.X < 100) { sp.X = 100; } if (sp.X > 400) { sp.X = 400; } if (sp.Y < 100) { sp.Y = 100; } if (sp.Y > 400) { sp.Y = 400; } stylusPoints[i] = sp; } rawStylusInput.SetStylusPoints(stylusPoints); }
//private void StudentInkCanvas_SpeedCheckedEvent(object sender, StudentInkCanvas.SpeedCheckedEventArgs e) //{ // IsSpeedChecked = e.state; //} #endregion #region overrides protected override void OnStylusDown(RawStylusInput rawStylusInput) { base.OnStylusDown(rawStylusInput); Stroke tempStroke = new Stroke(rawStylusInput.GetStylusPoints()); //if the styluspoints is not empty if (tempStroke.StylusPoints.Count >= 0) { //get the stroke thats the animation is running on ExpertStroke = ExpertStrokeCollection[StudentStrokeCount]; //set the first point of the stroke as the expert reference point ExpertStylusPoint = ExpertStroke.StylusPoints.First(); if (tempStroke.HitTest(ExpertStylusPoint.ToPoint(), HitThreshold)) { foreach (StylusPoint sp in tempStroke.StylusPoints) { hitChangedPoints.Add(sp.ToPoint()); } StrokeColor = Color.FromArgb(255, 0, 255, 0); } else { StrokeColor = Color.FromArgb(255, 255, 0, 0); } } }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { var n = rawStylusInput; EraserInkView.Count++; Debug.WriteLine($"TTTTTTTTTTTT {EraserInkView.Count:D5} " + Environment.TickCount); MainWindow.TouchTickCount = Environment.TickCount; var TranslateTransform = new TranslateTransform(); var RotateTransform = new RotateTransform(); var ScaleTransform = new ScaleTransform() { }; var stylusPointCollection = rawStylusInput.GetStylusPoints(); if (stylusPointCollection.Count > 0) { foreach (var stylusPoint in stylusPointCollection) { _mainWindow.Dispatcher.InvokeAsync(() => { var f1 = n; var point = stylusPoint; _mainWindow.EraserView.X = point.X - _mainWindow.EraserView.Width / 2; _mainWindow.EraserView.Y = point.Y - _mainWindow.EraserView.Height / 2; }, DispatcherPriority.Send); } } }
private void Filter(RawStylusInput rawStylusInput) { // Get the StylusPoints that have come in. StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints(); // Modify the (X,Y) data to move the points // inside the acceptable input area, if necessary. for (int i = 0; i < stylusPoints.Count; i++) { StylusPoint sp = stylusPoints[i]; if (sp.X < 50) { sp.X = 50; } if (sp.X > 250) { sp.X = 250; } if (sp.Y < 50) { sp.Y = 50; } if (sp.Y > 250) { sp.Y = 250; } stylusPoints[i] = sp; } // Copy the modified StylusPoints back to the RawStylusInput. rawStylusInput.SetStylusPoints(stylusPoints); }
//</Snippet9> //<Snippet10> protected override void OnStylusUp(RawStylusInput rawStylusInput) { // Run the base class before modifying the data base.OnStylusUp(rawStylusInput); // Get the StylusPoints that have come in StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints(); // Modify the (X,Y) data to move the points // inside the acceptable input area, if necessary for (int i = 0; i < stylusPoints.Count; i++) { StylusPoint sp = stylusPoints[i]; if (sp.X < 50) { sp.X = 50; } if (sp.X > 250) { sp.X = 250; } if (sp.Y < 50) { sp.Y = 50; } if (sp.Y > 250) { sp.Y = 250; } stylusPoints[i] = sp; } // Copy the modified StylusPoints back to the RawStylusInput rawStylusInput.SetStylusPoints(stylusPoints); }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints(); this.Reset(Stylus.CurrentStylusDevice, stylusPoints); base.OnStylusMove(rawStylusInput); }
protected override void OnStylusDown(RawStylusInput rawStylusInput) { var stylusPoints = rawStylusInput.GetStylusPoints(); _downPoint = (Point)stylusPoints[0]; _prevPoint = new Point(double.NegativeInfinity, double.NegativeInfinity); base.OnStylusDown(rawStylusInput); }
// Collect the points as the user draws the stroke. protected override void OnStylusMove(RawStylusInput rawStylusInput) { // Check whether the stylus that started the stroke is the same, and // that the element hasn't lost focus since the stroke began. if (points != null && currentStylus == rawStylusInput.StylusDeviceId) { points.Add(rawStylusInput.GetStylusPoints()); } }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { var movePoint = rawStylusInput.GetStylusPoints()[0]; var now = DateTime.Now; var stamp = (now - currentStroke.DownStylusPointStamp).Ticks; currentStroke.StampedStylusPoints.Add(new StampedStylusPoint { Stamp = stamp, StylusPoint = movePoint }); base.OnStylusMove(rawStylusInput); }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { int num = rawStylusInput.StylusDeviceId; if (!AllowsMouseInput) { return; } this.Move(rawStylusInput.StylusDeviceId, rawStylusInput.Timestamp, rawStylusInput.GetStylusPoints()); base.OnStylusMove(rawStylusInput); }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints(); //// 让收集到的点只剩下起点和终点 while (stylusPoints.Count > 2) { stylusPoints.RemoveAt(stylusPoints.Count - 2); } this.Reset(Stylus.CurrentStylusDevice, stylusPoints); base.OnStylusMove(rawStylusInput); }
// Collect the points as the user draws the stroke. protected override void OnStylusUp(RawStylusInput rawStylusInput) { // Check whether the stylus that started the stroke is the same, and // that the element hasn't lost focus since the stroke began. if (points != null && currentStylus == rawStylusInput.StylusDeviceId) { points.Add(rawStylusInput.GetStylusPoints()); // Subscribe to the OnStylusUpProcessed method. rawStylusInput.NotifyWhenProcessed(points); } points = null; currentStylus = 0; }
private void Transform(RawStylusInput rawStylusInput) { StylusPointCollection stylusPoints = rawStylusInput.GetStylusPoints(); for (int i = 0; i < stylusPoints.Count; i++) { StylusPoint sp = stylusPoints[i]; Point pt = (Point)sp; pt *= _matrix; sp.X = pt.X; sp.Y = pt.Y; stylusPoints[i] = sp; } rawStylusInput.SetStylusPoints(stylusPoints); }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { base.OnStylusMove(rawStylusInput); //collect the stylus point StylusPointCollection tempStylusPoints = rawStylusInput.GetStylusPoints(); //if there are no points in the collection if (tempStylusPoints.Count <= 0) { return; } ExpertStylusPoint = ReturnExpertStylusPoint(tempStylusPoints, ExpertStylusPoint, ExpertStroke); Debug.WriteLine("ExpertStylusPoint Index: " + ExpertStroke.StylusPoints.IndexOf(ExpertStylusPoint)); rawStylusInput.NotifyWhenProcessed(tempStylusPoints); }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { // Run the base class before modifying the data base.OnStylusMove(rawStylusInput); if (currentStylus == rawStylusInput.StylusDeviceId) { StylusPointCollection pointsFromEvent = rawStylusInput.GetStylusPoints(); // Restrict the stylus input and add the filtered // points to collectedPoints. StylusPointCollection points = FilterPackets(pointsFromEvent); rawStylusInput.SetStylusPoints(points); collectedPoints.Add(points); } }
protected override void OnStylusUp(RawStylusInput rawStylusInput) { // Run the base class before modifying the data base.OnStylusUp(rawStylusInput); if (currentStylus == rawStylusInput.StylusDeviceId) { StylusPointCollection pointsFromEvent = rawStylusInput.GetStylusPoints(); // Restrict the stylus input and add the filtered // points to collectedPoints. StylusPointCollection points = FilterPackets(pointsFromEvent); rawStylusInput.SetStylusPoints(points); collectedPoints.Add(points); // Subscribe to the OnStylusUpProcessed method. rawStylusInput.NotifyWhenProcessed(collectedPoints); currentStylus = -1; } }
protected override void OnStylusDown(RawStylusInput rawStylusInput) { // Run the base class before modifying the data base.OnStylusDown(rawStylusInput); if (currentStylus == -1) { StylusPointCollection pointsFromEvent = rawStylusInput.GetStylusPoints(); // Create an emtpy StylusPointCollection to contain the filtered // points. collectedPoints = new StylusPointCollection(pointsFromEvent.Description); // Restrict the stylus input and add the filtered // points to collectedPoints. StylusPointCollection points = FilterPackets(pointsFromEvent); rawStylusInput.SetStylusPoints(points); collectedPoints.Add(points); currentStylus = rawStylusInput.StylusDeviceId; } }
protected override void OnStylusDown(RawStylusInput RawStylusInput) { _firstPoint = RawStylusInput.GetStylusPoints().First().ToPoint(); base.OnStylusDown(RawStylusInput); }
protected override void OnStylusDown(RawStylusInput rawStylusInput) { Down(rawStylusInput.StylusDeviceId, rawStylusInput.Timestamp, rawStylusInput.GetStylusPoints()); rawStylusInput.NotifyWhenProcessed(rawStylusInput.StylusDeviceId); base.OnStylusDown(rawStylusInput); }
protected override void OnStylusDown(RawStylusInput rawStylusInput) { base.OnStylusDown(rawStylusInput); // 记录下起点,为了能拖出来一个完整的矩形而不是矩形序列 firstPoint = (Point)rawStylusInput.GetStylusPoints().First(); }
public void Move(Point p) { if (rs == null) { return; } Point offset = this.Element.PointToScreen(new Point()); p = new Point(p.X - offset.X, p.Y - offset.Y); if (ForcedMove != null) { ForcedMove(this, p); } rs.SetStylusPoints(new StylusPointCollection(new StylusPoint[] { new StylusPoint(p.X, p.Y, 0.5f, rs.GetStylusPoints().First().Description, new int[] { 0, 1, 0 }) })); OnStylusMove(rs); }
protected override void OnStylusDown(RawStylusInput rawStylusInput) { base.OnStylusDown(rawStylusInput); previousPoint = (Point)rawStylusInput.GetStylusPoints().First(); }