• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# StylusPointCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: checkIfStrokeSelected

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


示例17: IsEnclosedAreaWithinRange

        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;
        }
开发者ID:tuliosouza,项目名称:ASG,代码行数:12,代码来源:EnclosedAreaValidator.cs


示例18: myInkPresenter_MouseLeftButtonDown

 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);
 }
开发者ID:Tek-Eternal,项目名称:MyInkPresenter,代码行数:13,代码来源:MainPage.xaml.cs


示例19: ConstructBezierState

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


示例20: Deserialize

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SubRecord类代码示例发布时间:2022-05-24
下一篇:
C# StylesheetParser类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap