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


C# Context.Arc方法代码示例

本文整理汇总了C#中Xwt.Drawing.Context.Arc方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Arc方法的具体用法?C# Context.Arc怎么用?C# Context.Arc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xwt.Drawing.Context的用法示例。


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

示例1: PatternsAndImages

		public void PatternsAndImages (Context ctx, double x, double y)
		{
			ctx.Save ();
			ctx.Translate (x, y);
			
			ctx.SetColor (Colors.Black);
			// Dashed lines

			ctx.SetLineWidth (2);
			ctx.SetLineDash (15, 10, 10, 5, 5);
			ctx.Rectangle (10, 10, 100, 100);
			ctx.Stroke ();
			ctx.SetLineDash (0);
			
			// Image
			var arcColor = new Color (1, 0, 1);
			ImageBuilder ib = new ImageBuilder (30, 30);
			ib.Context.Arc (15, 15, 15, 0, 360);
			ib.Context.SetColor (arcColor);
			ib.Context.Fill ();
			ib.Context.SetColor (Colors.DarkKhaki);
			ib.Context.Rectangle (0, 0, 5, 5);
			ib.Context.Fill ();
			var img = ib.ToVectorImage ();
			ctx.DrawImage (img, 0, 0);
			ctx.DrawImage (img, 0, 50, 50, 10);
			
			ctx.Arc (100, 100, 15, 0, 360);
			arcColor.Alpha = 0.4;
			ctx.SetColor (arcColor);
			ctx.Fill ();
			
			// ImagePattern
			
			ctx.Save ();
			
			ctx.Translate (x + 130, y);
			ctx.Pattern = new ImagePattern (img);
			ctx.Rectangle (0, 0, 100, 100);
			ctx.Fill ();
			ctx.Restore ();
			
			ctx.Restore ();
			
			// Setting pixels
			
			ctx.SetLineWidth (1);
			for (int i=0; i<50;i++) {
				for (var j=0; j<50;j++) {
					Color c = Color.FromHsl (0.5, (double)i / 50d, (double)j / 50d);
					ctx.Rectangle (i, j, 1, 1);
					ctx.SetColor (c);
					ctx.Fill ();
				}
			}
		}	
开发者ID:m13253,项目名称:xwt,代码行数:56,代码来源:DrawingPatternsAndImages.cs

示例2: OnDraw

		protected override void OnDraw (Context ctx, Rectangle bounds)
		{
			var lineWidth = bounds.Width / 32d;
			var section = ((bounds.Width / 2) - lineWidth / 2) / 3;

			ctx.SetLineWidth (lineWidth);

			ctx.SetColor (Colors.Black);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, 1, 0, 360);
			ctx.Stroke ();
			
			ctx.SetColor (Colors.Red);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, section, 0, 360);
			ctx.Stroke ();

			ctx.SetColor (Colors.Green);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, section * 2, 0, 360);
			ctx.Stroke ();

			ctx.SetColor (Colors.Blue);
			ctx.Arc (bounds.Center.X, bounds.Center.Y, section * 3, 0, 360);
			ctx.Stroke ();
		}
开发者ID:m13253,项目名称:xwt,代码行数:23,代码来源:ImageScaling.cs

示例3: OnDraw

        protected override void OnDraw(Context ctx, Rectangle dirtyRect)
        {
            ctx.Save ();
            ctx.Translate (-hscroll.Value, -vscroll.Value);
            ctx.Rectangle (new Rectangle (0, 0, imageSize, imageSize));
            ctx.SetColor (Xwt.Drawing.Colors.White);
            ctx.Fill ();
            ctx.Arc (imageSize / 2, imageSize / 2, imageSize / 2 - 20, 0, 360);
            ctx.SetColor (new Color (0,0,1));
            ctx.Fill ();
            ctx.Restore ();

            ctx.Rectangle (0, 0, Bounds.Width, 30);
            ctx.SetColor (new Color (1, 0, 0, 0.5));
            ctx.Fill ();
        }
