本文整理汇总了C#中gbrainy.Core.Main.CairoContextEx.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# CairoContextEx.Fill方法的具体用法?C# CairoContextEx.Fill怎么用?C# CairoContextEx.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbrainy.Core.Main.CairoContextEx
的用法示例。
在下文中一共展示了CairoContextEx.Fill方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawBand
static void DrawBand(CairoContextEx gr, double x, double y)
{
gr.Save ();
gr.Rectangle (x, y, 1 - 0.06, 0.06);
gr.Color = new Cairo.Color (0, 0, 0.2, 0.2);
gr.Fill ();
gr.Restore ();
}
示例2: DrawAnswer
void DrawAnswer(CairoContextEx gr, double x, double y)
{
ColorPalette palette = new ColorPalette (Translations);
gr.Save ();
// A full sized square of paper
gr.Color = palette.Cairo (ColorPalette.Id.Yellow);
gr.Rectangle (x, y, width, height);
gr.Fill ();
gr.Stroke ();
// 3/4 of the whole size square of paper in the bottom right corner
gr.Color = palette.Cairo (ColorPalette.Id.Blue);
double w = 3d/4d * width;
double h = 3d/4d * height;
gr.Rectangle (x + (width - w), y + (height - h), w, h);
gr.Fill ();
gr.Stroke ();
// 3/4 square of paper in the top left corner
gr.Color = palette.Cairo (ColorPalette.Id.Green);
gr.Rectangle (x, y, 3d/4d * width, 3d/4d * height);
gr.Fill ();
gr.Stroke ();
// 1/4 square of paper in the top left corner
gr.Color = palette.Cairo (ColorPalette.Id.Red);
gr.Rectangle (x, y, 1d/4d * width, 1d/4d * height);
gr.Fill ();
gr.Stroke ();
gr.Restore ();
}
示例3: DrawFigure
public void DrawFigure(CairoContextEx gr, double x, double y, bool [] puzzle, int index)
{
double pos_x = x, pos_y = y;
double square_size = figure_size / lines;
double center_square = square_size / 2;
double radius_square = (square_size - (LineWidth *2)) / 2.5;
gr.Rectangle (pos_x, pos_y, figure_size, figure_size);
gr.Stroke ();
for (int line = 0; line < lines - 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 < columns - 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 line = 0; line < lines; line++) // Circles
{
for (int column = 0; column < columns; column++)
{
if (puzzle[index + (columns * line) + column] == false)
continue;
gr.Arc (pos_x + (square_size * column), pos_y, radius_square, 0, 2 * Math.PI);
gr.Fill ();
gr.Stroke ();
}
pos_y += square_size;
}
}
示例4: DrawSolution
void DrawSolution(CairoContextEx cr, int height, double max_width)
{
if (UseSolutionArea == false || String.IsNullOrEmpty (Solution) == true)
return;
double width_str, height_str, x_text, icon_x, icon_w, icon_h, box_height_scaled;
cr.Save ();
cr.LineWidth = 0.001;
icon_w = icon_size * (cr.Matrix.Xx > cr.Matrix.Yy ? cr.Matrix.Yy / cr.Matrix.Xx : 1);
icon_h = icon_size * (cr.Matrix.Yy > cr.Matrix.Xx ? cr.Matrix.Xx / cr.Matrix.Yy : 1);
cr.MeasureString (Solution, max_width - icon_w, true, out width_str, out height_str);
// In case that the string to show is longer than the space reserved (long translations for example)
// allow the box to grow taking part of the lower part of the graphic
box_height_scaled = Math.Max (height_str, (double) solution_high / (double) height);
// Draw black box
cr.Color = new Color (0.1, 0.1, 0.1);
cr.Rectangle (text_margin,
1 - box_height_scaled - text_margin,
max_width,
box_height_scaled);
cr.Fill ();
cr.Stroke ();
// Draw text and icon
cr.Color = new Color (1, 1, 1);
if (Direction == Gtk.TextDirection.Rtl)
{
x_text = 0;
icon_x = max_width - icon_w;
}
else
{
x_text = icon_w + text_margin;
icon_x = 0;
}
cr.DrawStringWithWrapping (x_text,
(1 - box_height_scaled - text_margin) + ((box_height_scaled - height_str) / 2),
Solution, max_width - icon_w);
cr.Stroke ();
DrawSolutionIcon (cr, icon_x,
(1 - box_height_scaled - text_margin) + ((box_height_scaled - icon_h) / 2),
icon_w, icon_h);
cr.Restore ();
}
示例5: DrawAndConnectPoints
private static void DrawAndConnectPoints(CairoContextEx gr, double x, double y, Circle[] circles, bool connect)
{
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 ();
}
if (connect == false)
return;
gr.Save ();
gr.LineWidth = 0.003;
double offset = point_size;
for (int from = 0; from < circles.Length; from++) {
for (int to = 0; to < circles.Length; to++) {
gr.MoveTo (x + circles[from].x+ offset, y + circles[from].y + offset);
gr.LineTo (x + circles[to].x + offset, y + circles[to].y + offset);
gr.Stroke ();
}
}
gr.Restore ();
}
示例6: 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"));
}