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


C# CairoContextEx.DrawEquilateralTriangle方法代码示例

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


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

示例1: DrawFigure

 static void DrawFigure(CairoContextEx gr, double x, double y, Figure figure)
 {
     switch (figure)
     {
         case Figure.Pentagon:
             gr.DrawPentagon (x, y, figure_size);
             break;
         case Figure.Circle:
             gr.Arc (x + figure_size / 2, y + (figure_size / 2), figure_size / 2, 0, 2 * Math.PI);
             break;
         case Figure.Triangle:
             gr.DrawEquilateralTriangle (x, y, figure_size);
             break;
         default:
             throw new InvalidOperationException ("Invalid figure type");
     }
     gr.Stroke ();
 }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:18,代码来源:PuzzleFigures.cs

示例2: DrawFigure

 private static void DrawFigure(CairoContextEx gr, double x, double y, Figures figure)
 {
     switch (figure) {
     case Figures.TriangleA:
         gr.DrawEquilateralTriangle (x, y, figure_size);
         break;
     case Figures.TriangleB:
         gr.MoveTo (x, y);
         gr.LineTo (x, y + figure_size);
         gr.LineTo (x + figure_size, y);
         gr.LineTo (x, y);
         gr.Stroke ();
         break;
     case Figures.TriangleC:
         gr.MoveTo (x, y);
         gr.LineTo (x, y + figure_size);
         gr.LineTo (x + figure_size, y + figure_size);
         gr.LineTo (x, y);
         gr.Stroke ();
         break;
     case Figures.Square:
         gr.Rectangle (x, y, figure_size, figure_size);
         gr.Stroke ();
         break;
     case Figures.LongRectangle:
         gr.Rectangle (x, y + figure_size / 2, figure_size, figure_size / 2);
         gr.Stroke ();
         break;
     case Figures.LongRectangleUp:
         gr.Rectangle (x, y, figure_size, figure_size / 2);
         gr.Stroke ();
         break;
     case Figures.Diamon:
         gr.DrawDiamond (x, y, figure_size);
         break;
     case Figures.TriangleD:
         gr.MoveTo (x, y);
         gr.LineTo (x, y + figure_size * 0.7);
         gr.LineTo (x + figure_size * 0.7, y + figure_size * 0.7);
         gr.LineTo (x, y);
         gr.Stroke ();
         break;
     }
 }
开发者ID:syoubin,项目名称:gbrainy_android,代码行数:44,代码来源:PuzzleBuildTriangle.cs

示例3: Draw

 public override void Draw(CairoContextEx gr, double x, double y, double size)
 {
     gr.DrawEquilateralTriangle ((size - side) / 2, (size - side) / 2, side);
     gr.Stroke ();
 }
开发者ID:GNOME,项目名称:gbrainy,代码行数:5,代码来源:PuzzleLargestArea.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: 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

示例6: 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

示例7: 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


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