private void Service_StrokeUpdated(object sender, StrokeUpdatedEventArgs e) { var pathPart = e.PathPart; var data = pathPart.Data.GetEnumerator(); //Data is stored XYW float x = -1; float y = -1; float w = -1; if (data.MoveNext()) { x = data.Current; } if (data.MoveNext()) { y = data.Current; } if (data.MoveNext()) { //Clamp to 0.0 -> 1.0 w = Math.Max(0.0f, Math.Min(1.0f, (data.Current - 1.0f) * pFactor)); } var point = new System.Windows.Input.StylusPoint(x * m_scale, y * m_scale, w); if (m_addNewStrokeToModel) { m_addNewStrokeToModel = false; var points = new System.Windows.Input.StylusPointCollection(); points.Add(point); var stroke = new Stroke(points); stroke.DrawingAttributes = m_DrawingAttributes; Dispatcher.Invoke(DispatcherPriority.Background, new Action(() => { _strokes.Add(stroke); })); } else { Dispatcher.Invoke(DispatcherPriority.Background, new Action(() => { _strokes[_strokes.Count - 1].StylusPoints.Add(point); })); } }
private void Service_StrokeUpdated(object sender, StrokeUpdatedEventArgs e) { throw new NotImplementedException(); }