Example #1
0
        public static WindowsInk.Stroke ToWindowsStroke(NineInk.Stroke nineStroke)
        {
            var points = new StylusPointCollection();

            foreach (var point in nineStroke.Points)
                points.Add(new StylusPoint(point.X, point.Y, point.Pressure));

            var drwAttr = new WindowsInk.DrawingAttributes();
            var c = new Color();
            c.R = nineStroke.DrawingAttributes.Color.R;
            c.G = nineStroke.DrawingAttributes.Color.G;
            c.B = nineStroke.DrawingAttributes.Color.B;
            c.A = nineStroke.DrawingAttributes.Color.A;
            drwAttr.Color = c;

            switch (nineStroke.DrawingAttributes.Brush.Name)
            {
                case "Rectangle":
                    drwAttr.StylusTip = WindowsInk.StylusTip.Rectangle;
                    break;
                case "Ellipse":
                default:
                    drwAttr.StylusTip = WindowsInk.StylusTip.Ellipse;
                    break;
            }
            drwAttr.Height = nineStroke.DrawingAttributes.Height;
            drwAttr.Width = nineStroke.DrawingAttributes.Width;
            drwAttr.IsHighlighter = nineStroke.DrawingAttributes.IsHighlighter;

            return new WindowsInk.Stroke(points, drwAttr);
        }
Example #2
0
File: Stroke.cs Project: dfr0/moon
		public bool HitTest (StylusPointCollection stylusPointCollection)
		{
			if (stylusPointCollection == null)
				throw new ArgumentException ("stylusPointCollection");

			return NativeMethods.stroke_hit_test (native, stylusPointCollection.native);
		}
Example #3
0
        public override void OnMouseMove(System.Windows.Controls.InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                bottomRight = e.GetPosition(inkCanvas);
                if(topLeft != bottomRight)
                {
                    StylusPointCollection pts = new StylusPointCollection();
                    GetRectangle(pts, (s) =>
                    {
                        if (StrokeResult != null)
                            inkCanvas.Strokes.Remove(StrokeResult);

                        DrawingAttributes drawingAttributes = new DrawingAttributes
                        {
                            Color = inkCanvas.DefaultDrawingAttributes.Color,
                            Width = inkCanvas.DefaultDrawingAttributes.Width,
                            StylusTip = StylusTip.Ellipse,
                            IgnorePressure = true,
                            FitToCurve = true
                        };
                        var BackgroundColor = inkCanvas.DefaultDrawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor);
                        drawingAttributes.AddPropertyData(DrawAttributesGuid.BackgroundColor, BackgroundColor);

                        StrokeResult = new RectangleStroke(s, drawingAttributes);
                        inkCanvas.Strokes.Add(StrokeResult);
                    }
                    );
                }

            }
        }
        //A new stroke object named MyStroke is created. MyStroke is added to the StrokeCollection of the InkPresenter named MyIP
        private void MyIP_MouseLeftButtonDown(object sender, MouseEventArgs e)
        {
            MyIP.CaptureMouse();
            if (eraseflag == true)
            {

                StylusPointCollection MyStylusPointCollection = new StylusPointCollection();
                MyStylusPointCollection.Add(e.StylusDevice.GetStylusPoints(MyIP));
                NewStroke = new Stroke(MyStylusPointCollection);
                NewStroke.DrawingAttributes.Color = Colors.Red;
                MyIP.Strokes.Add(NewStroke); StylusPointCollection ErasePointCollection = new StylusPointCollection();


            }
            else
            {
                StylusPointCollection pointErasePoints = e.StylusDevice.GetStylusPoints(MyIP);
                StrokeCollection hitStrokes = MyIP.Strokes.HitTest(pointErasePoints);
                if (hitStrokes.Count > 0)
                {
                    foreach (Stroke hitStroke in hitStrokes)
                    {
                        MyIP.Strokes.Remove(hitStroke);
                        //undoStack.Push(hitStroke);
                        //undoStateBufferStack.Push(true);
                    }
                }
            }
        }
