本文整理汇总了C#中Cairo.Context.DrawRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Context.DrawRectangle方法的具体用法?C# Context.DrawRectangle怎么用?C# Context.DrawRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Context.DrawRectangle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawShape
protected override Rectangle DrawShape(Rectangle rect, Layer l)
{
Rectangle dirty;
using (Context g = new Context (l.Surface)) {
g.AppendPath (PintaCore.Layers.SelectionPath);
g.FillRule = FillRule.EvenOdd;
g.Clip ();
g.Antialias = Antialias.Subpixel;
if (FillShape && StrokeShape)
dirty = g.FillStrokedRectangle (rect, fill_color, outline_color, BrushWidth);
else if (FillShape)
dirty = g.FillRectangle (rect, outline_color);
else
dirty = g.DrawRectangle (rect, outline_color, BrushWidth);
}
return dirty;
}
示例2: OnExposeEvent
protected override bool OnExposeEvent(Gdk.EventExpose ev)
{
base.OnExposeEvent(ev);
if (pages == null)
return false;
int width = (int)(report.PageWidthPoints * Scale);
int height = (int)(report.PageHeightPoints * Scale);
Cairo.Rectangle rep_r = new Cairo.Rectangle(1, 1, width - 1, height - 1);
int widgetWidth, widgetHeight;
ev.Window.GetSize(out widgetWidth, out widgetHeight);
using (Context g = Gdk.CairoHelper.Create(this.GdkWindow))
using (ImageSurface rep_s = new ImageSurface(Format.Argb32, width, height))
using (Context rep_g = new Context(rep_s))
using (ImageSurface shadow_s = rep_s.Clone())
using (Context shadow_g = new Context(shadow_s))
{
g.Translate(((widgetWidth - width) / 2) - rep_padding, 0);
shadow_g.Pattern = new SolidPattern(new Color(0.6, 0.6, 0.6));
shadow_g.Paint();
g.SetSourceSurface(shadow_s, shadow_padding, shadow_padding);
g.Paint();
rep_g.Pattern = new SolidPattern(new Color(1, 1, 1));
rep_g.Paint();
rep_g.DrawRectangle(rep_r, new Color(0.1, 0.1, 0.1), 1);
using (var render = new RenderCairo(rep_g, Scale))
{
render.RunPage(pages);
}
g.SetSourceSurface(rep_s, rep_padding, rep_padding);
g.Paint();
}
return true;
}
示例3: DrawShape
protected override Rectangle DrawShape(Rectangle rect, Layer l)
{
Document doc = PintaCore.Workspace.ActiveDocument;
Rectangle dirty;
using (Context g = new Context (l.Surface)) {
g.AppendPath (doc.Selection.SelectionPath);
g.FillRule = FillRule.EvenOdd;
g.Clip ();
g.Antialias = UseAntialiasing ? Antialias.Subpixel : Antialias.None;
if (FillShape && StrokeShape)
dirty = g.FillStrokedRectangle (rect, fill_color, outline_color, BrushWidth);
else if (FillShape)
dirty = g.FillRectangle (rect, outline_color);
else
dirty = g.DrawRectangle (rect, outline_color, BrushWidth);
}
return dirty;
}