本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.DrawDiamond方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.DrawDiamond方法的具体用法?C# CairoContextEx.DrawDiamond怎么用?C# CairoContextEx.DrawDiamond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbrainy.Core.Main.CairoContextEx
的用法示例。
在下文中一共展示了CairoContextEx.DrawDiamond方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: 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;
}
}