Example #5
0
        /// <summary>
        /// Adds a StylusPacket representing an incremental move of the hit-testing tool
        /// </summary>
        /// <param name="stylusPoints">stylusPoints</param>
        public void AddPoints(StylusPointCollection stylusPoints)
        {
            if (stylusPoints == null)
            {
                throw new System.ArgumentNullException("stylusPoints");
            }

            if (stylusPoints.Count == 0)
            {
                throw new System.ArgumentException(SR.Get(SRID.EmptyArrayNotAllowedAsArgument), "stylusPoints");
            }

            if (false == _fValid)
            {
                throw new System.InvalidOperationException(SR.Get(SRID.EndHitTestingCalled));
            }

            System.Diagnostics.Debug.Assert(_strokes != null);

            Point[] points = new Point[stylusPoints.Count];
            for (int x = 0; x < stylusPoints.Count; x++)
            {
                points[x] = (Point)stylusPoints[x];
            }

            AddPointsCore(points);
        }
Example #6
0
        void GetRectangle(StylusPointCollection pts, Action<StylusPointCollection> exec)
        {
            pts.Add(new StylusPoint(topLeft.X, topLeft.Y));
            pts.Add(new StylusPoint(bottomRight.X, bottomRight.Y));

            exec(pts);
        }
Example #7
0
 public Stroke Representation()
 {
     StylusPointCollection collection = new StylusPointCollection();
     foreach (var data in stylusPoints)
         collection.Add(data.Representation());
     return new Stroke(collection);
 }
Example #8
0
        public static string Classify(bool useRubine, float duration, bool righthandedness, List<float> SpeakerAngles, PointCollection pointHist, StylusPointCollection S, List<List<int>> hist, List<List<int>> ihist)
        {
            // Convert all parameters to format used in GestureTests
            List<Vector2> InterpretedPoints = new List<Vector2>();
            List<Vector2> StylusPoints = new List<Vector2>();
            List<Vector2> VelocityHistory = new List<Vector2>();
            List<Vector2> InverseVelocityHistory = new List<Vector2>();
            foreach(Point P in pointHist)
                InterpretedPoints.Add(new Vector2((float)P.X,(float)P.Y));
            foreach(StylusPoint P in S)
                StylusPoints.Add(new Vector2((float)P.X,(float)P.Y));
            for (int i = 0; i < hist[0].Count; i++)
            {
                VelocityHistory.Add(new Vector2(hist[0][i], hist[1][i]));
                InverseVelocityHistory.Add(new Vector2(ihist[0][i], ihist[1][i]));
            }

            // Create a new Sample, compute the features, and classify
            GS = new GestureSample(GestureTests.Types.GestureType.unknown, righthandedness,duration,SpeakerAngles,InterpretedPoints,StylusPoints,VelocityHistory,InverseVelocityHistory);
            GS.ComputeFeatures(GestureFeatures.PointsStroke);

            if (useRubine)
                return EC.Recognizer.Classify(GS).ToString();
            WriteARFF();

            Instances test = new Instances(new java.io.FileReader("outfile.arff"));
            test.setClassIndex(0);

            double clsLabel = cls.classifyInstance(test.instance(0));
            test.instance(0).setClassValue(clsLabel);

            // Return the appropriate label
            return ((GestureType2D)((int)clsLabel+1)).ToString();
        }
Example #9
0
 public customStroke(StylusPointCollection pts,PaintingCanvas ink)
     : base(pts)
 {
     this.StylusPoints = pts;
     this.color = ink.colorName;
     this.size = ink.penSize;
 }
Example #10
0
        public override void OnMouseMove(InkCanvas inkCanvas, System.Windows.Input.MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                endPoint = e.GetPosition(inkCanvas);
                if(startPoint != endPoint)
                {
                    StylusPointCollection pts = new StylusPointCollection();
                    GetLine(pts, (s) =>
                    {
                        if (StrokeResult != null)
                            inkCanvas.Strokes.Remove(StrokeResult);

                        DrawingAttributes drawingAttributes = new DrawingAttributes
                        {
                            Color = inkCanvas.DefaultDrawingAttributes.Color,
                            Width = inkCanvas.DefaultDrawingAttributes.Width,
                            StylusTip = StylusTip.Ellipse,
                            IgnorePressure = true,
                            FitToCurve = true
                        };

                        StrokeResult = new LineStroke(s, drawingAttributes);
                        inkCanvas.Strokes.Add(StrokeResult);
                    }
                    );
                }
            }
        }
