当前位置: 首页>>代码示例>>C#>>正文


C# StylusPointCollection类代码示例

本文整理汇总了C#中StylusPointCollection的典型用法代码示例。如果您正苦于以下问题:C# StylusPointCollection类的具体用法?C# StylusPointCollection怎么用?C# StylusPointCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StylusPointCollection类属于命名空间,在下文中一共展示了StylusPointCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToWindowsStroke

        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);
        }
开发者ID:aragoubi,项目名称:Nine,代码行数:31,代码来源:StrokeConverter.cs

示例2: HitTest

		public bool HitTest (StylusPointCollection stylusPointCollection)
		{
			if (stylusPointCollection == null)
				throw new ArgumentException ("stylusPointCollection");

			return NativeMethods.stroke_hit_test (native, stylusPointCollection.native);
		}
开发者ID:dfr0,项目名称:moon,代码行数:7,代码来源:Stroke.cs

示例3: OnMouseMove

        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);
                    }
                    );
                }

            }
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:32,代码来源:DrawRectangle.cs

示例4: MyIP_MouseLeftButtonDown

        //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);
                    }
                }
            }
        }
开发者ID:TinusGreen,项目名称:GendacProjects,代码行数:30,代码来源:MainPage.xaml.cs

示例5: AddPoints

        /// <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);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:31,代码来源:IncrementalHitTester.cs

示例6: GetRectangle

        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);
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:7,代码来源:DrawRectangle.cs

示例7: Representation

 public Stroke Representation()
 {
     StylusPointCollection collection = new StylusPointCollection();
     foreach (var data in stylusPoints)
         collection.Add(data.Representation());
     return new Stroke(collection);
 }
开发者ID:rudi-c,项目名称:htn-stylus,代码行数:7,代码来源:InkData.cs

示例8: Classify

        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();
        }
开发者ID:ISUE,项目名称:Multiwave,代码行数:34,代码来源:WekaHelper.cs

示例9: customStroke

 public customStroke(StylusPointCollection pts,PaintingCanvas ink)
     : base(pts)
 {
     this.StylusPoints = pts;
     this.color = ink.colorName;
     this.size = ink.penSize;
 }
开发者ID:BillHuangg,项目名称:xGraffiti,代码行数:7,代码来源:customStroke.cs

示例10: OnMouseMove

        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);
                    }
                    );
                }
            }
        }
开发者ID:sonicrang,项目名称:RangPaint,代码行数:29,代码来源:DrawLine.cs

示例11: CustomStroke

 public CustomStroke(StylusPointCollection col, Color strokeColor, int thickness, Color fill)
     : base(col)
 {
     this.strokeColor = strokeColor;
     this.thickness = thickness;
     this.fillColor = fill;
 }
开发者ID:Optofizik,项目名称:Graphic-Editor,代码行数:7,代码来源:CustomStroke.cs

示例12: addNextPDF

    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);

    }
开发者ID:CodeZheng,项目名称:C-Inkcanvas-PDF,代码行数:35,代码来源:MainViewModel.cs

示例13: MirrorReflection

        //Метод, который отвечает за зеркальное отражение, как по-вертикали, так и по-горизонтали
        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;
            }
        }
开发者ID:Optofizik,项目名称:Graphic-Editor,代码行数:36,代码来源:ImageEditor.cs

示例14: TouchPoint2

 public TouchPoint2(TouchInfo info, UIElement source, StylusPointCollection stylusPoints)
 {
     this.Source = source;
     Stroke = new Stroke(stylusPoints);
     TouchDeviceId = info.TouchDeviceId;
     StartTime = DateTime.Now;
     UpdateTouchInfo(info);
 }
开发者ID:tuliosouza,项目名称:ASG,代码行数:8,代码来源:TouchPoint2.cs

示例15: up

        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);
        }
开发者ID:kiangkuang,项目名称:SilverlightFill,代码行数:9,代码来源:Delete.cs


注:本文中的StylusPointCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。