开发者ID:praveen9947,项目名称:xwt,代码行数:16,代码来源:ScrollWindowSample.cs

示例4: OnDraw

        protected override void OnDraw(Context ctx, Rectangle cellArea)
        {
            ctx.Rectangle (BackgroundBounds);
            ctx.SetColor (new Color (0.9, 0.9, 0.9));
            ctx.Fill ();

            ctx.Rectangle (Bounds);
            ctx.SetColor (new Color (0.7, 0.7, 0.7));
            ctx.Fill ();

            var pct = GetValue (ValueField);
            var size = (cellArea.Width * pct.Value) / 100f;
            cellArea.Width = (int) size;

            ctx.SetLineWidth (1);
            ctx.Rectangle (cellArea.Inflate (-0.5, -0.5));
            ctx.SetColor (Selected ? Colors.Blue : Colors.LightBlue);
            ctx.FillPreserve ();
            ctx.SetColor (Colors.Gray);
            ctx.Stroke ();

            if (pct.YPos != -1) {
                ctx.MoveTo (cellArea.Right, Bounds.Y + pct.YPos);
                ctx.Arc (cellArea.Right, Bounds.Y + pct.YPos, 2.5, 0, 360);
                ctx.SetColor (Colors.Red);
                ctx.Fill ();
            }
        }
开发者ID:KonajuGames,项目名称:xwt,代码行数:28,代码来源:ListView1.cs

示例5: Rectangles

		public virtual void Rectangles (Context ctx, double x, double y)
		{
			ctx.Save ();
			ctx.Translate (x, y);
			
			// Simple rectangles
			
			ctx.SetLineWidth (1);
			ctx.Rectangle (0, 0, 10, 10);
			ctx.SetColor (Colors.Black);
			ctx.Fill ();
			
			ctx.Rectangle (15, 0, 10, 10);
			ctx.SetColor (Colors.Black);
			ctx.Stroke ();
			
			ctx.SetLineWidth (3);
			ctx.Rectangle (0, 15, 10, 10);
			ctx.SetColor (Colors.Black);
			ctx.Fill ();
			
			ctx.Rectangle (15, 15, 10, 10);
			ctx.SetColor (Colors.Black);
			ctx.Stroke ();
			
			ctx.Restore ();
			
			// Rectangle with hole
			ctx.Save ();
			ctx.Translate (x + 50, y);
			
			ctx.Rectangle (0, 0, 40, 40);
			ctx.MoveTo (35, 35);
			ctx.RelLineTo (0, -20);
			ctx.RelLineTo (-20, 0);
			ctx.RelLineTo (0, 20);
			ctx.ClosePath ();
			ctx.SetColor (Colors.Black);
			ctx.Fill ();
			
			ctx.Restore ();
			
			// Rounded Rectangle with Arcs
			ctx.Save ();
			ctx.Translate (x + 120, y);
			
			var r = 5;
			var l = 0;
			var t = 0;
			var w = 50;
			var h = 30;

			ctx.SetColor (Colors.Black);
			// top left  
			ctx.Arc (l + r, t + r, r, 180, 270);
			// top right 
			ctx.Arc (l + w - r, t + r, r, 270, 0);
			// bottom right  
			ctx.Arc (l + w - r, t + h - r, r, 0, 90);
			// bottom left 
			ctx.Arc (l + r, t + h - r, r, 90, 180);
			
			ctx.ClosePath ();
			ctx.StrokePreserve ();
			ctx.SetColor (Colors.AntiqueWhite);
			ctx.Fill ();
			ctx.Restore ();
		}
开发者ID:m13253,项目名称:xwt,代码行数:68,代码来源:DrawingFigures.cs