Example #11
0
 public CustomStroke(StylusPointCollection col, Color strokeColor, int thickness, Color fill)
     : base(col)
 {
     this.strokeColor = strokeColor;
     this.thickness = thickness;
     this.fillColor = fill;
 }
    private void addNextPDF()
    {

        PdfPage page = new PdfPage();
        page.Size = PageSize.A4;

        double h = SystemParameters.PrimaryScreenHeight;
        double w = SystemParameters.PrimaryScreenWidth;
        //XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);
        var rateW = page.Width / w;
        var rateH = page.Height / h;

        var strokes = CanvasStroke.ToList();
        List<Point[]> pl = new List<Point[]>();
        foreach (Stroke stroke in strokes)
        {

            StylusPointCollection points = stroke.StylusPoints;
            StylusPointCollection newPoints = new StylusPointCollection();
            var pointList = points.ToList();
            foreach (StylusPoint pt in pointList)
            {

                StylusPoint newPt = new StylusPoint(pt.X * rateW, pt.Y * rateH);
                newPoints.Add(newPt);
            }
            Point[] p = (Point[])newPoints;
            pList.Add(p);
            pl.Add(p);
            CanvasStroke.Remove(stroke);
        }

        pointL.Add(pl);

    }
Example #13
0
        //Метод, который отвечает за зеркальное отражение, как по-вертикали, так и по-горизонтали
        public void MirrorReflection(object sender, EventArgs e)
        {
            double val;
            bool horizontally = false;

            if ((sender as MenuItem).Name == "horizontal")
            {
                val = surface.ActualHeight;
                horizontally = true;
            }
            else
            {
                val = surface.ActualWidth;
            }

            for (int i = 0; i < surface.Strokes.Count; i++)
            {
                DrawingAttributes dr = surface.Strokes[i].DrawingAttributes;
                StylusPointCollection newPoints = new StylusPointCollection();
                for (int j = 0; j < surface.Strokes[i].StylusPoints.Count; j++)
                {
                    StylusPoint p = surface.Strokes[i].StylusPoints[j];
                    if (horizontally)
                    {
                        p.Y = val - p.Y;
                    }
                    else
                    {
                        p.X = val - p.X;
                    }
                    newPoints.Add(p);
                }
                surface.Strokes[i].StylusPoints = newPoints;
            }
        }
Example #14
0
 public TouchPoint2(TouchInfo info, UIElement source, StylusPointCollection stylusPoints)
 {
     this.Source = source;
     Stroke = new Stroke(stylusPoints);
     TouchDeviceId = info.TouchDeviceId;
     StartTime = DateTime.Now;
     UpdateTouchInfo(info);
 }
Example #15
0
        public static void up(MouseButtonEventArgs e, InkPresenter inkCanvas, Grid LayoutRoot)
        {
            int clickedLayer = Common.hitTestLayer(e, inkCanvas);
            StylusPointCollection spc = new StylusPointCollection();

            checkIfStrokeSelected(e, inkCanvas, spc);

            checkIfLayerSelected(LayoutRoot, clickedLayer);
        }
Example #16
0
        private static void checkIfStrokeSelected(MouseButtonEventArgs e, InkPresenter inkCanvas, StylusPointCollection spc)
        {
            spc.Add(new StylusPoint(e.GetPosition(inkCanvas).X, e.GetPosition(inkCanvas).Y));

            if (inkCanvas.Strokes.HitTest(spc).Count > 0)
            {
                removeSelectedStroke(inkCanvas, spc);
            }

            return;
        }
Example #17
0
        private bool IsEnclosedAreaWithinRange(StylusPointCollection stylusPointCollection)
        {
            // TODO: Move the magic number to configuration
            Point[] points = stylusPointCollection.ToFilteredPoints(5);

            double area  = ConvexHullArea.GetArea(points);

            if (area >= _data.Min && area <= _data.Max)
                return true;
            else
                return false;
        }
 private void myInkPresenter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     //捕获鼠标焦点
     myInkPresenter.CaptureMouse();
     myPointCollection = new StylusPointCollection();
     myPointCollection.Add(e.StylusDevice.GetStylusPoints(myInkPresenter));
     currentStroke = new Stroke(myPointCollection);
     //设置画笔属性
     currentStroke.DrawingAttributes.Color = currentColor;
     currentStroke.DrawingAttributes.Height = sliderThickness.Value;
     currentStroke.DrawingAttributes.Width = sliderThickness.Value;
     myInkPresenter.Strokes.Add(currentStroke);
 }
