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


C# CGContext.AddEllipseInRect方法代码示例

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


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

示例1: FillEllipsis

 public static void FillEllipsis(CGContext context, RectangleF rect, CGColor color, float lineWidth)
 {
     context.SaveState();
     context.SetFillColor(color);
     context.AddEllipseInRect(rect);
     context.FillPath();
     context.RestoreState();
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:8,代码来源:CoreGraphicsHelper.cs

示例2: DrawInContext

		public override void DrawInContext (CGContext context)
		{
			base.DrawInContext (context);
			
			context.AddEllipseInRect (Bounds);
			context.SetFillColor (ClockColor);
			context.FillPath ();
		}
开发者ID:Anomalous-Software,项目名称:monomac,代码行数:8,代码来源:ClockLayer.cs

示例3: DrawEllipsis

 public static void DrawEllipsis(CGContext context, RectangleF rect, CGColor color, float lineWidth)
 {
     context.SaveState();
     context.SetStrokeColor(color);
     context.SetLineWidth(lineWidth);
     context.AddEllipseInRect(rect);
     context.StrokePath();
     context.RestoreState();
 }
开发者ID:pascalfr,项目名称:MPfm,代码行数:9,代码来源:CoreGraphicsHelper.cs

示例4: make_arcs

        static void make_arcs(CGContext graphics, float x, float y, float width, float height, float startAngle, float sweepAngle,
			          bool convert_units, bool antialiasing, bool isPieSlice)
        {
            int i;
            float drawn = 0;
            float endAngle;
            bool enough = false;

            // I do not think we need to convert the units so commented this out.

            /* if required deal, once and for all, with unit conversions */
            //if (convert_units && !OPTIMIZE_CONVERSION(graphics))
            //{
            //    x = gdip_unitx_convgr(graphics, x);
            //    y = gdip_unity_convgr(graphics, y);
            //    width = gdip_unitx_convgr(graphics, width);
            //    height = gdip_unity_convgr(graphics, height);
            //}

            if (Math.Abs(sweepAngle) >= 360)
            {
                graphics.AddEllipseInRect(new RectangleF(x,y,width,height));
                return;
            }

            endAngle = startAngle + sweepAngle;
            /* if we end before the start then reverse positions (to keep increment positive) */
            if (endAngle < startAngle)
            {
                var temp = endAngle;
                endAngle = startAngle;
                startAngle = temp;
            }

            if (isPieSlice) {
                graphics.MoveTo(x + (width / 2), y + (height / 2));
            }

            /* i is the number of sub-arcs drawn, each sub-arc can be at most 90 degrees.*/
            /* there can be no more then 4 subarcs, ie. 90 + 90 + 90 + (something less than 90) */
            for (i = 0; i < 4; i++)
            {
                float current = startAngle + drawn;
                float additional;

                if (enough)
                {
                    if (isPieSlice)
                    {
                        graphics.ClosePath();
                    }
                    return;
                }

                additional = endAngle - current; /* otherwise, add the remainder */
                if (additional > 90)
                {
                    additional = 90.0f;
                }
                else
                {
                    /* a near zero value will introduce bad artefact in the drawing (#78999) */
                    if (( additional >= -0.0001f) && (additional <= 0.0001f))
                        return;
                    enough = true;
                }

                make_arc(graphics, (i == 0),	/* only move to the starting pt in the 1st iteration */
                         x, y, width, height,	/* bounding rectangle */
                         current, current + additional, antialiasing, isPieSlice);

                drawn += additional;

            }

            if (isPieSlice) {
                graphics.ClosePath();
            }
        }
开发者ID:asfungithub,项目名称:sysdrawing-coregraphics,代码行数:79,代码来源:Graphics-DrawEllipticalArc.cs


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