本文整理汇总了C#中Cairo.Stroke方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Stroke方法的具体用法?C# Cairo.Stroke怎么用?C# Cairo.Stroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.Stroke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
static void draw (Cairo.Context gr, int width, int height)
{
double x=0.1, y=0.5;
double x1=0.4, y1=0.9, x2=0.6, y2=0.1, x3=0.9, y3=0.5;
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.MoveTo ( new PointD (x, y) );
gr.CurveTo ( new PointD (x1, y1),
new PointD (x2, y2),
new PointD (x3, y3)
);
gr.Stroke ();
gr.Color = new Color (1, 0.2, 0.2, 0.6);
gr.LineWidth = 0.03;
gr.MoveTo ( new PointD (x, y) );
gr.LineTo ( new PointD (x1, y1) );
gr.MoveTo ( new PointD (x2, y2) );
gr.LineTo ( new PointD (x3, y3) );
gr.Stroke ();
}
示例2: draw
static void draw (Cairo.Context gr, int width, int height)
{
double xc = 0.5;
double yc = 0.5;
double radius = 0.4;
double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */
double angle2 = 180.0 * (M_PI/180.0); /* in radians */
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.ArcNegative (xc, yc, radius, angle1, angle2);
gr.Stroke ();
/* draw helping lines */
gr.Color = new Color(1, 0.2, 0.2, 0.6);
gr.Arc (xc, yc, 0.05, 0, 2*M_PI);
gr.Fill ();
gr.LineWidth = 0.03;
gr.Arc (xc, yc, radius, angle1, angle1);
gr.LineTo (new PointD(xc, yc));
gr.Arc (xc, yc, radius, angle2, angle2);
gr.LineTo (new PointD(xc, yc));
gr.Stroke ();
}
示例3: DrawFrame
protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
{
// base.DrawFrame (context, lineWidth, lineColor, fillColor);
rect = DisplayBox;
rect.OffsetDot5();
// HERZUM SPRINT 1.2
// CairoFigures.CurvedRectangle(context, rect, 30);
CairoFigures.AngleFrame(context, rect, 0,0,0,0);
// END HERZUM SPRINT 1.2
Cairo.Color fillColorOrigin;
fillColorOrigin = fillColor;
lineWidth = 1;
fillColor = new Cairo.Color (1.0, 1.0, 1.0, 1.0);
context.Color = fillColor;
context.FillPreserve();
context.Color = lineColor;
context.LineWidth = lineWidth;
double[] dash = {2, 0, 2};
context.SetDash (dash, 0);
context.Stroke();
rect2 = DisplayBox;
rect2.Width = DisplayBox.Width;
rect2.Height = 30;
rect2.OffsetDot5();
CairoFigures.CurvedRectangle(context, rect2, 30);
fillColor = fillColorOrigin;
context.Color = fillColor;
context.FillPreserve();
context.Color = lineColor;
context.LineWidth = lineWidth;
context.Stroke();
// HERZUM SPRINT 2.1
// m_applicationContext.MainWindow.ExperimentCanvasPad.LoopNodeControlCurrent = this;
// END HERZUM SPRINT 2.1
// HERZUM SPRINT 5.0: TLAB-235
// DrawScope ();
DrawScope ("Enter","Exit");
// END HERZUM SPRINT 5.0: TLAB-235
}
示例4: Draw
/// <summary>
/// Draw the specified cairoContext, centerX, centerY and scale.
/// </summary>
/// <param name="cairoContext">Cairo context.</param>
/// <param name="centerX">Center x.</param>
/// <param name="centerY">Center y.</param>
/// <param name="scale">Scale.</param>
public void Draw(Cairo.Context cairoContext, int centerX, int centerY, double scale)
{
cairoContext.SetSourceRGB (0, 0, 200);
cairoContext.LineWidth = 1.0;
cairoContext.LineCap = LineCap.Butt;
//cairoContext.MoveTo (OriginalX, -OriginalY);
//int x = centerX;
//Console.WriteLine ("point: " + (robot.PathPointList [robot.PathPointList.Count-1] [1]*100));
//if (30 <= (robot.PathPointList [robot.PathPointList.Count - 1] [1] * 100))
//{
//robot.Halt ();
//Console.WriteLine ("\n\n Has Gone 30cm \n\n");
//}
for (int i = 1; i < robot.PathPointList.Count; i++)
{
cairoContext.MoveTo (centerX + (robot.PathPointList [i - 1] [0] * 100), centerY - (robot.PathPointList [i - 1] [1] * 100));
cairoContext.LineTo (centerX + (robot.PathPointList [i] [0] * 100), centerY - (robot.PathPointList [i] [1] * 100));
// Console.WriteLine (path[0]*100+" , "+ path[1]*100);
cairoContext.Stroke ();
}
foreach (double[] path in robot.PathPointList)
{
//cairoContext.MoveTo (centerX - (path[0] * 100), centerY - (path[1] * 100));
}
}
示例5: Draw
private void Draw(Cairo.Context cr, int width, int heigth)
{
foreach (var path in pathPosition.Keys)
{
var pPosition = pathPosition[path];
var begin = pPosition.Item1;
var end = pPosition.Item2;
cr.SetSourceRGB(1, 1, 1);
cr.MoveTo(begin.X, begin.Y);
cr.LineTo(end.X, end.Y);
cr.Stroke();
cr.SetSourceRGB(0, 0, 0);
}
foreach (var path in pathPosition.Keys)
{
var pPosition = pathPosition[path];
var begin = pPosition.Item1;
var end = pPosition.Item2;
if (path is BlockingPath)
{
var blockingPath = path as BlockingPath;
if (blockingPath.IsBlocked)
{
cr.SetSourceRGB(1, 0, 0);
}
else
{
cr.SetSourceRGB(0, 1, 0);
}
cr.Rectangle(new Cairo.Rectangle(end.X - 6, end.Y - 6, 12, 12));
cr.Fill();
cr.SetSourceRGB(0, 0, 0);
}
else if (path is SourcePath)
{
var sourcePath = path as SourcePath;
cr.MoveTo(begin.X, begin.Y);
cr.TextPath(sourcePath.Queue.ToString());
cr.Fill();
}
foreach (var vehicle in path.VehiclePosition.Keys)
{
var position = path.VehiclePosition[vehicle];
var r = position / path.Length;
var x = begin.X + (end.X - begin.X) * r;
var y = begin.Y + (end.Y - begin.Y) * r;
cr.Arc(x, y, 5, 0, 2 * Math.PI);
cr.Fill();
}
}
cr.Stroke();
}
示例6: DrawHorizontalSectionIndicator
protected void DrawHorizontalSectionIndicator(string text, Cairo.Context cr, Pango.Layout layout, double x, double y, double w, out double h)
{
cr.MoveTo(x,y);
cr.LineTo(x,y+SectionSerifeWidth*2);
cr.MoveTo(x,y+SectionSerifeWidth);
cr.LineTo(x+w,y+SectionSerifeWidth);
cr.MoveTo(x+w,y);
cr.LineTo(x+w,y+SectionSerifeWidth*2);
cr.Color = new Cairo.Color(0, 0, 0);
cr.LineWidth = 1;
cr.Stroke();
layout.Width = (int)(w*Pango.Scale.PangoScale);
layout.Alignment = Pango.Alignment.Center;
layout.SetText (text);
layout.Ellipsize = EllipsizeMode.Middle;
layout.Justify = true;
cr.Color = new Cairo.Color(0, 0, 0);
cr.MoveTo(x,y+SectionSerifeWidth*2);
Pango.CairoHelper.ShowLayout (cr, layout);
int lw,lh;
layout.GetPixelSize(out lw, out lh);
h=(double)lh+SectionSerifeWidth*2;
}
示例7: DrawFrameBorder
public override void DrawFrameBorder(Cairo.Context cr, Gdk.Rectangle alloc)
{
if (IsPanelWidget) {
return;
} else if (!IsSourceViewWidget) {
base.DrawFrameBorder (cr, alloc);
return;
}
cr.SetSourceColor (TextMidColor);
cr.LineWidth = 1.0;
cr.Antialias = Cairo.Antialias.None;
cr.MoveTo (alloc.Right - 1, alloc.Top);
cr.LineTo (alloc.Right - 1, alloc.Bottom);
cr.Stroke ();
if (Widget.Allocation.Bottom < Widget.Toplevel.Allocation.Height) {
cr.MoveTo (alloc.Left, alloc.Bottom - 1);
cr.LineTo (alloc.Right, alloc.Bottom - 1);
cr.Stroke ();
}
cr.Antialias = Cairo.Antialias.Default;
}
示例8: draw
static void draw (Cairo.Context gr, int width, int height)
{
int w, h;
ImageSurface image;
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.Arc (0.5, 0.5, 0.3, 0, 2*M_PI);
gr.Clip ();
gr.NewPath ();
image = new ImageSurface("data/e.png");
w = image.Width;
h = image.Height;
gr.Scale (1.0/w, 1.0/h);
image.Show (gr, 0, 0);
image.Destroy();
gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
gr.Clip ();
gr.NewPath ();
gr.Rectangle (new PointD (0, 0), 1, 1);
gr.Fill ();
gr.Color = new Color (0, 1, 0, 1);
gr.MoveTo ( new PointD (0, 0) );
gr.LineTo ( new PointD (1, 1) );
gr.MoveTo ( new PointD (1, 0) );
gr.LineTo ( new PointD (0, 1) );
gr.Stroke ();
}
示例9: Draw
internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, LineSegment lineSegment, int line, double x, double y, double lineHeight)
{
cr.MoveTo (x + 0.5, y);
cr.LineTo (x + 0.5, y + lineHeight);
cr.Color = color;
cr.Stroke ();
}
示例10: draw
static void draw (Cairo.Context gr, int width, int height)
{
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.MoveTo ( new PointD (0.5, 0.1) );
gr.LineTo ( new PointD (0.9, 0.9) );
gr.RelLineTo ( new Distance (-0.4, 0.0) );
gr.CurveTo ( new PointD (0.2, 0.9),
new PointD ( 0.2, 0.5),
new PointD (0.5, 0.5)
);
gr.ClosePath ();
gr.MoveTo ( new PointD (0.25, 0.1) );
gr.RelLineTo ( new Distance (0.2, 0.2) );
gr.RelLineTo ( new Distance ( -0.2, 0.2) );
gr.RelLineTo ( new Distance (-0.2, -0.2) );
gr.ClosePath ();
gr.Color = new Color (0, 0, 1, 1);
gr.FillPreserve ();
gr.Color = new Color ( 0, 0, 0, 1);
gr.Stroke ();
}
示例11: DrawIcon
static void DrawIcon (MonoTextEditor editor, Cairo.Context cr, DocumentLine lineSegment, double x, double y, double width, double height)
{
if (lineSegment.IsBookmarked) {
var color1 = editor.ColorStyle.Bookmarks.Color;
var color2 = editor.ColorStyle.Bookmarks.SecondColor;
DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4);
// FIXME: VV: Remove gradient features
using (var pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4)) {
pat.AddColorStop (0, color1);
pat.AddColorStop (1, color2);
cr.SetSource (pat);
cr.FillPreserve ();
}
// FIXME: VV: Remove gradient features
using (var pat = new Cairo.LinearGradient (x, y + height, x + width, y)) {
pat.AddColorStop (0, color2);
//pat.AddColorStop (1, color1);
cr.SetSource (pat);
cr.Stroke ();
}
}
}
示例12: BasicDraw
public override void BasicDraw(Cairo.Context context)
{
context.Rectangle(DisplayBox.X, DisplayBox.Y,
DisplayBox.Width, DisplayBox.Height);
context.Stroke();
classname.BasicDraw(context);
}
示例13: RenderLine
public static void RenderLine(Cairo.Context g, Cairo.Color c, double lw, double x0, double y0, double x1, double y1)
{
g.Save();
g.Color = c;
g.LineWidth = 3;
g.MoveTo(x0, y0);
g.LineTo(x1, y1);
g.Stroke();
g.Restore();
}
示例14: DrawHand
void DrawHand (double fThickness, double length, Cairo.Color color, double radians, Cairo.Context e)
{
e.MoveTo (new Cairo.PointD (center.X - (length / 9 * Math.Sin (radians)), center.Y + (length / 9 * Math.Cos (radians))));
e.LineTo (new Cairo.PointD (center.X + (length * Math.Sin (radians)), center.Y - (length * Math.Cos (radians))));
e.ClosePath ();
e.LineCap = Cairo.LineCap.Round;
e.LineJoin = Cairo.LineJoin.Round;
e.Color = color;
e.LineWidth = fThickness;
e.Stroke ();
}
示例15: DrawFrame
protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
{
RectangleD rect = DisplayBox;
rect.OffsetDot5();
CairoFigures.AngleFrame(context, rect, 15, 0, 15, 0);
context.Color = fillColor;
context.FillPreserve();
context.Color = lineColor;
context.LineWidth = lineWidth;
context.Stroke();
}