本文整理匯總了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;
}
}