示例6: Draw

			void Draw (Context ctx, bool fill)
			{
				var parent = (RoundedFrameBox)Parent;
				var border = parent.BorderSpacing;
				var radius = parent.cornerRadius;
				var rect = Bounds;

				ctx.MoveTo (rect.X, rect.Y);



				if (border.Top > 0) {
					ctx.NewPath ();
					if (radius.TopLeft > 0)
						ctx.Arc (rect.Left + radius.TopLeft + border.Left / 2, rect.Top + radius.TopLeft + border.Top / 2, radius.TopLeft, 180, 270);
					else
						PathTo (ctx, rect.Left, rect.Top + border.Top / 2, fill);

					if (radius.TopRight > 0) {
						ctx.LineTo (rect.Right - (radius.TopRight + border.Right / 2), rect.Top + border.Top / 2);
						ctx.Arc (rect.Right - (radius.TopRight + border.Right / 2), rect.Top + radius.TopRight + border.Top / 2, radius.TopRight, 270, 0);
					} else
						ctx.LineTo (rect.Right, rect.Top + border.Top / 2);
				} else
					PathTo (ctx, rect.Right - border.Right / 2, rect.Top, fill);

				if (border.Right > 0)
					// TODO: round corners if top/bottom border disabled
					ctx.LineTo (rect.Right - border.Right / 2, rect.Bottom - (border.Bottom > 0 ? radius.BottomRight : 0));
				else
					PathTo (ctx, rect.Right - border.Right / 2, rect.Bottom - (border.Bottom > 0 ? radius.BottomRight : 0), fill);

				if (border.Bottom > 0) {
					if (radius.BottomRight > 0)
						ctx.Arc (rect.Right - (radius.BottomRight + border.Right / 2), rect.Bottom - (radius.BottomRight + border.Bottom / 2), radius.BottomRight, 0, 90);
					else
						PathTo (ctx, rect.Right, rect.Bottom - border.Bottom / 2, fill);

					if (radius.BottomLeft > 0) {
						ctx.LineTo (rect.Left + (radius.BottomLeft + border.Left / 2), rect.Bottom - border.Bottom / 2);
						ctx.Arc (rect.Left + radius.BottomLeft + border.Left / 2, rect.Bottom - (radius.BottomLeft + border.Bottom / 2), radius.BottomLeft, 90, 180);
					} else
						ctx.LineTo (rect.Left + border.Left / 2, rect.Bottom - border.Bottom / 2);
				} else
					PathTo (ctx, rect.Left + border.Left / 2, rect.Bottom - border.Bottom / 2, fill);

				if (border.Left > 0)
					// TODO: round corners if top/bottom border disabled
					ctx.LineTo (rect.Left + border.Left / 2, rect.Top + (border.Top > 0 ? radius.TopLeft : 0));
				else
					PathTo (ctx, rect.Left + border.Left / 2, rect.Top + (border.Top > 0 ? radius.TopLeft : 0), fill);

				if (fill) {
					ctx.SetColor (parent.innerColor);
					ctx.Fill ();
				} else {
					ctx.SetColor (parent.borderColor);
					ctx.SetLineWidth (parent.borderWidth);
					ctx.Stroke ();
				}
			}
开发者ID:kdubau,项目名称:monodevelop,代码行数:61,代码来源:RoundedFrameBox.cs

示例7: OnDraw

        protected override void OnDraw(Context ctx)
        {
            ctx.Translate (-hscroll.Value, -vscroll.Value);
            ctx.Rectangle (new Rectangle (0, 0, imageSize, imageSize));
            ctx.SetColor (Color.White);
            ctx.Fill ();
            ctx.Arc (imageSize / 2, imageSize / 2, imageSize / 2 - 20, 0, 360);
            ctx.SetColor (new Color (0,0,1));
            ctx.Fill ();
            ctx.ResetTransform ();

            ctx.Rectangle (0, 0, Bounds.Width, 30);
            ctx.SetColor (new Color (1, 0, 0, 0.5));
            ctx.Fill ();
        }
开发者ID:joncham,项目名称:xwt,代码行数:15,代码来源:ScrollWindowSample.cs

