//<Snippet2> private void WriteDescriptionInfo(StylusPointCollection points) { StylusPointDescription pointsDescription = points.Description; ReadOnlyCollection <StylusPointPropertyInfo> properties = pointsDescription.GetStylusPointProperties(); StringWriter descriptionStringWriter = new StringWriter(); descriptionStringWriter.Write("Property Count:{0}", pointsDescription.PropertyCount.ToString()); foreach (StylusPointPropertyInfo property in properties) { // GetStylusPointPropertyName is defined below and returns the // name of the property. descriptionStringWriter.Write("name = {0}", GetStylusPointPropertyName(property).ToString()); descriptionStringWriter.WriteLine(" Guid = {0}", property.Id.ToString()); descriptionStringWriter.Write(" IsButton = {0}", property.IsButton.ToString()); descriptionStringWriter.Write(" Min = {0}", property.Minimum.ToString()); descriptionStringWriter.Write(" Max = {0}", property.Maximum.ToString()); descriptionStringWriter.Write(" Unit = {0}", property.Unit.ToString()); descriptionStringWriter.WriteLine(" Res {0}", property.Resolution.ToString()); } descriptionOutput.Text = descriptionStringWriter.ToString(); }
public override void Perform() { if (InkCanvas.Strokes.Count == 0) { for (int i = 0; i < StylusPointCollection.Count; i++) { if (StylusPointCollection[i].HasProperty(StylusPointPropertyInfo)) { if (!StylusPointPropertyInfo.IsButton) { StylusPoint stylusPoint = StylusPointCollection[i]; int value = stylusPoint.GetPropertyValue(StylusPointPropertyInfo); value++; stylusPoint.SetPropertyValue(StylusPointPropertyInfo, value); StylusPointCollection[i] = stylusPoint; } } } //add the stroke and manipulate the points Stroke addStroke = new Stroke(StylusPointCollection); InkCanvas.Strokes.Add(addStroke); } else //randomly grab a stroke and tweak the data. { Stroke stroke = InkCanvas.Strokes[StrokeIndex % InkCanvas.Strokes.Count]; StylusPointDescription StylusPointDescription = stroke.StylusPoints.Description; ReadOnlyCollection <StylusPointPropertyInfo> StylusPointPropertyInfo = StylusPointDescription.GetStylusPointProperties(); for (int i = 0; i < stroke.StylusPoints.Count; i++) { StylusPoint StylusPoint = stroke.StylusPoints[i]; for (int j = 0; j < StylusPointPropertyInfo.Count; j++) { if (stroke.StylusPoints[i].HasProperty(StylusPointPropertyInfo[j])) { if (!StylusPointPropertyInfo[j].IsButton) { if (StylusPointProperties.X.Id == StylusPointPropertyInfo[j].Id) { StylusPoint.X = StylusPoint.X * XFact; } else if (StylusPointProperties.Y.Id == StylusPointPropertyInfo[j].Id) { StylusPoint.Y = StylusPoint.Y * YFact; } else { int value = StylusPoint.GetPropertyValue(StylusPointPropertyInfo[j]); //pick a random number and set the value value = Math.Min(StylusPointPropertyInfo[j].Minimum + GetValue % StylusPointPropertyInfo[j].Maximum, StylusPointPropertyInfo[j].Maximum); StylusPoint.SetPropertyValue(StylusPointPropertyInfo[j], value); } } } } stroke.StylusPoints[i] = StylusPoint; int hash = StylusPoint.GetHashCode(); } } }
internal void UpdateSizeDeltas() { // Query default settings for mouse drag and double tap (with minimum of 1x1 size). Size mouseDragDefault = new Size(Math.Max(1, MS.Win32.SafeSystemMetrics.DragDeltaX / 2), Math.Max(1, MS.Win32.SafeSystemMetrics.DragDeltaY / 2)); Size mouseDoubleTapDefault = new Size(Math.Max(1, MS.Win32.SafeSystemMetrics.DoubleClickDeltaX / 2), Math.Max(1, MS.Win32.SafeSystemMetrics.DoubleClickDeltaY / 2)); StylusPointPropertyInfo xProperty = StylusPointDescription.GetPropertyInfo(StylusPointProperties.X); StylusPointPropertyInfo yProperty = StylusPointDescription.GetPropertyInfo(StylusPointProperties.Y); uint dwXValue = GetPropertyValue(xProperty); uint dwYValue = GetPropertyValue(yProperty); if (dwXValue != 0 && dwYValue != 0) { _doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * DoubleTapDelta) / dwXValue), (int)Math.Round((ScreenSize.Height * DoubleTapDelta) / dwYValue)); // Make sure we return whole numbers (pixels are whole numbers) and take the maximum // value between mouse and stylus settings to be safe. _doubleTapSize.Width = Math.Max(mouseDoubleTapDefault.Width, _doubleTapSize.Width); _doubleTapSize.Height = Math.Max(mouseDoubleTapDefault.Height, _doubleTapSize.Height); } else { // If no info to do the calculation then use the mouse settings for the default. _doubleTapSize = mouseDoubleTapDefault; } _forceUpdateSizeDeltas = false; }
internal override void Synchronize() { // Simulate a stylus move (if we are current stylus, inrange, visuals still valid to update // and has moved). if (InRange && _inputSource != null && _inputSource.Value != null && _inputSource.Value.CompositionTarget != null && !_inputSource.Value.CompositionTarget.IsDisposed) { Point rawScreenPoint = new Point(_pointerData.Info.ptPixelLocationRaw.X, _pointerData.Info.ptPixelLocationRaw.Y); Point ptDevice = PointUtil.ScreenToClient(rawScreenPoint, _inputSource.Value); // GlobalHitTest always returns an IInputElement, so we are sure to have one. IInputElement stylusOver = Input.StylusDevice.GlobalHitTest(_inputSource.Value, ptDevice); bool fOffsetChanged = false; if (_stylusOver == stylusOver) { Point ptOffset = GetPosition(stylusOver); fOffsetChanged = MS.Internal.DoubleUtil.AreClose(ptOffset.X, _rawElementRelativePosition.X) == false || MS.Internal.DoubleUtil.AreClose(ptOffset.Y, _rawElementRelativePosition.Y) == false; } if (fOffsetChanged || _stylusOver != stylusOver) { int timeStamp = Environment.TickCount; if (_currentStylusPoints != null && _currentStylusPoints.Count > 0 && StylusPointDescription.AreCompatible(PointerTabletDevice.StylusPointDescription, _currentStylusPoints.Description)) { StylusPoint stylusPoint = _currentStylusPoints[_currentStylusPoints.Count - 1]; int[] data = stylusPoint.GetPacketData(); // get back to the correct coordinate system Matrix m = _tabletDevice.TabletToScreen; m.Invert(); Point ptTablet = ptDevice * m; data[0] = (int)ptTablet.X; data[1] = (int)ptTablet.Y; RawStylusInputReport report = new RawStylusInputReport(InputMode.Foreground, timeStamp, _inputSource.Value, InAir ? RawStylusActions.InAirMove : RawStylusActions.Move, () => { return(PointerTabletDevice.StylusPointDescription); }, TabletDevice.Id, Id, data); report.Synchronized = true; InputReportEventArgs inputReportEventArgs = new InputReportEventArgs(StylusDevice, report); inputReportEventArgs.RoutedEvent = InputManager.PreviewInputReportEvent; InputManager.Current.ProcessInput(inputReportEventArgs); } } } }
public override void Perform() { Stroke stroke = InkCanvas.Strokes[StrokeIndex % InkCanvas.Strokes.Count]; StylusPointDescription commonSPD = StylusPointDescription.GetCommonDescription(stroke.StylusPoints.Description, StylusPointDescription); //reformat points and the strokes points so they match, then add them together. StylusPointCollection spcReformat = StylusPointCollection.Reformat(commonSPD); StylusPointCollection strokeReformat = stroke.StylusPoints.Reformat(commonSPD); stroke.StylusPoints = strokeReformat; stroke.StylusPoints.Add(spcReformat); }
void DescriptionSnippets() { //<Snippet17> StylusPointDescription description1 = new StylusPointDescription(new StylusPointPropertyInfo[] { new StylusPointPropertyInfo(StylusPointProperties.X), new StylusPointPropertyInfo(StylusPointProperties.Y), new StylusPointPropertyInfo(StylusPointProperties.NormalPressure), new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.BarrelButton) }); // Create a StylusPointCollection that uses description1 as its // StylusPointDescription. StylusPointCollection points = new StylusPointCollection(description1); StylusPointDescription description2 = new StylusPointDescription(new StylusPointPropertyInfo[] { new StylusPointPropertyInfo(StylusPointProperties.X), new StylusPointPropertyInfo(StylusPointProperties.Y), new StylusPointPropertyInfo(StylusPointProperties.NormalPressure), new StylusPointPropertyInfo(StylusPointProperties.ButtonPressure), new StylusPointPropertyInfo(StylusPointProperties.BarrelButton) }); // Find the common StylusPointDescription between description1 // and description2. Get a StylusPointCollection that uses the // common StylusPointDescription. StylusPointDescription common = StylusPointDescription.GetCommonDescription(description1, description2); StylusPointCollection points2 = points.Reformat(common); //</Snippet17> //Add two styluspoints with different descriptions. Throws an exception. //StylusPoint stylusPoint1 = new StylusPoint(100, 100, .5f, description1, new int[]{0, 0, 1}); //StylusPoint stylusPoint2 = new StylusPoint(200, 200, .35f, description2, new int[] {0, 1 }); //StylusPointCollection points3 = new StylusPointCollection( // new StylusPoint[] { stylusPoint1, stylusPoint2 }); //StylusPointCollection points4 = new StylusPointCollection(description1); //StylusPoint stylusPoint1 = new StylusPoint(100, 100, .5f); //points4.Add(stylusPoint1); //MessageBox.Show(points2.Count.ToString()); }
private void InitializeCapture(InputDevice inputDevice, IStylusEditing stylusEditingBehavior, bool userInitiated, bool resetDynamicRenderer) { this._capturedStylus = (inputDevice as StylusDevice); this._capturedMouse = (inputDevice as MouseDevice); if (this._capturedStylus != null) { StylusPointCollection stylusPoints = this._capturedStylus.GetStylusPoints(this._inkCanvas); this._commonDescription = StylusPointDescription.GetCommonDescription(this._inkCanvas.DefaultStylusPointDescription, stylusPoints.Description); StylusPointCollection stylusPoints2 = stylusPoints.Reformat(this._commonDescription); if (resetDynamicRenderer) { InkCollectionBehavior inkCollectionBehavior = stylusEditingBehavior as InkCollectionBehavior; if (inkCollectionBehavior != null) { inkCollectionBehavior.ResetDynamicRenderer(); } } stylusEditingBehavior.AddStylusPoints(stylusPoints2, userInitiated); this._inkCanvas.CaptureStylus(); if (this._inkCanvas.IsStylusCaptured && this.ActiveEditingMode != InkCanvasEditingMode.None) { this._inkCanvas.AddHandler(Stylus.StylusMoveEvent, new StylusEventHandler(this.OnInkCanvasDeviceMove <StylusEventArgs>)); this._inkCanvas.AddHandler(UIElement.LostStylusCaptureEvent, new StylusEventHandler(this.OnInkCanvasLostDeviceCapture <StylusEventArgs>)); return; } this._capturedStylus = null; return; } else { this._commonDescription = null; Point[] points = new Point[] { this._capturedMouse.GetPosition(this._inkCanvas) }; StylusPointCollection stylusPoints2 = new StylusPointCollection(points); stylusEditingBehavior.AddStylusPoints(stylusPoints2, userInitiated); this._inkCanvas.CaptureMouse(); if (this._inkCanvas.IsMouseCaptured && this.ActiveEditingMode != InkCanvasEditingMode.None) { this._inkCanvas.AddHandler(Mouse.MouseMoveEvent, new MouseEventHandler(this.OnInkCanvasDeviceMove <MouseEventArgs>)); this._inkCanvas.AddHandler(UIElement.LostMouseCaptureEvent, new MouseEventHandler(this.OnInkCanvasLostDeviceCapture <MouseEventArgs>)); return; } this._capturedMouse = null; return; } }
void CompareDescriptions() { //<Snippet22> StylusPointDescription description1 = new StylusPointDescription(new StylusPointPropertyInfo[] { new StylusPointPropertyInfo(StylusPointProperties.X), new StylusPointPropertyInfo(StylusPointProperties.Y), new StylusPointPropertyInfo(StylusPointProperties.NormalPressure), new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.BarrelButton) }); StylusPointDescription description2 = new StylusPointDescription(new StylusPointPropertyInfo[] { new StylusPointPropertyInfo(StylusPointProperties.X), new StylusPointPropertyInfo(StylusPointProperties.Y), new StylusPointPropertyInfo(StylusPointProperties.NormalPressure), new StylusPointPropertyInfo(StylusPointProperties.BarrelButton) }); //</Snippet22> //<Snippet23> if (StylusPointDescription.AreCompatible(description1, description2)) { MessageBox.Show("The two descriptions are compatible."); } else { MessageBox.Show("The two descriptions are not compatible."); } //</Snippet23> //<Snippet24> if (description2.IsSubsetOf(description1)) { MessageBox.Show("description2 is a subset of description1."); } else { MessageBox.Show("description2 is not a subset of description1."); } //</Snippet24> }
// <Snippet21> void inkCanvas1_StylusMove(object sender, StylusEventArgs e) { StylusPointCollection points = e.GetStylusPoints(inkCanvas1); StylusPointDescription description = points.Description; StringWriter normalPressureInfo = new StringWriter(); if (description.HasProperty(StylusPointProperties.NormalPressure)) { StylusPointPropertyInfo propertyInfo = description.GetPropertyInfo(StylusPointProperties.NormalPressure); normalPressureInfo.WriteLine(" Guid = {0}", propertyInfo.Id.ToString()); normalPressureInfo.Write(" Min = {0}", propertyInfo.Minimum.ToString()); normalPressureInfo.Write(" Max = {0}", propertyInfo.Maximum.ToString()); normalPressureInfo.Write(" Unit = {0}", propertyInfo.Unit.ToString()); normalPressureInfo.WriteLine(" Res = {0}", propertyInfo.Resolution.ToString()); } }
/// <summary> /// Replaces the StylusPoints. /// </summary> /// <remarks> /// Callers must have Unmanaged code permission to call this API. /// </remarks> /// <param name="stylusPoints">stylusPoints</param> public void SetStylusPoints(StylusPointCollection stylusPoints) { if (null == stylusPoints) { throw new ArgumentNullException("stylusPoints"); } if (!StylusPointDescription.AreCompatible(stylusPoints.Description, _report.StylusPointDescription)) { throw new ArgumentException(SR.Get(SRID.IncompatibleStylusPointDescriptions), "stylusPoints"); } if (stylusPoints.Count == 0) { throw new ArgumentException(SR.Get(SRID.Stylus_StylusPointsCantBeEmpty), "stylusPoints"); } _stylusPoints = stylusPoints.Clone(); }
//</Snippet4> void StylusPointConstructor() { //<snippet5> StylusPointDescription newDescription = new StylusPointDescription(new StylusPointPropertyInfo[] { new StylusPointPropertyInfo(StylusPointProperties.X), new StylusPointPropertyInfo(StylusPointProperties.Y), new StylusPointPropertyInfo(StylusPointProperties.NormalPressure), new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.BarrelButton) }); int[] propertyValues = { 1800, 1000, 1 }; StylusPoint newStylusPoint = new StylusPoint(100, 100, .5f, newDescription, propertyValues); //</snippet5> //<Snippet16> StylusPointPropertyInfo XTiltPropertyInfo = new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation, 0, 3600, StylusPointPropertyUnit.Degrees, 10f); //</Snippet16> StylusPoint point = new StylusPoint(); //<Snippet11> if (point.HasProperty(StylusPointProperties.PitchRotation)) { int pitchRotation = point.GetPropertyValue(StylusPointProperties.PitchRotation); } //</Snippet11> //<Snippet12> if (point.HasProperty(StylusPointProperties.PitchRotation)) { point.SetPropertyValue(StylusPointProperties.PitchRotation, 1000); } //</Snippet12> }
static public void WriteDescriptionInfo(StylusPointCollection points) { StylusPointDescription pointsDescription = points.Description; ReadOnlyCollection <StylusPointPropertyInfo> properties = pointsDescription.GetStylusPointProperties(); Debug.WriteLine("Property Count:" + pointsDescription.PropertyCount.ToString()); foreach (StylusPointPropertyInfo property in properties) { // GetStylusPointPropertyName is defined below and returns the // name of the property. Debug.WriteLine(" name = " + GetStylusPointPropertyName(property)); //Debug.WriteLine += " Guid = " + property.Id + "\r\n"; //Debug.WriteLine += " IsButton = " + property.IsButton; //Debug.WriteLine += " Min = " + property.Minimum; //Debug.WriteLine += " Max = " + property.Maximum; //Debug.WriteLine += " Unit = " + property.Unit; //Debug.WriteLine += " Res = " + property.Resolution + "\r\n"; } }
public void SetStylusPoints(StylusPointCollection stylusPoints) { // To modify the points we require Unmanaged code permission. SecurityHelper.DemandUnmanagedCode(); if (null == stylusPoints) { throw new ArgumentNullException("stylusPoints"); } if (!StylusPointDescription.AreCompatible(stylusPoints.Description, _report.StylusPointDescription)) { throw new ArgumentException(SR.Get(SRID.IncompatibleStylusPointDescriptions), "stylusPoints"); } if (stylusPoints.Count == 0) { throw new ArgumentException(SR.Get(SRID.Stylus_StylusPointsCantBeEmpty), "stylusPoints"); } _stylusPoints = stylusPoints.Clone(); }
/// <summary> /// Loads a stroke from the stream based on Stroke Descriptor, StylusPointDescription, Drawing Attributes, Stroke IDs, transform and GuidList /// </summary> /// <param name="stream"></param> /// <param name="size"></param> /// <param name="guidList"></param> /// <param name="strokeDescriptor"></param> /// <param name="stylusPointDescription"></param> /// <param name="drawingAttributes"></param> /// <param name="transform"></param> /// <param name="compressor">Compression module</param> /// <param name="stroke">Newly decoded stroke</param> /// <returns></returns> #else /// <summary> /// Loads a stroke from the stream based on Stroke Descriptor, StylusPointDescription, Drawing Attributes, Stroke IDs, transform and GuidList /// </summary> /// <param name="stream"></param> /// <param name="size"></param> /// <param name="guidList"></param> /// <param name="strokeDescriptor"></param> /// <param name="stylusPointDescription"></param> /// <param name="drawingAttributes"></param> /// <param name="transform"></param> /// <param name="stroke">Newly decoded stroke</param> #endif internal static uint DecodeStroke(Stream stream, uint size, GuidList guidList, StrokeDescriptor strokeDescriptor, StylusPointDescription stylusPointDescription, DrawingAttributes drawingAttributes, Matrix transform, #if OLD_ISF Compressor compressor, #endif out Stroke stroke) { ExtendedPropertyCollection extendedProperties; StylusPointCollection stylusPoints; uint cb = DecodeISFIntoStroke( #if OLD_ISF compressor, #endif stream, size, guidList, strokeDescriptor, stylusPointDescription, transform, out stylusPoints, out extendedProperties); if (cb != size) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Stroke size (" + cb.ToString(System.Globalization.CultureInfo.InvariantCulture) + ") != expected (" + size.ToString(System.Globalization.CultureInfo.InvariantCulture) + ")")); } stroke = new Stroke(stylusPoints, drawingAttributes, extendedProperties); return(cb); }
protected void GetStylusParams(StylusPointDescription sd) { if (sd.HasProperty(StylusPointProperties.XTiltOrientation) && sd.HasProperty(StylusPointProperties.YTiltOrientation)) { StylusPointPropertyInfo tiltXInfo = sd.GetPropertyInfo(StylusPointProperties.XTiltOrientation); StylusPointPropertyInfo tiltYInfo = sd.GetPropertyInfo(StylusPointProperties.YTiltOrientation); mInputMinTiltX = tiltXInfo.Minimum; mInputMaxTiltX = tiltXInfo.Maximum; mInputMinTiltY = tiltYInfo.Minimum; mInputMaxTiltY = tiltYInfo.Maximum; mScaleTiltX = (mTargetMaxTiltX - mTargetMinTiltX) / (mInputMaxTiltX - mInputMinTiltX); mScaleTiltY = (mTargetMaxTiltY - mTargetMinTiltY) / (mInputMaxTiltY - mInputMinTiltY); } else { mScaleTiltX = 0; mScaleTiltY = 0; } }
void GetDescriptionFromStylusDevice() { //<Snippet26> StylusDevice currentStylus = Stylus.CurrentStylusDevice; StylusPointDescription description1 = new StylusPointDescription(new StylusPointPropertyInfo[] { new StylusPointPropertyInfo(StylusPointProperties.X), new StylusPointPropertyInfo(StylusPointProperties.Y), new StylusPointPropertyInfo(StylusPointProperties.NormalPressure), new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation), new StylusPointPropertyInfo(StylusPointProperties.BarrelButton) }); StylusPointDescription description2 = currentStylus.GetStylusPoints(inkCanvas1).Description; StylusPointDescription description3 = StylusPointDescription.GetCommonDescription(description1, description2); StylusPointCollection points = currentStylus.GetStylusPoints(inkCanvas1, description3); //</Snippet26> }
//</Snippet2> //<Snippet3> private void WriteStylusPointValues(StylusPointCollection points) { StylusPointDescription pointsDescription = points.Description; ReadOnlyCollection <StylusPointPropertyInfo> properties = pointsDescription.GetStylusPointProperties(); // Write the name and and value of each property in // every stylus point. StringWriter packetWriter = new StringWriter(); packetWriter.WriteLine("{0} stylus points", points.Count.ToString()); foreach (StylusPoint stylusPoint in points) { packetWriter.WriteLine("Stylus Point info"); packetWriter.WriteLine("X: {0}", stylusPoint.X.ToString()); packetWriter.WriteLine("Y: {0}", stylusPoint.Y.ToString()); packetWriter.WriteLine("Pressure: {0}", stylusPoint.PressureFactor.ToString()); // Get the property name and value for each StylusPoint. // Note that this loop reports the X, Y, and pressure values differantly than // getting their values above. for (int i = 0; i < pointsDescription.PropertyCount; ++i) { StylusPointProperty currentProperty = properties[i]; // GetStylusPointPropertyName is defined below and returns the // name of the property. packetWriter.Write("{0}: ", GetStylusPointPropertyName(currentProperty)); packetWriter.WriteLine(stylusPoint.GetPropertyValue(currentProperty).ToString()); } packetWriter.WriteLine(); } packetOutput.Text = packetWriter.ToString(); }
/// <summary> /// Retrieve the packet description, packets data and XFORM which is the information the native recognizer needs. /// The method is called from AddStrokes. /// </summary> private void GetPacketData ( Stroke stroke, out MS.Win32.Recognizer.PACKET_DESCRIPTION packetDescription, out int countOfBytes, out IntPtr packets, out NativeMethods.XFORM xForm ) { int i; countOfBytes = 0; packets = IntPtr.Zero; packetDescription = new MS.Win32.Recognizer.PACKET_DESCRIPTION(); Matrix matrix = Matrix.Identity; xForm = new NativeMethods.XFORM((float)(matrix.M11), (float)(matrix.M12), (float)(matrix.M21), (float)(matrix.M22), (float)(matrix.OffsetX), (float)(matrix.OffsetY)); StylusPointCollection stylusPoints = stroke.StylusPoints; if (stylusPoints.Count == 0) { return; //we'll fail when the calling routine sees that packets is IntPtr.Zer } if (stylusPoints.Description.PropertyCount > StylusPointDescription.RequiredCountOfProperties) { // // reformat to X, Y, P // StylusPointDescription reformatDescription = new StylusPointDescription( new StylusPointPropertyInfo[] { new StylusPointPropertyInfo(StylusPointProperties.X), new StylusPointPropertyInfo(StylusPointProperties.Y), stylusPoints.Description.GetPropertyInfo(StylusPointProperties.NormalPressure) }); stylusPoints = stylusPoints.Reformat(reformatDescription); } // // now make sure we only take a finite amount of data for the stroke // if (stylusPoints.Count > MaxStylusPoints) { stylusPoints = stylusPoints.Clone(MaxStylusPoints); } Guid[] propertyGuids = new Guid[] { StylusPointPropertyIds.X, //required index for SPD StylusPointPropertyIds.Y, //required index for SPD StylusPointPropertyIds.NormalPressure }; //required index for SPD Debug.Assert(stylusPoints != null); Debug.Assert(propertyGuids.Length == StylusPointDescription.RequiredCountOfProperties); // Get the packet description packetDescription.cbPacketSize = (uint)(propertyGuids.Length * Marshal.SizeOf(typeof(Int32))); packetDescription.cPacketProperties = (uint)propertyGuids.Length; // // use X, Y defaults for metrics, sometimes mouse metrics can be bogus // always use NormalPressure metrics, though. // StylusPointPropertyInfo[] infosToUse = new StylusPointPropertyInfo[StylusPointDescription.RequiredCountOfProperties]; infosToUse[StylusPointDescription.RequiredXIndex] = StylusPointPropertyInfoDefaults.X; infosToUse[StylusPointDescription.RequiredYIndex] = StylusPointPropertyInfoDefaults.Y; infosToUse[StylusPointDescription.RequiredPressureIndex] = stylusPoints.Description.GetPropertyInfo(StylusPointProperties.NormalPressure); MS.Win32.Recognizer.PACKET_PROPERTY[] packetProperties = new MS.Win32.Recognizer.PACKET_PROPERTY[packetDescription.cPacketProperties]; StylusPointPropertyInfo propertyInfo; for (i = 0; i < packetDescription.cPacketProperties; i++) { packetProperties[i].guid = propertyGuids[i]; propertyInfo = infosToUse[i]; MS.Win32.Recognizer.PROPERTY_METRICS propertyMetrics = new MS.Win32.Recognizer.PROPERTY_METRICS( ); propertyMetrics.nLogicalMin = propertyInfo.Minimum; propertyMetrics.nLogicalMax = propertyInfo.Maximum; propertyMetrics.Units = (int)(propertyInfo.Unit); propertyMetrics.fResolution = propertyInfo.Resolution; packetProperties[i].PropertyMetrics = propertyMetrics; } unsafe { int allocationSize = (int)(Marshal.SizeOf(typeof(MS.Win32.Recognizer.PACKET_PROPERTY)) * packetDescription.cPacketProperties); packetDescription.pPacketProperties = Marshal.AllocCoTaskMem(allocationSize); MS.Win32.Recognizer.PACKET_PROPERTY *pPacketProperty = (MS.Win32.Recognizer.PACKET_PROPERTY *)(packetDescription.pPacketProperties.ToPointer()); MS.Win32.Recognizer.PACKET_PROPERTY *pElement = pPacketProperty; for (i = 0; i < packetDescription.cPacketProperties; i++) { Marshal.StructureToPtr(packetProperties[i], new IntPtr(pElement), false); pElement++; } } // Get packet data int[] rawPackets = stylusPoints.ToHiMetricArray(); int packetCount = rawPackets.Length; if (packetCount != 0) { countOfBytes = packetCount * Marshal.SizeOf(typeof(Int32)); packets = Marshal.AllocCoTaskMem(countOfBytes); Marshal.Copy(rawPackets, 0, packets, packetCount); } }
public override void SetupForStylus(StylusPointDescription sd, Graphics graphics) { base.SetupForStylus(sd, graphics); SetBrushStyle(mBrushStyle, graphics); UpdatePipeline(ActiveTool.GetLayoutStylus(), ActiveTool.GetCalculatorStylus(), ActiveTool.ParticleSpacing); }
public override void SetupForStylus(StylusPointDescription sd, Graphics graphics) { base.SetupForStylus(sd, graphics); UpdatePipeline(ActiveTool.GetLayoutStylus(), ActiveTool.GetCalculatorStylus(), ActiveTool.Shape); }
// // Summary: // Returns a System.Windows.Input.StylusPointCollection that uses the specified // System.Windows.Input.StylusPointDescription and contains System.Windows.Input.StylusPoint // objects relating to the specified input element. // // Parameters: // relativeTo: // The System.Windows.IInputElement to which the (x,y) coordinates in the System.Windows.Input.StylusPointCollection // are mapped. // // subsetToReformatTo: // The System.Windows.Input.StylusPointDescription to be used by the System.Windows.Input.StylusPointCollection. // // Returns: // A System.Windows.Input.StylusPointCollection that contains System.Windows.Input.StylusPoint // objects collected during an event. // // Exceptions: // System.InvalidOperationException: // relativeTo is neither System.Windows.UIElement or System.Windows.FrameworkContentElement. public StylusPointCollection GetStylusPoints(IInputElement relativeTo, StylusPointDescription subsetToReformatTo) { throw new NotImplementedException(); }
/// <summary> /// Returns a StylusPointCollection object for processing the data in the packet. /// This method creates a new StylusPointCollection and copies the data. /// </summary> internal override StylusPointCollection GetStylusPoints(IInputElement relativeTo, StylusPointDescription subsetToReformatTo) { if (null == subsetToReformatTo) { throw new ArgumentNullException("subsetToReformatTo"); } // Fake up an empty one if we have to. if (_currentStylusPoints == null) { return(new StylusPointCollection(subsetToReformatTo)); } return(_currentStylusPoints.Reformat(subsetToReformatTo, StylusDevice.GetElementTransform(relativeTo))); }
/// <summary> /// This functions loads a stroke from a memory stream based on the descriptor and GuidList. It returns /// the no of bytes it has read from the stream to correctly load the stream, which should be same as /// the value of the size parameter. If they are unequal throws ArgumentException. Stroke descriptor is /// used to load the packetproperty as well as ExtendedPropertyCollection on this stroke. Compressor is used /// to decompress the data. /// </summary> /// <param name="compressor"></param> /// <param name="stream"></param> /// <param name="totalBytesInStrokeBlockOfIsfStream"></param> /// <param name="guidList"></param> /// <param name="strokeDescriptor"></param> /// <param name="stylusPointDescription"></param> /// <param name="transform"></param> /// <param name="stylusPoints"></param> /// <param name="extendedProperties"></param> /// <returns></returns> #else /// <summary> /// This functions loads a stroke from a memory stream based on the descriptor and GuidList. It returns /// the no of bytes it has read from the stream to correctly load the stream, which should be same as /// the value of the size parameter. If they are unequal throws ArgumentException. Stroke descriptor is /// used to load the packetproperty as well as ExtendedPropertyCollection on this stroke. Compressor is used /// to decompress the data. /// </summary> /// <param name="stream"></param> /// <param name="totalBytesInStrokeBlockOfIsfStream"></param> /// <param name="guidList"></param> /// <param name="strokeDescriptor"></param> /// <param name="stylusPointDescription"></param> /// <param name="transform"></param> /// <param name="stylusPoints"></param> /// <param name="extendedProperties"></param> #endif static uint DecodeISFIntoStroke( #if OLD_ISF Compressor compressor, #endif Stream stream, uint totalBytesInStrokeBlockOfIsfStream, GuidList guidList, StrokeDescriptor strokeDescriptor, StylusPointDescription stylusPointDescription, Matrix transform, out StylusPointCollection stylusPoints, out ExtendedPropertyCollection extendedProperties) { stylusPoints = null; extendedProperties = null; // We do allow a stroke with no packet data if (0 == totalBytesInStrokeBlockOfIsfStream) { return(0); } uint locallyDecodedBytes; uint remainingBytesInStrokeBlock = totalBytesInStrokeBlockOfIsfStream; // First try to load any packet data locallyDecodedBytes = LoadPackets(stream, remainingBytesInStrokeBlock, #if OLD_ISF compressor, #endif stylusPointDescription, transform, out stylusPoints); if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Packet buffer overflowed the ISF stream")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; if (0 == remainingBytesInStrokeBlock) { return(locallyDecodedBytes); } // Now read the extended propertes for (int iTag = 1; iTag < strokeDescriptor.Template.Count && remainingBytesInStrokeBlock > 0; iTag++) { KnownTagCache.KnownTagIndex tag = strokeDescriptor.Template[iTag - 1]; switch (tag) { case MS.Internal.Ink.InkSerializedFormat.KnownTagCache.KnownTagIndex.StrokePropertyList: { // we've found the stroke extended properties. Load them now. while (iTag < strokeDescriptor.Template.Count && remainingBytesInStrokeBlock > 0) { tag = strokeDescriptor.Template[iTag]; object data; Guid guid = guidList.FindGuid(tag); if (guid == Guid.Empty) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Stroke Custom Attribute tag embedded in ISF stream does not match guid table")); } // load the extended property data from the stream (and decode the type) locallyDecodedBytes = ExtendedPropertySerializer.DecodeAsISF(stream, remainingBytesInStrokeBlock, guidList, tag, ref guid, out data); // add the guid/data pair into the property collection (don't redecode the type) if (extendedProperties == null) { extendedProperties = new ExtendedPropertyCollection(); } extendedProperties[guid] = data; if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; iTag++; } } break; case MS.Internal.Ink.InkSerializedFormat.KnownTagCache.KnownTagIndex.Buttons: { // Next tag is count of buttons and the tags for the button guids iTag += (int)((uint)strokeDescriptor.Template[iTag]) + 1; } break; // ignore any tags embedded in the Stroke block that this // version of the ISF decoder doesn't understand default: { System.Diagnostics.Trace.WriteLine("Ignoring unhandled stroke tag in ISF stroke descriptor"); } break; } } // Now try to load any tagged property data or point property data while (remainingBytesInStrokeBlock > 0) { // Read the tag first KnownTagCache.KnownTagIndex tag; uint uiTag; locallyDecodedBytes = SerializationHelper.Decode(stream, out uiTag); tag = (KnownTagCache.KnownTagIndex)uiTag; if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; // if it is a point property block switch (tag) { case MS.Internal.Ink.InkSerializedFormat.KnownTagCache.KnownTagIndex.PointProperty: { // First load the totalBytesInStrokeBlockOfIsfStream of the point property block uint cbsize; locallyDecodedBytes = SerializationHelper.Decode(stream, out cbsize); if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; while (remainingBytesInStrokeBlock > 0) { // First read the tag corresponding to the property locallyDecodedBytes = SerializationHelper.Decode(stream, out uiTag); tag = (KnownTagCache.KnownTagIndex)uiTag; if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; // Now read the packet index for which the property will apply uint propindex; locallyDecodedBytes = SerializationHelper.Decode(stream, out propindex); if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; uint propsize; locallyDecodedBytes = SerializationHelper.Decode(stream, out propsize); if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; // Compressed data totalBytesInStrokeBlockOfIsfStream propsize += 1; // Make sure we have enough data to read if (propsize > remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } byte[] in_buffer = new byte[propsize]; uint bytesRead = StrokeCollectionSerializer.ReliableRead(stream, in_buffer, propsize); if (propsize != bytesRead) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Read different size from stream then expected")); } byte[] out_buffer = Compressor.DecompressPropertyData(in_buffer); System.Diagnostics.Debug.Assert(false, "ExtendedProperties for points are not supported"); // skip the bytes in both success & failure cases // Note: Point ExtendedProperties are discarded remainingBytesInStrokeBlock -= propsize; } } break; default: { object data; Guid guid = guidList.FindGuid(tag); if (guid == Guid.Empty) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Stroke Custom Attribute tag embedded in ISF stream does not match guid table")); } // load the extended property data from the stream (and decode the type) locallyDecodedBytes = ExtendedPropertySerializer.DecodeAsISF(stream, remainingBytesInStrokeBlock, guidList, tag, ref guid, out data); // add the guid/data pair into the property collection (don't redecode the type) if (extendedProperties == null) { extendedProperties = new ExtendedPropertyCollection(); } extendedProperties[guid] = data; if (locallyDecodedBytes > remainingBytesInStrokeBlock) { throw new InvalidOperationException(StrokeCollectionSerializer.ISFDebugMessage("ExtendedProperty decoded totalBytesInStrokeBlockOfIsfStream exceeded ISF stream totalBytesInStrokeBlockOfIsfStream")); } remainingBytesInStrokeBlock -= locallyDecodedBytes; } break; } } if (0 != remainingBytesInStrokeBlock) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } return(totalBytesInStrokeBlockOfIsfStream); }
public virtual void SetupForStylus(StylusPointDescription sd, Graphics graphics) { GetStylusParams(sd); }
void inkCanvas1_StylusDown(object sender, StylusDownEventArgs e) { StylusPointDescription desc = e.GetStylusPoints(inkCanvas1, inkCanvas1.DefaultStylusPointDescription).Description; }
public MyStylusPointCollection(StylusPointDescription stylusPointDescription) : base(stylusPointDescription) { }
/// <summary> /// Loads packets from the input stream. For example, packets are all of the x's in a stroke /// </summary> #else /// <summary> /// Loads packets from the input stream. For example, packets are all of the x's in a stroke /// </summary> #endif static uint LoadPackets(Stream inputStream, uint totalBytesInStrokeBlockOfIsfStream, #if OLD_ISF Compressor compressor, #endif StylusPointDescription stylusPointDescription, Matrix transform, out StylusPointCollection stylusPoints) { stylusPoints = null; if (0 == totalBytesInStrokeBlockOfIsfStream) { return(0); } uint locallyDecodedBytesRemaining = totalBytesInStrokeBlockOfIsfStream; uint localBytesRead; // First read the no of packets uint pointCount; localBytesRead = SerializationHelper.Decode(inputStream, out pointCount); if (locallyDecodedBytesRemaining < localBytesRead) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } locallyDecodedBytesRemaining -= localBytesRead; if (0 == locallyDecodedBytesRemaining) { return(localBytesRead); } // Allocate packet properties int intsPerPoint = 0; //修复构建的代码 stylusPointDescription.GetInputArrayLengthPerPoint(); int buttonCount = 0; //修复构建的代码 stylusPointDescription.ButtonCount; int buttonIntsPerPoint = (buttonCount > 0 ? 1 : 0); int valueIntsPerPoint = intsPerPoint - buttonIntsPerPoint; //add one int per point for button data if it exists int[] rawPointData = new int[pointCount * intsPerPoint]; int[] packetDataSet = new int[pointCount]; // copy the rest of the data from the stroke data byte[] inputBuffer = new byte[locallyDecodedBytesRemaining]; // Read the input data into the byte array uint bytesRead = StrokeCollectionSerializer.ReliableRead(inputStream, inputBuffer, locallyDecodedBytesRemaining); if (bytesRead != locallyDecodedBytesRemaining) { // Make sure the bytes read are expected. If not, we should bail out. // An exception will be thrown. throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } // at this point, we have read all of the bytes remaining in the input // stream's packet block, and while we will keep the bytes remaining // variable for positioning within the local byte buffer, we should // not read from the stream again, or we risk reading into another // ISF tag's block. int originalPressureIndex = 0; //修复构建的代码 stylusPointDescription.OriginalPressureIndex; for (int i = 0; i < valueIntsPerPoint && locallyDecodedBytesRemaining > 0; i++) { localBytesRead = locallyDecodedBytesRemaining; Compressor.DecompressPacketData( #if OLD_ISF compressor, #endif inputBuffer, ref localBytesRead, packetDataSet); if (localBytesRead > locallyDecodedBytesRemaining) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid ISF data")); } // // packetDataSet is like this: // ------------- // |X|X|X|X|X|X| // ------------- // // we need to copy into rawPointData at // // ------------- // |X| |X| |X| | // ------------- // // additionally, for NormalPressure, if it exists and was // reordered in the StylusPointDescription, we need to account for that here // int tempi = i; if (tempi > 1 && originalPressureIndex != -1 && originalPressureIndex != /* //修复构建的代码StylusPointDescription.RequiredPressureIndex*/ 2) { // // NormalPressure exists in the packet stream and was not at index 2 // StylusPointDescription enforces that NormalPressure is at index 2 // so we need to copy packet data beyond X and Y into a different location // // take the example of the original StylusPointDescription // |X|Y|XTilt|YTilt|NormalPressure|Rotation| // // originalPressureIndex is 4, and we know it is now 2 // which means that everything before index 4 has been shifted one // and everything after index 4 is still good. Index 4 should be copied to index 2 if (tempi == originalPressureIndex) { tempi = 2; } else if (tempi < originalPressureIndex) { tempi++; } } locallyDecodedBytesRemaining -= localBytesRead; for (int j = 0, x = 0; j < pointCount; j++, x += intsPerPoint) { rawPointData[x + tempi] = packetDataSet[j]; } // Move the array elements to point to next set of compressed data for (uint u = 0; u < locallyDecodedBytesRemaining; u++) { inputBuffer[u] = inputBuffer[u + (int)localBytesRead]; } } // Now that we've read packet data, we must read button data if it is there byte[] buttonData = null; // since the button state is a simple bit value (either down or up), the button state // for a series of packets is packed into an array of bits rather than integers // For example, if there are 16 packets, and 2 buttons, then 32 bits can be used (e.g. 1 32-bit integer) if (0 != locallyDecodedBytesRemaining && buttonCount > 0) { // calculate the number of full bytes used for buttons per packet // Example: 10 buttons would require 1 full byte int fullBytesForButtonsPerPacket = buttonCount / Native.BitsPerByte; // calculate the number of bits that spill beyond the full byte boundary // Example: 10 buttons would require 2 extra bits (8 fit in a full byte) int partialBitsForButtonsPerPacket = buttonCount % Native.BitsPerByte; // Now figure out how many bytes we need to read for the button data localBytesRead = (uint)((buttonCount * pointCount + 7) / Native.BitsPerByte); if (localBytesRead > locallyDecodedBytesRemaining) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Buffer range is smaller than expected expected size")); } locallyDecodedBytesRemaining -= localBytesRead; int buttonSizeInBytes = (buttonCount + 7) / Native.BitsPerByte; buttonData = new byte[pointCount * buttonSizeInBytes]; // Create a bit reader to unpack the bits from the ISF stream into // loosely packed byte buffer (e.g. button data aligned on full byte // boundaries only) BitStreamReader bitReader = new BitStreamReader(inputBuffer, (uint)buttonCount * pointCount); // unpack the button data into each packet int byteCounter = 0; while (!bitReader.EndOfStream) { // unpack the fully bytes first for (int fullBytes = 0; fullBytes < fullBytesForButtonsPerPacket; fullBytes++) { buttonData[byteCounter++] = bitReader.ReadByte(Native.BitsPerByte); } // then unpack a single partial byte if necessary if (partialBitsForButtonsPerPacket > 0) { buttonData[byteCounter++] = bitReader.ReadByte((int)partialBitsForButtonsPerPacket); } } // if the number of bytes allocated != necessary byte amount then an error occurred if (byteCounter != buttonData.Length) { throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Button data length not equal to expected length")); } // // set the point data in the raw array // FillButtonData((int)pointCount, buttonCount, valueIntsPerPoint, //gives the first button index rawPointData, buttonData); } stylusPoints = new StylusPointCollection(stylusPointDescription /*//修复构建的代码, rawPointData, null, transform*/); // if we read too far into the stream (e.g. the packets were compressed) // then move the stream pointer back to the end of the actual packet // data before returning. This keeps the return value on the function // (representing bytes read) honest and consistent with the stream // position movement in this function. if (0 != locallyDecodedBytesRemaining) { inputStream.Seek(0 - (long)locallyDecodedBytesRemaining, SeekOrigin.Current); } return(totalBytesInStrokeBlockOfIsfStream - locallyDecodedBytesRemaining); }
public MyStylusPointCollection(StylusPointDescription stylusPointDescription, int initialCapacity) : base(stylusPointDescription, initialCapacity) { }
/// <summary> /// Builds the Stroke Descriptor for this stroke based on Packet Layout and Extended Properties /// For details on how this is strored please refer to the spec. /// </summary> internal static void BuildStrokeDescriptor( Stroke stroke, GuidList guidList, StrokeCollectionSerializer.StrokeLookupEntry strokeLookupEntry, out StrokeDescriptor strokeDescriptor, out MetricBlock metricBlock) { // Initialize the metric block for this stroke metricBlock = new MetricBlock(); // Clear any existing template strokeDescriptor = new StrokeDescriptor(); // Uninitialized variable passed in AddMetricEntry MetricEntryType metricEntryType; StylusPointDescription stylusPointDescription = stroke.StylusPoints.Description; KnownTagCache.KnownTagIndex tag = guidList.FindTag(KnownIds.X, true); metricEntryType = metricBlock.AddMetricEntry(stylusPointDescription.GetPropertyInfo(StylusPointProperties.X), tag); tag = guidList.FindTag(KnownIds.Y, true); metricEntryType = metricBlock.AddMetricEntry(stylusPointDescription.GetPropertyInfo(StylusPointProperties.Y), tag); ReadOnlyCollection <StylusPointPropertyInfo> propertyInfos = stylusPointDescription.GetStylusPointProperties(); int i = 0; //i is defined out of the for loop so we can use it later for buttons for (i = 2 /*past x,y*/; i < propertyInfos.Count; i++) { if (i == /*StylusPointDescription.RequiredPressureIndex //修复构建的代码 */ 2 && !strokeLookupEntry.StorePressure) { // // don't store pressure information // continue; } StylusPointPropertyInfo propertyInfo = propertyInfos[i]; if (propertyInfo.IsButton) { //we don't serialize buttons break; } tag = guidList.FindTag(propertyInfo.Id, true); strokeDescriptor.Template.Add(tag); strokeDescriptor.Size += SerializationHelper.VarSize((uint)tag); // Create the MetricEntry for this property if necessary metricEntryType = metricBlock.AddMetricEntry(propertyInfo, tag); } /* * we drop button data on the floor. * int buttonCount = stylusPointDescription.ButtonCount; * // Now write the button tags in the Template * if (buttonCount > 0) * { * // First write the TAG_BUTTONS * strokeDescriptor.Template.Add(KnownTagCache.KnownTagIndex.Buttons); * strokeDescriptor.Size += SerializationHelper.VarSize((uint)KnownTagCache.KnownTagIndex.Buttons); * * // Next write the i of buttons * strokeDescriptor.Template.Add((KnownTagCache.KnownTagIndex)buttonCount); * strokeDescriptor.Size += SerializationHelper.VarSize((uint)buttonCount); * * //we broke above on i when it was a button, it still * //points to the first button * for (; i < propertyInfos.Count; i++) * { * StylusPointPropertyInfo propertyInfo = propertyInfos[i]; * tag = guidList.FindTag(propertyInfo.Id, false); * * strokeDescriptor.Template.Add(tag); * strokeDescriptor.Size += SerializationHelper.VarSize((uint)tag); * } * } */ // Now write the extended properties in the template if (stroke.ExtendedProperties.Count > 0) { strokeDescriptor.Template.Add(KnownTagCache.KnownTagIndex.StrokePropertyList); strokeDescriptor.Size += SerializationHelper.VarSize((uint)KnownTagCache.KnownTagIndex.StrokePropertyList); // Now write the tags corresponding to each extended properties of the stroke for (int x = 0; x < stroke.ExtendedProperties.Count; x++) { tag = guidList.FindTag(stroke.ExtendedProperties[(int)x].Id, false); strokeDescriptor.Template.Add(tag); strokeDescriptor.Size += SerializationHelper.VarSize((uint)tag); } } }
public static Guid[] GetStylusPointPropertyIds(this StylusPointDescription s) { return(new Guid[0]); }