本文整理汇总了C#中Cairo.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Fill方法的具体用法?C# Cairo.Fill怎么用?C# Cairo.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.Fill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
static void draw (Cairo.Context gr, int width, int height)
{
gr.Scale (width, height);
gr.LineWidth = 0.04;
LinearGradient pat;
pat = new LinearGradient (0.0, 0.0, 0.0, 1.0);
pat.AddColorStop (1, new Color (0, 0, 0, 1) );
pat.AddColorStop (0, new Color (1, 1, 1, 1) );
gr.Rectangle ( new PointD (0, 0),
1, 1
);
gr.Pattern = pat;
gr.Fill ();
pat.Destroy ();
RadialGradient pat2 = new RadialGradient (0.45, 0.4, 0.1,
0.4, 0.4, 0.5);
pat2.AddColorStop (0, new Color (1, 1, 1, 1) );
pat2.AddColorStop (1, new Color (0, 0, 0, 1) );
gr.Pattern = pat2;
gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
gr.Fill ();
pat2.Destroy ();
}
示例2: DrawPaper
protected void DrawPaper(Cairo.Context cr, double x, double y, double w, double h)
{
// make the background white with a line around
cr.Rectangle(x+shadowOffset*2,y+shadowOffset*2,w-shadowOffset*2,h-shadowOffset*2);
cr.Color = shadowColor;
cr.Fill();
GetInnerRegion(ref x,ref y,ref w,ref h);
cr.Rectangle(x,y,w,h);
cr.Color = new Cairo.Color(0, 0, 0);
cr.StrokePreserve();
cr.Color = new Cairo.Color(1, 1, 1);
cr.Fill();
}
示例3: DrawRoundedRectangle
public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y,
double width, double height, double radius,
Cairo.Color color, Cairo.Color borderColor)
{
gr.Save();
if((radius > height / 2) || (radius > width / 2))
radius = Math.Min(height / 2, width / 2);
gr.MoveTo(x, y + radius);
gr.Arc(x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
gr.LineTo(x + width - radius, y);
gr.Arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0);
gr.LineTo(x + width, y + height - radius);
gr.Arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
gr.LineTo(x + radius, y + height);
gr.Arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath();
gr.Restore();
gr.LineJoin = LineJoin.Round;
gr.Color = borderColor;
gr.StrokePreserve();
gr.Color = color;
gr.Fill();
}
示例4: Fill
public static void Fill(Cairo.Context context, int width, int height, Cairo.Color color)
{
context.NewPath();
context.Color = color;
context.Rectangle(0, 0, width, height);
context.Fill();
}
示例5: OnDrawn
protected override bool OnDrawn(Cairo.Context cr)
{
bool ret = true;
var rect = this.Allocation;
if (rect.Width > 0 && rect.Height > 0)
{
var arrowWidth = popupButton.Allocation.Width;
var arrowPos = rect.Width - arrowWidth;
var arrowSize = 10;
StyleContext.Save();
StyleContext.AddClass("entry");
StyleContext.RenderBackground(cr, 0, 0, rect.Width, rect.Height);
ret = base.OnDrawn(cr);
StyleContext.RenderArrow(cr, Math.PI, arrowPos, (rect.Height - arrowSize) / 2, arrowSize);
cr.SetSourceColor(new Cairo.Color(.8, .8, .8));
cr.Rectangle(arrowPos - 5, 2, 1, rect.Height - 4);
cr.Fill();
Entry.StyleContext.RenderFrame(cr, 0, 0, rect.Width, rect.Height);
StyleContext.Restore();
}
return ret;
}
示例6: 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 ();
}
示例7: onDraw
protected override void onDraw(Cairo.Context gr)
{
Rectangle rBack = new Rectangle (Slot.Size);
//rBack.Inflate (-Margin);
// if (BorderWidth > 0)
// rBack.Inflate (-BorderWidth / 2);
Background.SetAsSource (gr, rBack);
CairoHelpers.CairoRectangle(gr, rBack, CornerRadius);
gr.Fill ();
if (BorderWidth > 0) {
Foreground.SetAsSource (gr, rBack);
CairoHelpers.CairoRectangle(gr, rBack, CornerRadius, BorderWidth);
}
gr.Save ();
if (ClipToClientRect) {
//clip to client zone
CairoHelpers.CairoRectangle (gr, ClientRectangle,Math.Max(0.0, CornerRadius-Margin));
gr.Clip ();
}
if (child != null)
child.Paint (ref gr);
gr.Restore ();
}
示例8: ClippedRender
protected override void ClippedRender (Cairo.Context cr)
{
Brush brush = Background;
if (!brush.IsValid) {
return;
}
double x = Double.IsNaN (brush.Width)
? 0
: (RenderSize.Width - brush.Width) * XAlign;
double y = Double.IsNaN (brush.Height)
? 0
: (RenderSize.Height - brush.Height) * YAlign;
cr.Rectangle (0, 0, RenderSize.Width, RenderSize.Height);
cr.ClipPreserve ();
if (x != 0 || y != 0) {
cr.Translate (x, y);
}
cr.Antialias = Cairo.Antialias.None;
brush.Apply (cr);
cr.Fill ();
}
示例9: draw_3circles
/*
* Draw a red, green, and blue circle equally spaced inside
* the larger circle of radius r at (xc, yc)
*/
static void draw_3circles (Cairo.Context gr, double xc, double yc, double radius)
{
double subradius = radius * (2 / 3.0 - 0.1);
gr.Color = new Color (1, 0, 0, 0.5);
oval_path (gr,
xc + radius / 3 * Math.Cos (M_PI * (0.5)),
yc - radius / 3 * Math.Sin (M_PI * (0.5)),
subradius, subradius);
gr.Fill ();
gr.Color = new Color (0, 1, 0, 0.5);
oval_path (gr,
xc + radius / 3 * Math.Cos (M_PI * (0.5 + 2/.3)),
yc - radius / 3 * Math.Sin (M_PI * (0.5 + 2/.3)),
subradius, subradius);
gr.Fill ();
gr.Color = new Color (0, 0, 1, 0.5);
oval_path (gr,
xc + radius / 3 * Math.Cos (M_PI * (0.5 + 4/.3)),
yc - radius / 3 * Math.Sin (M_PI * (0.5 + 4/.3)),
subradius, subradius);
gr.Fill ();
}
示例10: draw
public void draw(Cairo.Context cr)
{
cr.MoveTo (position);
cr.SetSourceRGB (0, 1.0, 0);
cr.Arc (position.X, position.Y, 5, 0, 2 * Math.PI);
cr.Fill ();
}
示例11: OnDrawn
protected override bool OnDrawn(Cairo.Context cr)
{
double step_width = Allocation.Width / (double)steps;
double step_height = Allocation.Height / (double)steps;
double h = 1.0;
double s = 0.0;
for (int xi = 0, i = 0; xi < steps; xi++) {
for (int yi = 0; yi < steps; yi++, i++) {
double bg_b = (double)(i / 255.0);
double fg_b = 1.0 - bg_b;
double x = xi * step_width;
double y = yi * step_height;
cr.Rectangle (x, y, step_width, step_height);
cr.Color = CairoExtensions.ColorFromHsb (h, s, bg_b);
cr.Fill ();
int tw, th;
Pango.Layout layout = new Pango.Layout (PangoContext);
layout.SetText (((int)(bg_b * 255.0)).ToString ());
layout.GetPixelSize (out tw, out th);
cr.Translate (0.5, 0.5);
cr.MoveTo (x + (step_width - tw) / 2.0, y + (step_height - th) / 2.0);
cr.Color = CairoExtensions.ColorFromHsb (h, s, fg_b);
PangoCairoHelper.ShowLayout (cr, layout);
cr.Translate (-0.5, -0.5);
}
}
return true;
}
示例12: 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.Arc (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 ();
}
示例13: OnRender
protected override void OnRender (Cairo.Context context)
{
OnLayoutOutline (context);
context.Color = Color.MultiplyAlpha (Opacity);
context.Fill ();
base.OnRender (context);
}
示例14: DrawBackground
public override bool DrawBackground (MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics)
{
if (metrics.SelectionStart > 0)
return true;
cr.SetSourceColor (color);
cr.Rectangle (metrics.TextRenderStartPosition, metrics.LineYRenderStartPosition, metrics.TextRenderEndPosition - metrics.TextRenderStartPosition, editor.LineHeight);
cr.Fill ();
return true;
}
示例15: DrawBackground
public override bool DrawBackground (TextEditor editor, Cairo.Context cr, double y, LineMetrics metrics)
{
if (metrics.SelectionStart > 0)
return true;
cr.Color = color;
cr.Rectangle (metrics.TextRenderStartPosition, y, metrics.TextRenderEndPosition - metrics.TextRenderStartPosition, editor.LineHeight);
cr.Fill ();
return true;
}