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

C# Cairo.PointD类代码示例

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

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



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

示例1: OnMouseDown

        protected override void OnMouseDown(Gtk.DrawingArea canvas, Gtk.ButtonPressEventArgs args, Cairo.PointD point)
        {
            origin_offset = point;
            is_dragging = true;

            hist = new MovePixelsHistoryItem (Icon, Name);
            hist.TakeSnapshot ();

            if (!PintaCore.Layers.ShowSelectionLayer) {
                // Copy the selection to the temp layer
                PintaCore.Layers.CreateSelectionLayer ();
                PintaCore.Layers.ShowSelectionLayer = true;

                using (Cairo.Context g = new Cairo.Context (PintaCore.Layers.SelectionLayer.Surface)) {
                    g.AppendPath (PintaCore.Layers.SelectionPath);
                    g.FillRule = FillRule.EvenOdd;
                    g.SetSource (PintaCore.Layers.CurrentLayer.Surface);
                    g.Clip ();
                    g.Paint ();
                }

                Cairo.ImageSurface surf = PintaCore.Layers.CurrentLayer.Surface;

                using (Cairo.Context g = new Cairo.Context (surf)) {
                    g.AppendPath (PintaCore.Layers.SelectionPath);
                    g.FillRule = FillRule.EvenOdd;
                    g.Operator = Cairo.Operator.Clear;
                    g.Fill ();
                }
            }

            canvas.GdkWindow.Invalidate ();
        }
开发者ID:deckarep,项目名称:Pinta,代码行数:33,代码来源:MoveSelectedTool.cs


示例2: getSharpestPointAndAssociatedMidpointAndDullestPoints

        public Tuple<PointD, PointD, PointD, PointD> getSharpestPointAndAssociatedMidpointAndDullestPoints()
        {
            if (-1 == sharpestPointIdx) {
                sharpestPointIdx = TriangleUtils.GetSharpestPoint (tri);
            }
            int sharp = sharpestPointIdx;
            PointD p;
            PointD d1;
            PointD d2;
            // meh
            if (0 == sharp) {
                p = tri.a;
                d1 = tri.b;
                d2 = tri.c;
            } else if (1 == sharp) {
                p = tri.b;
                d1 = tri.a;
                d2 = tri.c;
            } else {
                p = tri.c;
                d1 = tri.a;
                d2 = tri.b;
            }

            PointD midPoint = new PointD ((d1.X+d2.X)/2,(d1.Y+d2.Y)/2);

            return new Tuple<PointD,PointD,PointD,PointD> (p,midPoint,d1,d2);
        }
开发者ID:latestversion,项目名称:projects,代码行数:28,代码来源:ActiveTriangle.cs


示例3: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            Debug.WriteLine("OnPaint");

            //draw something on the back surface

            var p1 = new PointD(10, 10);
            var p2 = new PointD(100, 10);
            var p3 = new PointD(100, 100);
            var p4 = new PointD(10, 100);

            BackContext.SetSourceColor(new Cairo.Color(1,0,0));
            BackContext.MoveTo(p1);
            BackContext.LineTo(p2);
            BackContext.LineTo(p3);
            BackContext.LineTo(p4);
            BackContext.LineTo(p1);
            BackContext.ClosePath();
            BackContext.Stroke();

            BackContext.SetSourceColor(new Cairo.Color(0, 1, 0));
            BackContext.MoveTo(new PointD(p3.X + 10, p3.Y + 10));
            Cairo.Path path = DWriteCairo.RenderLayoutToCairoPath(BackContext, textLayout);
            BackContext.AppendPath(path);
            path.Dispose();
            BackContext.Fill();

            //copy back surface to font surface
            SwapBuffer();
        }
开发者ID:zwcloud,项目名称:ZWCloud.DwriteCairo,代码行数:30,代码来源:Form1.cs