示例8: OnDraw

        protected override void OnDraw(Context ctx, Rectangle dirtyRect)
        {
            base.OnDraw(ctx, dirtyRect);

            if (image != null) {
                if (Heighlighted && IsThumbnail) {
                    ctx.RoundRectangle(new Rectangle(Point.Zero, image.Size), 3);
                    ctx.SetColor(Colors.LightSteelBlue);
                    ctx.Fill();
                }

                ctx.DrawImage(image, (new Rectangle(Point.Zero, image.Size)).Inflate(-3, -3));

                if (mask != null && ShowMask) {
                    ctx.DrawImage(MaskBitmap, (new Rectangle(Point.Zero, image.Size)).Inflate(-3, -3), 0.6);
                }
            }

            if (isEditMode) {
                Point scaleFactor = new Point(
                                        scan.Size.Width / image.Size.Width,
                                        scan.Size.Height / image.Size.Height);
                ctx.SetColor(Mask.maskColor);

                foreach (MaskEntry p in scan.Mask.MaskPositions) {
                    switch (p.type) {
                    case MaskEntryType.Point:
                        ctx.SetLineWidth(p.pointerSize / scaleFactor.Y * 2);
                        ctx.LineTo(p.position.X / scaleFactor.X, p.position.Y / scaleFactor.Y);
                        ctx.Stroke();

                        ctx.Arc(
                            p.position.X / scaleFactor.X, p.position.Y / scaleFactor.Y,
                            p.pointerSize / scaleFactor.Y, 0, 360);
                        ctx.Fill();

                        ctx.MoveTo(p.position.X / scaleFactor.X, p.position.Y / scaleFactor.Y);
                        break;
                    case MaskEntryType.Space:
                        ctx.Stroke();
                        ctx.ClosePath();
                        break;
                    case MaskEntryType.Delete:
                        ctx.Arc(
                            p.position.X / scaleFactor.X, p.position.Y / scaleFactor.Y,
                            p.pointerSize / scaleFactor.Y, 0, 360);
                        ctx.Save();
                        ctx.Clip();
                        int newX = (int) Math.Min(Math.Max(
                                       p.position.X / scaleFactor.X - pointerSize / scaleFactor.Y, 0), scan.Size.Width);
                        int newY = (int) Math.Min(Math.Max(
                                       p.position.Y / scaleFactor.Y - pointerSize / scaleFactor.Y, 0), scan.Size.Height);

                        using (ImageBuilder ib =
                                   new ImageBuilder((pointerSize / scaleFactor.Y * 2), (pointerSize / scaleFactor.Y * 2))) {
                            BitmapImage bi = ib.ToBitmap();
                            image.WithBoxSize(image.Size).ToBitmap().CopyArea(
                                newX, newY,
                                (int) (pointerSize / scaleFactor.Y * 2), (int) (pointerSize / scaleFactor.Y * 2),
                                bi, 0, 0);
                            ctx.DrawImage(bi, new Point(newX, newY));
                        }
                        ctx.Restore();
                        ctx.ClosePath();
                        break;
                    }
                }

                ctx.Stroke();

                if (mousePosition != Point.Zero) {
                    ctx.Arc(mousePosition.X, mousePosition.Y, pointerSize / Math.Max(scaleFactor.X, scaleFactor.Y), 0, 360);
                    ctx.Fill();

                    if (mousePositionStart != Point.Zero) {
                        ctx.SetLineWidth((pointerSize / Math.Max(scaleFactor.X, scaleFactor.Y)) * 2);
                        ctx.SetColor(Mask.maskColor);
                        ctx.Arc(mousePositionStart.X, mousePositionStart.Y, pointerSize / Math.Max(scaleFactor.X, scaleFactor.Y), 0, 360);
                        ctx.Fill();
                        ctx.MoveTo(mousePosition);
                        ctx.LineTo(mousePositionStart);
                        ctx.Stroke();
                    }
                }
            }
        }
开发者ID:jfreax,项目名称:BAIMP,代码行数:86,代码来源:ScanView.cs