Example #19
0
        /// <summary>
        /// Construct bezier control points from points
        /// </summary>
        /// <param name="stylusPoints">Original StylusPointCollection</param>
        /// <param name="fitError">Fitting error</param>
        /// <returns>Whether the algorithm succeeded</returns>
        internal bool ConstructBezierState(StylusPointCollection stylusPoints, double fitError)
        {
            // If the point count is zero, the curve cannot be constructed
            if ((null == stylusPoints) || (stylusPoints.Count == 0))
                return false;

            // Compile list of distinct points and their nodes
            CuspData dat = new CuspData();
            dat.Analyze(stylusPoints, 
                        fitError /*typically zero*/);

            return ConstructFromData(dat, fitError);
        }
 public void Deserialize(XmlNode xmlNode, FlowDocument flowDocument)
 {
     var inkCanvas = new InkCanvasEx();
     foreach (XmlNode strokeNode in xmlNode.ChildNodes)
     {
         var points = new StylusPointCollection();
         foreach (XmlNode pointNode in strokeNode.ChildNodes)
         {
             points.Add(new StylusPoint(Double.Parse(pointNode.Attributes["X"].InnerText),
                 Double.Parse(pointNode.Attributes["Y"].InnerText)));
         }
         inkCanvas.Strokes.Add(new Stroke(points)); //TODO DrawingAttributes
     }
     flowDocument.Blocks.Add(new DrawerBlock { Child = new DrawerControl { Strokes = inkCanvas.Strokes }});
 }
Example #21
0
        public static void down(MouseButtonEventArgs e, InkPresenter inkCanvas, Grid LayoutRoot)
        {
            dragStarted = true;
            inkCanvas.CaptureMouse();

            clickedLayer = Common.hitTestLayer(e, inkCanvas);
            initialPos = e.GetPosition(inkCanvas);

            StylusPointCollection spc = new StylusPointCollection();
            spc.Add(new StylusPoint(e.GetPosition(inkCanvas).X, e.GetPosition(inkCanvas).Y));

            hitCount = inkCanvas.Strokes.HitTest(spc).Count;

            System.Diagnostics.Debug.WriteLine("layer " + clickedLayer);

            if (clickedLayer != -1)
            {

                //Calculate offset of left, right, top, bottom
                calculateOffset(e, inkCanvas);

                //System.Diagnostics.Debug.WriteLine("maxLeft " + MainPage.layerList[clickedLayer].imageToBorderDist[LEFT]);
                //System.Diagnostics.Debug.WriteLine("offSetLeft " + offSetLeft);
                //System.Diagnostics.Debug.WriteLine("positionY" + e.GetPosition(inkCanvas).Y);
                //System.Diagnostics.Debug.WriteLine("maxTop " + MainPage.layerList[clickedLayer].imageToBorderDist[TOP]);
                //System.Diagnostics.Debug.WriteLine("offSetTop " + offSetTop);

                //if the clickedLayer's image is out of bound
                if (clickedLayer != -1 && MainPage.layerList[clickedLayer].imgBackup != null)
                {
                    replaceMovingImgWithBackupImg(LayoutRoot);

                }
                else
                {
                    //temporarly save image in image backup
                    imageBackup = new WriteableBitmap((BitmapSource)MainPage.layerList[clickedLayer].img.Source);
                }

            }

            //Line clicked
            if (hitCount > 0)
            {
                moveInkToNewInkPresenter(inkCanvas, LayoutRoot, spc);
            }
        }
Example #22
0
        /// <summary>
        /// Constructs internal data structure from points for doing operations like
        /// cusp detection or tangent computation
        /// </summary>
        /// <param name="stylusPoints">Points to be analyzed</param>
        /// <param name="rSpan">Distance between two consecutive distinct points</param>
        internal void Analyze(StylusPointCollection stylusPoints, double rSpan)
        {
            // If the count is less than 1, return
            if ((null == stylusPoints) || (stylusPoints.Count == 0))
                return;

            _points = new List<CDataPoint>(stylusPoints.Count);
            _nodes = new List<double>(stylusPoints.Count);

            // Construct the lists of data points and nodes
            _nodes.Add(0);
            CDataPoint cdp0 = new CDataPoint();
            cdp0.Index = 0;
            //convert from Avalon to Himetric
            Point point = (Point)stylusPoints[0];
            point.X *= StrokeCollectionSerializer.AvalonToHimetricMultiplier;
            point.Y *= StrokeCollectionSerializer.AvalonToHimetricMultiplier;
            cdp0.Point = point;
            _points.Add(cdp0);

            //drop duplicates
            int index = 0;
            for (int i = 1; i < stylusPoints.Count; i++)
            {
                if (!DoubleUtil.AreClose(stylusPoints[i].X, stylusPoints[i - 1].X) ||
                    !DoubleUtil.AreClose(stylusPoints[i].Y, stylusPoints[i - 1].Y))
                {
                    //this is a unique point, add it
                    index++;

                    CDataPoint cdp = new CDataPoint();
                    cdp.Index = index;

                    //convert from Avalon to Himetric
                    Point point2 = (Point)stylusPoints[i];
                    point2.X *= StrokeCollectionSerializer.AvalonToHimetricMultiplier;
                    point2.Y *= StrokeCollectionSerializer.AvalonToHimetricMultiplier;
                    cdp.Point = point2;

                    _points.Insert(index, cdp);
                    _nodes.Insert(index, _nodes[index - 1] + (XY(index) - XY(index - 1)).Length);
                }
            }
 
            SetLinks(rSpan);
        }