示例4: PreCalc

		// In perspective mode, the warping functions are:
		//	x' = (a0 + a1 x + a2 y) / (c0 x + c1 y + 1)
		//	y' = (b0 + b1 x + b2 y) / (c0 x + c1 y + 1)
		//
		// The following calculates the factors a#, b# and c#.
		// We do this by creating a set of eight equations with a#, b# and c# as unknowns.
		// The equations are derived by:
		// 1. substituting the srcPoints for (x, y);
		// 2. substituting the corresponding destPoints for (x', y');
		// 3. solving the resulting set of equations, with the factors as unknowns.
		//
		// The equations are like these:
		//	a0	x a1	y a2	0		0		0		-xx'c0	-yx'c1	= x'
		//	0	0		0		b0		x b1	y b2	-xy'c0	-yy'c1  = y'
		// The known factors of left hand side ar put in the 8x8 matrix mxLeft for
		// all four point pairs, and the right hand side in the one column matrix mxRight.
		// After solving, m_mxWarpFactors contains a0, a1, a2, b0, b1, b2, c0, c1.
		private void PreCalc(PointD[] destPoints, PointD[] srcPoints)
		{
			var mxLeft = new GeneralMatrix(8, 8); //mxLeft.Null();
			var 	mxRight = new GeneralMatrix(8, 1);

			var row = 0;

			for (int i = 0; i < 4; i++)
			{
				mxLeft.Array[row][0] = 1.0;
				mxLeft.Array[row][1] = srcPoints[i].X;
				mxLeft.Array[row][2] = srcPoints[i].Y;

				mxLeft.Array[row][6] = - srcPoints[i].X * destPoints[i].X;
				mxLeft.Array[row][7] = - srcPoints[i].Y * destPoints[i].X;

				mxRight.Array[row][0] = destPoints[i].X;

				row++;

				mxLeft.Array[row][3] = 1.0f;
				mxLeft.Array[row][4] = srcPoints[i].X;
				mxLeft.Array[row][5] = srcPoints[i].Y;

				mxLeft.Array[row][6] = - srcPoints[i].X * destPoints[i].Y;
				mxLeft.Array[row][7] = - srcPoints[i].Y * destPoints[i].Y;

				mxRight.Array[row][0] = destPoints[i].Y;

				row++;
			}

			_mxWarpFactors = mxLeft.Solve(mxRight);
		}
开发者ID:pruiz,项目名称:Mono.CairoWarp,代码行数:51,代码来源:WarpPerspective.cs


示例5: update

        public void update()
        {
            LineSegment segmentToPlayer = new LineSegment (position,player.getPosition());

            bool couldSeePlayerBefore = canSeePlayer;
            canSeePlayer = true;

                foreach (LineSegment wall in walls) {
                    if (LineSegment.TestIntersection (segmentToPlayer, wall)) {
                        canSeePlayer = false;
                        break;
                    }
                }

            if (canSeePlayer) {
                target = player.getPosition ();
                setStalkSpeed ();
            }

            if (!canSeePlayer && couldSeePlayerBefore) {
                setRandomTarget ();
                setWanderSpeed ();
            }

                PointD vectorDistance = new PointD (target.X - position.X, target.Y - position.Y);
            double scalarDistance = Math.Sqrt (Math.Pow(vectorDistance.X,2) + Math.Pow(vectorDistance.Y,2));

            if (scalarDistance < tolerance) {
                ;
            } else {
                double total = Math.Abs (vectorDistance.X) + Math.Abs (vectorDistance.Y);
                position.X += (vectorDistance.X / total) * speed;
                position.Y += vectorDistance.Y / total * speed;
            }
        }
开发者ID:latestversion,项目名称:projects,代码行数:35,代码来源:Ghost.cs