示例9: DrawFocus

 void DrawFocus(Context ctx, Point p)
 {
     // Draw a 'zoom'-style Focus at specified point
     double focusRadius = 32;
     double r = 12, w = focusRadius - 1;
     Point o = Point.Zero;	// Drawing origin
     // Align single-thickness lines on 0.5 pixel coords
     o.X += 0.5;
     o.Y += 0.5;
     ctx.Save ();
     ctx.Translate (p);	// Final translation
     // Hairlines in X-direction
     ctx.MoveTo (o.X + r, o.Y);
     ctx.LineTo (o.X + w, o.Y);
     ctx.MoveTo (o.X - r, o.Y);
     ctx.LineTo (o.X - w, o.Y);
     // Hairlines in Y-direction
     ctx.MoveTo (o.X, o.Y + r);
     ctx.LineTo (o.X, o.Y + w);
     ctx.MoveTo (o.X, o.Y - r);
     ctx.LineTo (o.X, o.Y - w);
     // Inner single-thickness circle
     ctx.MoveTo (o.X + r, o.Y);
     ctx.Arc (o.X, o.Y, r, 0, 360);
     ctx.SetColor (Colors.Black);
     ctx.SetLineWidth (1);
     ctx.Stroke ();
     // Double thickness outer arcs. Draw at (0,0) and rotate
     o = Point.Zero;
     r = 22;
     ctx.Rotate (5);
     ctx.MoveTo (r, 0);
     ctx.Arc (o.X, o.Y, r, 0, 80);
     ctx.MoveTo (o.X, r);
     ctx.Arc (o.X, o.Y, r, 90, 170);
     ctx.MoveTo (-r, o.Y);
     ctx.Arc (o.X, o.Y, r, 180, 260);
     ctx.MoveTo (o.X, -r);
     ctx.Arc (o.X, o.Y, r, 270, 350);
     ctx.SetLineWidth (2);
     ctx.Stroke ();
     ctx.Restore ();
 }
开发者ID:hwthomas,项目名称:XwPlot,代码行数:43,代码来源:PlotZoom.cs

