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


C# CairoContextEx.Arc方法代码示例

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


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

示例1: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x = DrawAreaX + 0.1, y = DrawAreaY + 0.05;

            base.Draw (gr, area_width, area_height, rtl);

            for (int i = 0; i < circles.Length; i++)
            {
                gr.Arc (x + circles[i].x + 0.1, y + circles[i].y + 0.1, circles[i].rad, 0, 2 * Math.PI);
                gr.Stroke ();
            }
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:12,代码来源:PuzzleCountCircles.cs

示例2: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x = DrawAreaX + 0.22, y = DrawAreaY + 0.2;
            double pos_x = x;
            double pos_y = y;
            Circle[] circles = null;

            base.Draw (gr, area_width, area_height, rtl);

            circles =  new Circle [] {
                new Circle (0.01, 0.06),
                new Circle (0.27, 0.06),
                new Circle (0.01, 0.21),
                new Circle (0.27, 0.21),
                new Circle (0.14, 0),
                new Circle (0.14, 0.29)
            };

            // Circle
            gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
            gr.Stroke ();

            const double point_size = 0.01;
            for (int i = 0; i < circles.Length; i++) {
                gr.Arc (x + point_size + circles[i].x, y + point_size + circles[i].y, point_size, 0, 2 * Math.PI);
                gr.Fill ();
                gr.Stroke ();
            }

            gr.MoveTo (x + circles[2].x + 0.01, y + circles[2].y + 0.01);
            gr.LineTo (x + circles[1].x + 0.01, y + circles[1].y + 0.01);
            gr.Stroke ();

            gr.DrawTextCentered (pos_x + figure_size, pos_y + 0.08 + figure_size * 2,
                ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Two people in the table sitting across each other"));
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:36,代码来源:PuzzlePeopleTable.cs

示例3: DrawSlice

        static void DrawSlice(CairoContextEx gr, double x, double y, double dg, Color color)
        {
            double x1, y1, smallest_x, smallest_y, degrees;

            smallest_x = x;
            smallest_y = y;
            degrees = radian * (60 + dg);
            gr.MoveTo (x, y);
            x1 = x + radius * Math.Cos (degrees);
            y1 = y + radius * Math.Sin (degrees);
            gr.LineTo (x1, y1);
            if (x1 < smallest_x) smallest_x = x1;
            if (y1 < smallest_y) smallest_y = y1;

            degrees = dg * radian;
            gr.MoveTo (x, y);
            x1 = x + radius * Math.Cos (degrees);
            y1 = y + radius * Math.Sin (degrees);
            gr.LineTo (x1, y1);
            if (x1 < smallest_x) smallest_x = x1;
            if (y1 < smallest_y) smallest_y = y1;

            gr.Arc (x, y, radius, dg * radian, radian * (60 + dg));
            gr.FillGradient (smallest_x, smallest_y, radius, radius, color);
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:26,代码来源:PuzzleExtraCircle.cs

示例4: DrawBalance

        public void DrawBalance(CairoContextEx gr, double x, double y, int index, bool full)
        {
            const double width = 0.5;
            double fig_x = x + 0.1, fig_y = y - 0.11;
            int total = (full == true) ? (elements * 2) : elements;

            gr.Rectangle (x + 0.05, y - 0.12, 0.38, 0.08);
            gr.Stroke ();

            gr.Rectangle (x + 0.5, y - 0.12, 0.38, 0.08);
            gr.Stroke ();

            for (int i = 0; i < total; i++) {
                switch (balances[i + index]) {
                case 1:
                    gr.DrawEquilateralTriangle (fig_x, fig_y, 0.05);
                    break;
                case 2:
                    gr.Arc (fig_x + (0.05 / 2), fig_y + (0.05 / 2) + 0.003, (0.05 / 2), 0, 2 * Math.PI);
                    gr.Stroke ();
                    break;
                case 3:
                    gr.Rectangle (fig_x, fig_y + 0.005, 0.045, 0.045);
                    gr.Stroke ();
                    break;
                }

                if (i == elements - 1)
                    fig_x = x + 0.54;
                else
                    fig_x += 0.07;
            }

            x += 0.2;
            y += 0.01;
            gr.MoveTo (x, y);
            gr.LineTo (x + width, y);
            gr.LineTo (x + width, y - 0.05);
            gr.Stroke ();

            gr.MoveTo (x , y);
            gr.LineTo (x , y - 0.05);
            gr.Stroke ();

            gr.DrawEquilateralTriangle (x + (width / 2) - 0.04, y, 0.08);
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:47,代码来源:PuzzleBalance.cs

示例5: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x = DrawAreaX + 0.05, y = DrawAreaY;
            double pos_x = x;
            double pos_y = y;
            Circle[] circles = null;

            base.Draw (gr, area_width, area_height, rtl);

            // First circle
            gr.Arc (pos_x + figure_size, y + figure_size, figure_size, 0, 2 * Math.PI);
            gr.Stroke ();
            DrawAndConnectPoints (gr, pos_x, pos_y,
                new Circle [] {
                    new Circle (0.14, 0),
                    new Circle (0.14, 0.29),
                }, true);

            gr.MoveTo (pos_x, pos_y + figure_size * 2 + 0.05);
            gr.ShowPangoText (HasNRegionString (2));
            gr.Stroke ();

            // Second circle
            pos_x += 0.4;
            gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
            gr.Stroke ();
            DrawAndConnectPoints (gr, pos_x, pos_y,
                new Circle [] {
                    new Circle (0.01, 0.06),
                    new Circle (0.27, 0.06),
                    new Circle (0.14, 0.29),
                }, true);

            gr.MoveTo (pos_x, pos_y + figure_size * 2 + 0.05);
            gr.ShowPangoText (HasNRegionString (4));
            gr.Stroke ();

            // Third circle
            pos_x = x;
            pos_y += 0.45;
            gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
            gr.Stroke ();
            DrawAndConnectPoints (gr, pos_x, pos_y,
                new Circle [] {
                    new Circle (0.01, 0.06),
                    new Circle (0.27, 0.06),
                    new Circle (0.01, 0.21),
                    new Circle (0.27, 0.21),
                }, true);

            gr.MoveTo (pos_x, pos_y + figure_size * 2 + 0.05);
            gr.ShowPangoText (HasNRegionString (8));
            gr.Stroke ();

            switch (dots) {
            case 5:
                circles =  new Circle [] {
                    new Circle (0.01, 0.06),
                    new Circle (0.27, 0.06),
                    new Circle (0.01, 0.21),
                    new Circle (0.27, 0.21),
                    new Circle (0.14, 0),
                };
                break;
            case 6:
                circles =  new Circle [] {
                    new Circle (0.01, 0.06),
                    new Circle (0.27, 0.06),
                    new Circle (0.01, 0.21),
                    new Circle (0.27, 0.21),
                    new Circle (0.14, 0),
                    new Circle (0.14, 0.29)
                };
                break;
            }

            // Forth circle
            pos_x += 0.4;
            gr.Arc (pos_x + figure_size, pos_y + figure_size, figure_size, 0, 2 * Math.PI);
            gr.Stroke ();
            DrawAndConnectPoints (gr, pos_x, pos_y, circles, Answer.Draw);
        }
开发者ID:dineshkummarc,项目名称:gbrainy,代码行数:82,代码来源:PuzzleDivideCircle.cs

示例6: DrawCircle

        static void DrawCircle(CairoContextEx gr, double x, double y, Color[] colors, int color_indice)
        {
            double dg;
            gr.Arc (x, y, radius, 0, 2 * Math.PI);
            gr.Stroke ();

            gr.Save ();
            for (int slice = 0; slice < total_slices; slice++)
            {
                dg = slice * (360 / total_slices);
                DrawSlice (gr, x, y, dg, colors [color_indice]);

                color_indice++;
                if (color_indice >= colors.Length)
                    color_indice = 0;

            }
            gr.Restore ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:19,代码来源:PuzzleExtraCircle.cs

示例7: DrawSlice

        private static void DrawSlice(CairoContextEx gr, double x, double y)
        {
            double degrees, x1, y1;

            degrees = 0;
            gr.MoveTo (x, y);
            x1 = x + radius * Math.Cos (degrees);
            y1 = y + radius * Math.Sin (degrees);
            gr.LineTo (x1, y1);
            gr.Stroke ();

            degrees = radian * 60;
            gr.MoveTo (x, y);
            x1 = x + radius * Math.Cos (degrees);
            y1 = y + radius * Math.Sin (degrees);
            gr.LineTo (x1, y1);
            gr.Stroke ();

            gr.Arc (x, y, radius, 0, radian * 60);
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:21,代码来源:PuzzleMissingSlice.cs

示例8: DrawFigure

        private void DrawFigure(CairoContextEx gr, double x, double y, FigureType fig)
        {
            double space_x, space_y;

            space_x = (rect_w - figure_size) / 2;
            space_y = (rect_h - figure_size) / 2;

            switch (fig) {
            case FigureType.Triangle:
                gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
                break;
            case FigureType.Rectangle:
                gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
                gr.Stroke ();
                break;
            case FigureType.Diamond:
                gr.DrawDiamond (x + space_x, y + space_y, figure_size);
                break;
            case FigureType.Cercle:
                gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
                gr.Stroke ();
                break;
            case FigureType.TriangleWithLine:
                gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
                gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
                gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
                gr.Stroke ();
                break;
            case FigureType.RectangleWithLine:
                gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
                gr.MoveTo (x + space_x, y + space_y);
                gr.LineTo (x + space_x + figure_size, y + space_y + figure_size);
                gr.MoveTo (x + space_x + figure_size, y + space_y);
                gr.LineTo (x + space_x, y + space_y + figure_size);
                gr.Stroke ();
                break;
            case FigureType.DiamondWithLine:
                gr.DrawDiamond (x + space_x, y + space_y, figure_size);
                gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
                gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
                gr.Stroke ();
                break;
            case FigureType.CercleWithLine:
                gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
                gr.Stroke ();
                gr.MoveTo (x + space_x + figure_size / 2, y + space_y);
                gr.LineTo (x + space_x + figure_size / 2, y + space_y + figure_size);
                gr.Stroke ();
                break;
            }
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:51,代码来源:MemoryFigures.cs

示例9: Draw

 public override void Draw(CairoContextEx gr, double x, double y, double size)
 {
     gr.Arc (size / 2, size / 2, radius, 0, 2 * Math.PI);
     gr.Stroke();
 }
开发者ID:GNOME,项目名称:gbrainy,代码行数:5,代码来源:PuzzleLargestArea.cs

示例10: DrawBalance

        public void DrawBalance(CairoContextEx gr, double x, double y, int index, bool full)
        {
            const double width = 0.5;
            double fig_x = x + 0.1, fig_y = y - 0.08;
            int total = (full == true) ? (elements * 2) : elements;

            for (int i = 0; i < total; i++) {
                switch (balances[i + index]) {
                case 1:
                    gr.DrawEquilateralTriangle (fig_x, fig_y, 0.05);
                    break;
                case 2:
                    gr.Arc (fig_x + (0.05 / 2), fig_y + (0.05 / 2) + 0.003, (0.05 / 2), 0, 2 * Math.PI);
                    gr.Stroke ();
                    break;
                case 3:
                    gr.Rectangle (fig_x, fig_y + 0.005, 0.045, 0.045);
                    gr.Stroke ();
                    break;
                }

                if (i == elements - 1)
                    fig_x = x + 0.54;
                else
                    fig_x += 0.07;
            }

            gr.DrawImageFromAssembly ("balance.svg", x + 0.02, y - 0.08, 0.9, 0.25);
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:29,代码来源:PuzzleBalance.cs

示例11: DrawObject

        private void DrawObject(CairoContextEx gr, int area_width, int area_height)
        {
            palette.Alpha = alpha;
            double x = DrawAreaX + 0.15, y = DrawAreaY + 0.1;

            gr.Color = palette.Cairo (ColorPalette.Id.Black);
            double pos_x = x, pos_y = y;
            const double figure_size = 0.6;
            const double square_size = figure_size / NUMCOLUMNS ;
            const double center_square = square_size / 2;
            double radius_square = .8 * (square_size - (LineWidth *2)) / 2;

            gr.Rectangle (pos_x, pos_y, figure_size, figure_size);
            gr.Stroke ();

            for (int line = 0; line < NUMCOLUMNS - 1; line++) // Horizontal
            {
                pos_y += square_size;
                gr.MoveTo (pos_x, pos_y);
                gr.LineTo (pos_x + figure_size, pos_y);
                gr.Stroke ();
            }

            pos_y = y;
            for (int column = 0; column < NUMCOLUMNS - 1; column++) // Vertical
            {
                pos_x += square_size;
                gr.MoveTo (pos_x, pos_y);
                gr.LineTo (pos_x, pos_y + figure_size);
                gr.Stroke ();
            }

            pos_y = y + center_square;
            pos_x = x + center_square;

            for (int i = 0,itcolor=0; i < MAXDOTS && itcolor<palette.Count; i++)
            {
                int dx,dy;
                Color color = palette.Cairo(itcolor);
                dx = (location_order[i]) % NUMCOLUMNS;
                dy = (location_order[i]) / NUMCOLUMNS;

                gr.Arc (pos_x+square_size*dx, pos_y+square_size*dy,radius_square,0,2*Math.PI);
                gr.FillGradient (pos_x+square_size*dx, pos_y+square_size*dy, radius_square, radius_square, color);

                if (i==dotsPerColor[itcolor]) itcolor++;
            }
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:48,代码来源:MemoryCountDots.cs

示例12: DrawFigure

        private void DrawFigure(CairoContextEx gr, double x, double y, FigureElement[] figure)
        {
            const double cercle_size = 0.15;
            gr.Stroke ();
            gr.Arc (x + cercle_size / 2, y + cercle_size / 2, cercle_size / 2, 0, 2 * Math.PI);
            gr.Stroke ();

            for (int i = 0; i < figure.Length; i++)
                DrawFigureElement (gr, x, y,  figure[i]);

            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:12,代码来源:PuzzleMostInCommon.cs

示例13: DrawFigure

        void DrawFigure(CairoContextEx gr, double x, double y, FigureType type)
        {
            double space_x, space_y;

            space_x = (rect_w - figure_size) / 2;
            space_y = (rect_h - figure_size) / 2;

            switch (type) {
            case FigureType.Triangle:
                gr.DrawEquilateralTriangle (x + space_x, y + space_y, figure_size);
                break;
            case FigureType.Square:
                gr.Rectangle (x + space_x, y + space_y, figure_size, figure_size);
                gr.Stroke ();
                break;
            case FigureType.Pentagon:
                gr.DrawPentagon (x + space_x, y + space_y, figure_size);
                break;
            case FigureType.Circle:
                gr.Arc (x + space_x + figure_size / 2, y + space_y + figure_size / 2, figure_size / 2, 0, 2 * Math.PI);
                gr.Stroke ();
                break;
            default:
                throw new InvalidOperationException ();
            }
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:26,代码来源:MemoryFiguresAndText.cs

示例14: DrawClock

        static void DrawClock(CairoContextEx gr, double x, double y, int hand_short, int hand_large, bool draw_large)
        {
            const double radius = figure_size / 2;
            double x0, y0;
            int num, degrees;

            gr.Arc (x, y, radius, 0, 2 * Math.PI);
            gr.Stroke ();
            for (degrees = 0; degrees < 360; degrees+= 30) {
                x0 = radius * Math.Cos (degrees * radian);
                y0 = radius * Math.Sin (degrees * radian);
                 // Small lines
                gr.MoveTo (x + 0.9 * x0, y + 0.9 * y0);
                gr.LineTo (x + x0, y + y0);
                gr.Stroke ();
                // Numbers
                num = (degrees / 30) + 3;
                if (num > 12) num = num - 12;

                gr.DrawTextCentered (x + x0 * 0.75,  y + y0 * 0.75, num.ToString ());
                gr.Stroke ();
            }

            if (draw_large) {
                // Hand Large
                degrees = (hand_large - 3) * 30;
                x0 = radius * Math.Cos (degrees * radian);
                y0 = radius * Math.Sin (degrees * radian);
                gr.MoveTo (x, y);
                gr.LineTo (x + x0 * 0.55, y + y0 * 0.55);
                gr.Stroke ();
            }
            // Hand Short
            degrees = (hand_short - 3) * 30;
            x0 = radius * Math.Cos (degrees * radian);
            y0 = radius * Math.Sin (degrees * radian);
            gr.MoveTo (x, y);
            gr.LineTo (x + x0 * 0.4, y + y0 * 0.4);
            gr.Stroke ();
        }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:40,代码来源:PuzzleClocks.cs

示例15: Draw

        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double first_x, x, y;
            double figure_size = 0.07 + (0.01 * (5 - lines));
            double margin = 0;

            base.Draw (gr, area_width, area_height, rtl);

            // Figure 1
            margin = ((1.0 - (figure_size * lines * 2)) / 2);

            x = first_x = margin + (figure_size * lines / 2) + figure_size / 2;
            y = DrawAreaY + 0.2;
            for (int line = 0; line < lines + 1; line++)
            {
                for (int circles = 0; circles < line; circles++)
                {
                    gr.Arc (x, y, figure_size / 2, 0, 2 * Math.PI);
                    gr.Stroke ();
                    x += figure_size;
                }
                x = first_x = first_x - (figure_size / 2);
                y += figure_size;
            }

            // Figure 2
            first_x = margin + (figure_size * lines);
            y = DrawAreaY + 0.2 + figure_size;
            for (int line = 0; line < lines; line++)
            {
                x = first_x = first_x + (figure_size / 2);
                for (int circles = 0; circles < lines - line; circles++)
                {
                    gr.Arc (x, y, figure_size / 2, 0, 2 * Math.PI);
                    gr.Stroke ();
                    x += figure_size;
                }
                y += figure_size;
            }
        }
开发者ID:GNOME,项目名称:gbrainy,代码行数:40,代码来源:PuzzleMoveFigure.cs


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