Example #23
0
        /// <summary>
        /// Creates a default enumerator for a given stroke
        /// If using the strokes drawing attributes, pass stroke.DrawingAttributes for the second
        /// argument.  If using an overridden DA, use that instance.
        /// </summary>
        internal static StrokeNodeIterator GetIterator(StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes)
        {
            if (stylusPoints == null)
            {
                throw new System.ArgumentNullException("stylusPoints");
            }
            if (drawingAttributes == null)
            {
                throw new System.ArgumentNullException("drawingAttributes");
            }

            StrokeNodeOperations operations =
                StrokeNodeOperations.CreateInstance(drawingAttributes.StylusShape);

            bool usePressure = !drawingAttributes.IgnorePressure;

            return new StrokeNodeIterator(stylusPoints, operations, usePressure);
        }
        protected void Update( object sender, EventArgs e )
        {
            paintCanvas.Strokes.Clear();
            windowWidth = (float)this.Width;
            windowHeight = (float)this.Height;

            Leap.Frame frame = leap.Frame();
            InteractionBox interactionBox = leap.Frame().InteractionBox;

            foreach ( Pointable pointable in leap.Frame().Pointables ) {
                // ここから追加
                // 伸びている指、ツール以外は無視する
                //if ( !pointable.IsExtended ) {
                //    continue;
                //}
                // ここまで追加

                Leap.Vector normalizedPosition =
                    interactionBox.NormalizePoint( pointable.StabilizedTipPosition );
                float tx = normalizedPosition.x * windowWidth;
                float ty = windowHeight - normalizedPosition.y * windowHeight;

                int alpha = 255;
                if ( (pointable.TouchDistance > 0 && pointable.TouchZone != Pointable.Zone.ZONENONE ) ) {
                    alpha = 255 - (int)(255 * pointable.TouchDistance);
                    touchIndicator.Color = Color.FromArgb( (byte)alpha, 0x0, 0xff, 0x0 );
                }
                else if ( pointable.TouchDistance <= 0 ) {
                    alpha = -(int)(255 * pointable.TouchDistance);
                    touchIndicator.Color = Color.FromArgb( (byte)alpha, 0xff, 0x0, 0x0 );
                }
                else {
                    alpha = 50;
                    touchIndicator.Color = Color.FromArgb( (byte)alpha, 0x0, 0x0, 0xff );
                }

                StylusPoint touchPoint = new StylusPoint( tx, ty );
                StylusPointCollection tips =
                    new StylusPointCollection( new StylusPoint[] { touchPoint } );
                Stroke touchStroke = new Stroke( tips, touchIndicator );
                paintCanvas.Strokes.Add( touchStroke );
            }
        }
Example #25
0
        public TouchPoint2(TouchInfo info, UIElement source)
        {
            this.Source = source;

            #if SILVERLIGHT
            Stroke = new Stroke();
            #else
            var stylusPoints = new StylusPointCollection(1);
            stylusPoints.Add(new StylusPoint(info.Position.X, info.Position.Y));
            Stroke = new Stroke(stylusPoints);
            #endif

            TouchDeviceId = info.TouchDeviceId;
            StartTime = DateTime.Now;

            #if SILVERLIGHT
            UpdateTouchStroke(info);
            #endif
            UpdateTouchInfo(info);
        }