示例10: Draw

        /// <summary>
        /// Draws the marker at the given position
        /// </summary>
        /// <param name="ctx">The Drawing Context with which to draw.</param>
        /// <param name="x">The [physical] x position to draw the marker.</param>
        /// <param name="y">The [physical] y position to draw the marker.</param>
        public void Draw(Context ctx, double x, double y )
        {
            ctx.Save ();
            ctx.SetLineWidth (lineWidth);
            ctx.SetColor (lineColor);

            switch (markerType) {
            case MarkerType.Cross1:
                ctx.MoveTo (x-h, y+h);
                ctx.LineTo (x+h, y-h);
                ctx.MoveTo (x+h, y+h);
                ctx.LineTo (x-h, y-h);
                ctx.Stroke ();
                break;

            case MarkerType.Cross2:
                ctx.MoveTo (x, y-h);
                ctx.LineTo (x, y+h);
                ctx.MoveTo (x-h, y);
                ctx.LineTo (x+h, y);
                ctx.Stroke ();
                break;

            case MarkerType.Circle:
                ctx.MoveTo (x+h,y);
                ctx.Arc (x, y, h, 0, 360);
                ctx.ClosePath ();
                if (filled ) {
                    ctx.SetColor (fillColor);
                    ctx.FillPreserve ();
                }
                ctx.SetColor (lineColor);
                ctx.Stroke ();
                break;

            case MarkerType.Square:
                ctx.Rectangle (x-h, y-h, size, size);
                ctx.ClosePath ();
                if (filled) {
                    ctx.SetColor (fillColor);
                    ctx.FillPreserve ();
                }
                ctx.SetColor (lineColor);
                ctx.Stroke ();
                break;

            case MarkerType.Triangle:
                ctx.MoveTo (x-h, y+h);
                ctx.LineTo (x, y-h);
                ctx.LineTo (x+h, y+h);
                ctx.ClosePath ();
                if (filled) {
                    ctx.SetColor (fillColor);
                    ctx.FillPreserve ();
                }
                ctx.SetColor (lineColor);
                ctx.Stroke ();
                break;

            case MarkerType.TriangleDown:
                ctx.MoveTo (x-h, y-h);
                ctx.LineTo (x, y+h);
                ctx.LineTo (x+h, y-h);
                ctx.ClosePath ();
                if (filled) {
                    ctx.SetColor (fillColor);
                    ctx.FillPreserve ();
                }
                ctx.SetColor (lineColor);
                ctx.Stroke ();
                break;

            case MarkerType.FilledCircle:
                ctx.MoveTo (x+h,y);
                ctx.Arc (x, y, h, 0, 360);
                ctx.ClosePath ();
                ctx.SetColor (fillColor);
                ctx.FillPreserve ();
                ctx.SetColor (lineColor);
                ctx.Stroke ();
                break;

            case MarkerType.FilledSquare:
                ctx.Rectangle (x-h, y-h, size, size);
                ctx.ClosePath ();
                ctx.SetColor (fillColor);
                ctx.FillPreserve ();
                ctx.SetColor (lineColor);
                ctx.Stroke ();
                break;

            case MarkerType.FilledTriangle:
                ctx.MoveTo (x-h, y+h);
                ctx.LineTo (x, y-h);
//.........这里部分代码省略.........
开发者ID:hwthomas,项目名称:XwPlot,代码行数:101,代码来源:Marker.cs

示例11: DrawFocus

        void DrawFocus( Context ctx, double x, double y )
        {
            if (!cursorVisible)
                return;

            double r = 16;

            ctx.Save ();

            x += 0.5;
            y += 0.5;

            ctx.SetLineWidth (3);
            ctx.SetColor (new Color (0, 0, 0, 0.5));
            ctx.Arc (x, y, r, 0, 360);
            ctx.Stroke ();

            ctx.SetLineWidth (1);

            ctx.MoveTo (x+r, y);
            ctx.RelLineTo (r, 0);
            ctx.MoveTo (x-r, y);
            ctx.RelLineTo (-r, 0);

            ctx.MoveTo (x, y+r);
            ctx.RelLineTo (0, r);
            ctx.MoveTo (x, y-r);
            ctx.RelLineTo (0, -r);
            ctx.Stroke ();

            r += 10;
            ctx.Arc (x, y, r, 10, 80);
            ctx.Stroke ();
            ctx.Arc (x, y, r, 100, 170);
            ctx.Stroke ();
            ctx.Arc (x, y, r, 190, 260);
            ctx.Stroke ();
            ctx.Arc (x, y, r, 280, 350);
            ctx.Stroke ();

            ctx.Restore ();
        }
开发者ID:hwthomas,项目名称:controlsuite,代码行数:42,代码来源:SimplePlotCanvas.cs

示例12: Draw

        /// <summary>
        /// Draw the marker.
        /// </summary>
        /// <param name="ctx">Context.</param>
        public override void Draw(Context ctx)
        {
            ctx.SetColor(PipelineNode.NodeColorBorder);

            Rectangle bndTmp = Bounds;

            ctx.RoundRectangle(bndTmp.Inflate(-2, -2), 2);
            if (compatible.IsFinal()) {
                ctx.SetColor(Colors.LightGray);
            } else {
                ctx.RoundRectangle(bndTmp.Inflate(-1, -1), 3);
                using (LinearGradient g = new LinearGradient(bndTmp.Left, bndTmp.Top, bndTmp.Right, bndTmp.Bottom)) {
                    g.AddColorStop(0, Colors.Black.BlendWith(NodeColor, 0.7));
                    g.AddColorStop(1, NodeColor);
                    ctx.Pattern = g;
                    ctx.Fill();
                }

                ctx.SetColor(NodeColor);
            }
            ctx.Fill();

            if (IsInput) {
                int inputBufferSize = inputData.Count;
                List<Result> ihCopy;
                lock (inputHistoryLock) {
                    ihCopy = new List<Result>(inputHistory);
                }
                foreach (Result input in ihCopy) {
                    if (input.IsUsed(parent)) {
                        inputBufferSize++;
                    } else {
                        lock (inputHistoryLock) {
                            inputHistory.Remove(input);
                        }
                    }
                }
                if (inputBufferSize > 0) {
                    bool sourceNodeIsAbove = true;
                    if (edges.Count > 0 && edges[0] != null) {
                        if (edges[0].to.Bounds.Center.Y > Bounds.Center.Y - 4.0) {
                            sourceNodeIsAbove = false;
                        }
                    }

                    textLayout.Text = inputBufferSize.ToString();
                    double textWidth = textLayout.GetSize().Width;
                    double textHeight = textLayout.GetSize().Height;
                    Point inputbufferSizeLocation =
                        Bounds.Location.Offset(
                            -24 -(textWidth/2),
                            sourceNodeIsAbove ? textHeight + 6 : -6 - textHeight);

                    ctx.Arc(
                        inputbufferSizeLocation.X + textWidth / 2,
                        inputbufferSizeLocation.Y + textHeight / 2,
                        Math.Max(textHeight, textWidth) / 2 + 1,
                        0, 360
                    );
                    ctx.Fill();

                    ctx.SetColor(PipelineNode.NodeColor);
                    ctx.DrawTextLayout(textLayout, inputbufferSizeLocation);
                }
            } else {
                // if this is a final node
                if (parent.algorithm.Output[positionNo].IsFinal()) {
                    ctx.MoveTo(bndTmp.Right + 4, bndTmp.Top);
                    ctx.LineTo(bndTmp.Right + 4, bndTmp.Bottom);
                    ctx.Stroke();

                    // draw output size on end nodes (= number of features
                    if (parent.results != null &&
                        parent.results.Count > 0 &&
                        parent.results[0].Item1 != null &&
                        parent.results[0].Item1.Length - 1 >= Position) {

                        textLayout.Text = parent.results.Count.ToString();
                        double textWidth = textLayout.GetSize().Width;
                        double textHeight = textLayout.GetSize().Height;
                        Point outputbufferSizeLocation =
                            Bounds.Location.Offset(Bounds.Width * 1.8, 0);

                        ctx.Arc(
                            outputbufferSizeLocation.X + textWidth / 2,
                            outputbufferSizeLocation.Y + textHeight / 2,
                            Math.Max(textHeight, textWidth) / 2 + 1,
                            0, 360
                        );
                        ctx.Fill();

                        ctx.SetColor(PipelineNode.NodeColor);
                        ctx.DrawTextLayout(textLayout, outputbufferSizeLocation);
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:jfreax,项目名称:BAIMP,代码行数:101,代码来源:MarkerNode.cs

示例13: DrawFocus

        void DrawFocus(Context ctx, Point p)
        {
            // Draw a 'zoom'-style Focus at specified point.
            // Following values draw at (0,0) with Size (64,64)
            double r1 = 12, r2 = 22, w = 31;
            Point o = Point.Zero;	// Drawing origin
            // Align single-thickness lines on 0.5 pixel coords
            o.X += 0.5;
            o.Y += 0.5;

            ctx.Save ();
            ctx.SetColor (Colors.Black);
            ctx.SetLineWidth (1);
            ctx.Translate (p);	// Final translation to point p
            // draw as 4 quadrants, each rotated by +90 degrees
            for (double theta = 0; theta < 300; theta += 90) {
                ctx.Rotate (theta);
                // Hairline in X-direction, ending at x=r1
                ctx.MoveTo (o.X + w, o.Y);
                ctx.LineTo (o.X + r1, o.Y);
                // Inner single-thickness arc
                ctx.Arc (o.X, o.Y, r1, 0, 90);
                ctx.Stroke ();
                // Double thickness outer arc, 10 - 80 degrees. Draw at (0,0) and rotate
                ctx.Save ();
                ctx.Rotate (10);
                ctx.MoveTo (r2, 0);
                ctx.Arc (0, 0, r2, 0, 70);
                ctx.SetLineWidth (2);
                ctx.Stroke ();
                ctx.Restore ();
            }
            ctx.Restore ();
        }
开发者ID:hwthomas,项目名称:XwPlot,代码行数:34,代码来源:OverlayTest.cs


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