示例6: MouseDrag

		public override void MouseDrag (MouseEvent ev) {
			DrawSelectionRect ((Gtk.Widget) ev.View, ev.GdkEvent.Window);
			PointD anchor = new PointD (AnchorX, AnchorY);
			PointD corner = new PointD (ev.X, ev.Y);
			_selectionRect = new RectangleD (anchor, corner);
			DrawSelectionRect ((Gtk.Widget) ev.View, ev.GdkEvent.Window);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:7,代码来源:SelectAreaTool.cs


示例7: UpdateRectangle

		protected void UpdateRectangle (PointD point)
		{
			if (!is_drawing)
				return;

			Document doc = PintaCore.Workspace.ActiveDocument;

			Rectangle r = PointsToRectangle (shape_origin, point);
			Rectangle dirty;

			doc.ToolLayer.Clear ();
			doc.ToolLayer.Hidden = false;

			using (Context g = new Context (doc.ToolLayer.Surface)) {
				g.Antialias = Antialias.Subpixel;

				dirty = g.FillStrokedRectangle (r, new Color (0, 0.4, 0.8, 0.1), new Color (0, 0, 0.9), 1);
				dirty = dirty.Clamp ();

				doc.Workspace.Invalidate (last_dirty.ToGdkRectangle ());
				doc.Workspace.Invalidate (dirty.ToGdkRectangle ());
				
				last_dirty = dirty;
			}
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:25,代码来源:ZoomTool.cs


示例8: InvalidateRect

        public virtual RectangleD InvalidateRect(PointD b)
        {
            var r = new RectangleD (b.X, b.Y, 0.0, 0.0);
            r.Inflate (15.0, 15.0);

            return r;
        }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:7,代码来源:LineTerminal.cs


示例9: Image_Loaded

 private void Image_Loaded(object sender, RoutedEventArgs e)
 {
     Image image = (Image)sender;
     using (ImageSurface surface = new ImageSurface(Format.Argb32, (int)image.Width, (int)image.Height))
     {
         using (Context context = new Context(surface))
         {
             PointD p = new PointD(10.0, 10.0);
             PointD p2 = new PointD(100.0, 10.0);
             PointD p3 = new PointD(100.0, 100.0);
             PointD p4 = new PointD(10.0, 100.0);
             context.MoveTo(p);
             context.LineTo(p2);
             context.LineTo(p3);
             context.LineTo(p4);
             context.LineTo(p);
             context.ClosePath();
             context.Fill();
             context.MoveTo(140.0, 110.0);
             context.SetFontSize(32.0);
             context.SetSourceColor(new Color(0.0, 0.0, 0.8, 1.0));
             context.ShowText("Hello Cairo!");
             surface.Flush();
             RgbaBitmapSource source = new RgbaBitmapSource(surface.Data, surface.Width);
             image.Source = source;
         }
     }
 }
开发者ID:zwcloud,项目名称:CairoSharp,代码行数:28,代码来源:MainWindow.xaml.cs


示例10: NodeGroup

 public NodeGroup()
 {
     nodes = ArrayList.Synchronized(new ArrayList());
     name = string.Empty;
     position = new PointD(0, 0);
     dimension = new SizeD(0, 0);
 }
开发者ID:codebutler,项目名称:meshwork,代码行数:7,代码来源:ZoomableNetworkMap.cs


示例11: OnMouseMove

 protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, PointD point)
 {
     if (active) {
         PintaCore.Workspace.ScrollCanvas ((int)(last_point.X - args.Event.XRoot), (int)(last_point.Y - args.Event.YRoot));
         last_point = new PointD (args.Event.XRoot, args.Event.YRoot);
     }
 }
开发者ID:deckarep,项目名称:Pinta,代码行数:7,代码来源:PanTool.cs


示例12: OnMouseDown

		protected override void OnMouseDown (DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
		{
			// Ignore extra button clicks while drawing
			if (is_drawing)
				return;

			Document doc = PintaCore.Workspace.ActiveDocument;
			hist = new SelectionHistoryItem(Icon, Name);
			hist.TakeSnapshot();

			reset_origin = args.Event.GetPoint();

            active_control = HandleResize (point);
			if (!active_control.HasValue)
			{
				combine_mode = PintaCore.Workspace.SelectionHandler.DetermineCombineMode(args);

				double x = Utility.Clamp(point.X, 0, doc.ImageSize.Width - 1);
				double y = Utility.Clamp(point.Y, 0, doc.ImageSize.Height - 1);
				shape_origin = new PointD(x, y);

                doc.PreviousSelection.Dispose ();
				doc.PreviousSelection = doc.Selection.Clone();
				doc.Selection.SelectionPolygons.Clear();

                // The bottom right corner should be selected.
                active_control = 3;
			}

            is_drawing = true;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:31,代码来源:SelectTool.cs


示例13: DrawGraduations

        protected override void DrawGraduations(Context gr, PointD pStart, PointD pEnd)
        {
            Rectangle r = ClientRectangle;
            Foreground.SetAsSource (gr);

            gr.LineWidth = 2;
            gr.MoveTo(pStart);
            gr.LineTo(pEnd);

            gr.Stroke();
            gr.LineWidth = 1;

            double sst = unity * SmallIncrement;
            double bst = unity * LargeIncrement;

            PointD vBar = new PointD(0, sst);
            for (double x = Minimum; x <= Maximum - Minimum; x += SmallIncrement)
            {
                double lineLength = r.Height / 3;
                if (x % LargeIncrement != 0)
                    lineLength /= 3;
                PointD p = new PointD(pStart.X + x * unity, pStart.Y);
                gr.MoveTo(p);
                gr.LineTo(new PointD(p.X, p.Y + lineLength));
            }
            gr.Stroke();
        }
开发者ID:jpbruyere,项目名称:Crow,代码行数:27,代码来源:GraduatedSlider.cs


示例14: EdgePointOfCircle

        //FIXME: Fix so point stays on edge of circle
        public static PointD EdgePointOfCircle(PointD midpoint, double radius, PointD endpoint)
        {
            var x_vector = endpoint.X - midpoint.X;
            var y_vector = endpoint.Y - midpoint.Y;

            var sin = y_vector / radius;
            var cos = x_vector / radius;
            var x = 0.0;
            var y = 0.0;
            var e = 0.0001;

            if (Math.Abs (sin) > e) {
                y = radius * (-sin);
                y = Range (-radius, radius, y);
            } else
                x = radius;

            if (Math.Abs (cos) > e) {
                x = radius * (-cos);
                x = Range (-radius, radius, x);
            } else
                y = radius;

            return new PointD (midpoint.X + x, midpoint.Y + y);
        }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:26,代码来源:Geometry.cs


示例15: OnDrawingAreaExposed

        void OnDrawingAreaExposed(object o, ExposeEventArgs args)
        {
            if (prevSize != Allocation.Size)
            {
                if (model != null)
                    treeMapModel = new TreeMapModel(model, Allocation.Width, Allocation.Height);
            }

            DrawingArea area = (DrawingArea)o;
            Cairo.Context g = Gdk.CairoHelper.Create(area.GdkWindow);

            if (treeMapModel != null)
            {
                foreach (var item in treeMapModel.Items)
                {
                    double width = item.Rectangle.Width;
                    double height = item.Rectangle.Height;

                    double x1 = item.Rectangle.X;
                    double x2 = item.Rectangle.X + item.Rectangle.Width;
                    double y1 = item.Rectangle.Y;
                    double y2 = item.Rectangle.Y + item.Rectangle.Height;

                    PointD p1, p2, p3, p4;
                    p1 = new PointD(x1, y1);
                    p2 = new PointD(x2, y1);
                    p3 = new PointD(x2, y2);
                    p4 = new PointD(x1, y2);

                    g.MoveTo(p1);
                    g.LineTo(p2);
                    g.LineTo(p3);
                    g.LineTo(p4);
                    g.LineTo(p1);
                    g.ClosePath();

                    g.Save();
                    //using (Gradient pat = new LinearGradient(x1, y1, x2, y2))
                    using (Gradient pat = new RadialGradient(x1 + (x2 - x1) / 4.0, y1 + (y2 - y1) / 4.0, 3, x1 + (x2 - x1) / 4.0, y1 + (y2 - y1) / 4.0, Math.Sqrt(width*width + height*height)))
                    {
                        pat.AddColorStop(0, new Cairo.Color(1, 1, 1, 1));
                        pat.AddColorStop(1, new Cairo.Color(0, 0, 1, 1));
                        g.Pattern = pat;

                        // Fill the path with pattern
                        g.FillPreserve();
                    }

                    // We "undo" the pattern setting here
                    g.Restore();

                    g.Color = new Color(0, 0, 0, 0);
                    g.Stroke();
                }
            }

            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
开发者ID:joncham,项目名称:NDirStat,代码行数:59,代码来源:TreeMapView.cs


示例16: InvokeStep

		public override void InvokeStep (double x, double y, IDrawingView view)	{
			RectangleD r = Owner.DisplayBox;

			PointD new_location = new PointD (r.X, Math.Min (r.Y + r.Height, y));
			PointD new_corner   = new PointD (Math.Max (r.X, x), r.Y + r.Height);

			Owner.DisplayBox = new RectangleD (new_location, new_corner);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:8,代码来源:NorthEastHandle.cs


示例17: InvokeStep

		public override void InvokeStep(MouseEvent ev) {
			RectangleD r = Owner.DisplayBox;

			PointD new_location = new PointD (Math.Min (r.X + r.Width, ev.X), r.Y);
			PointD new_corner   = new PointD (r.X + r.Width, Math.Max (r.Y, ev.Y));

			Owner.DisplayBox = new RectangleD (new_location, new_corner);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:8,代码来源:SouthWestHandle.cs


示例18: OnMouseDown

        protected override void OnMouseDown(Gtk.DrawingArea canvas, Gtk.ButtonPressEventArgs args, PointD point)
        {
            // Don't scroll if the whole canvas fits (no scrollbars)
            if (!PintaCore.Workspace.CanvasFitsInWindow)
                active = true;

            last_point = new PointD (args.Event.XRoot, args.Event.YRoot);
        }
开发者ID:deckarep,项目名称:Pinta,代码行数:8,代码来源:PanTool.cs


示例19: Layer

 public Layer(ImageSurface surface, bool hidden, double opacity, string name)
 {
     Surface = surface;
     Hidden = hidden;
     Opacity = opacity;
     Name = name;
     Offset = new PointD (0, 0);
 }
开发者ID:asbjornu,项目名称:Pinta,代码行数:8,代码来源:Layer.cs


示例20: ConnectorToolboxItemNode

 public ConnectorToolboxItemNode(string name, ConnectionType connectorType, Gdk.Pixbuf icon)
     : base()
 {
     Icon = icon;
     Name = name;
     _connectorType = connectorType;
     point = new PointD (0.0, 0.0);
 }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:8,代码来源:ConnectorToolboxItemNode.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Cairo.Rectangle类代码示例发布时间:2022-05-24
下一篇:
C# Cairo.LinearGradient类代码示例发布时间: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