Example #26
0
		public void Stroke_StylusPointCollection ()
		{
			StylusPointCollection spc = new StylusPointCollection ();
			spc.Add (new StylusPoint (1, 2));

			Stroke s = new Stroke (spc);
			Assert.AreEqual (1, s.StylusPoints.Count, "StylusPoints-1");

			spc.Add (new StylusPoint (3, 4));
			Assert.AreEqual (2, s.StylusPoints.Count, "StylusPoints-2");

			s.StylusPoints.Add (new StylusPoint (5, 6));
			Assert.AreEqual (3, s.StylusPoints.Count, "StylusPoints-3a");
			Assert.AreEqual (3, spc.Count, "StylusPoints-3b");

			Assert.Throws<ArgumentException> (delegate {
				s.HitTest (null);
			}, "HitTest-null");
			Assert.IsTrue (s.HitTest (s.StylusPoints), "HitTest-StylusPoints");
		}
Example #27
0
        /// <summary>Create a stroke from a StylusPointCollection</summary>
        /// <remarks>
        /// </remarks>
        /// <param name="stylusPoints">StylusPointCollection that makes up the stroke</param> 
        /// <param name="drawingAttributes">drawingAttributes</param>
        /// <param name="extendedProperties">extendedProperties</param> 
        internal Stroke(StylusPointCollection stylusPoints, DrawingAttributes drawingAttributes, ExtendedPropertyCollection extendedProperties) 
        {
            if (stylusPoints == null) 
            {
                throw new ArgumentNullException("stylusPoints");
            }
            if (stylusPoints.Count == 0) 
            {
                throw new ArgumentException(SR.Get(SRID.InvalidStylusPointCollectionZeroCount), "stylusPoints"); 
            } 
            if (drawingAttributes == null)
            { 
                throw new ArgumentNullException("drawingAttributes");
            }

            _drawingAttributes = drawingAttributes; 
            _stylusPoints = stylusPoints;
            _extendedProperties = extendedProperties; 
 
            Initialize();
        } 
        private StrokeCollection GetStrokeCollectionFromPoints(dynamic strokePoints)
        {
            var strokeCollection = new StrokeCollection();

            foreach (var stroke in strokePoints.Strokes)
            {
                var points = new StylusPointCollection();

                foreach (var point in stroke.Points)
                {
                    var x = (float)point.X;
                    var y = (float)point.Y;

                    points.Add(new StylusPoint(x, y));
                }

                strokeCollection.Add(new Stroke(points));
            }

            return strokeCollection;
        }
Example #29
0
        public static StrokeCollection ConvertToStrokeCollection(SerializableStrokeCollection strokeCollection)
        {
            StrokeCollection resultCollection = new StrokeCollection();
            foreach (var stroke in strokeCollection)
            {
                DrawingAttributes drawingAttr = new DrawingAttributes
                {
                    Color = stroke.DrawingAttributes.Color,
                    FitToCurve = stroke.DrawingAttributes.FitToCurve,
                    Height = stroke.DrawingAttributes.Height,
                    Width = stroke.DrawingAttributes.Width,
                    IgnorePressure = stroke.DrawingAttributes.IgnorePressure,
                    IsHighlighter = stroke.DrawingAttributes.IsHighlighter,
                    StylusTipTransform = stroke.DrawingAttributes.StylusTipTransform
                };
                switch (stroke.DrawingAttributes.StylusTip)
                {
                    case SerializableDrawingAttributes.StylusTips.Ellipse:
                        drawingAttr.StylusTip = StylusTip.Ellipse;
                        break;
                    case SerializableDrawingAttributes.StylusTips.Rectangle:
                        drawingAttr.StylusTip = StylusTip.Rectangle;
                        break;
                    default:
                        break;
                }

                StylusPointCollection spc = new StylusPointCollection();
                foreach (var stylusPoint in stroke.StylusPoints)
                {
                    StylusPoint sp = new StylusPoint { X = stylusPoint.X, Y = stylusPoint.Y, PressureFactor = stylusPoint.PressureFactor };
                    spc.Add(sp);
                }
                Stroke newStroke = new Stroke(spc);
                newStroke.DrawingAttributes = drawingAttr;
                resultCollection.Add(newStroke);
            }
            return resultCollection;
        }
Example #30
0
        /// <summary>
        /// StylusInputContinue
        /// </summary>
        /// <param name="stylusPoints">stylusPoints</param>
        /// <param name="userInitiated">true if the source eventArgs.UserInitiated flag was set to true</param>
        protected override void StylusInputContinue(StylusPointCollection stylusPoints, bool userInitiated)
        {
            _stylusPoints.Add(stylusPoints);

            _incrementalStrokeHitTester.AddPoints(stylusPoints);
        }