本文整理汇总了C#中Cairo.Context.SetSource方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Context.SetSource方法的具体用法?C# Cairo.Context.SetSource怎么用?C# Cairo.Context.SetSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Cairo.Context.SetSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMouseUp
protected override void OnMouseUp(Gtk.DrawingArea canvas, Gtk.ButtonReleaseEventArgs args, Cairo.PointD point)
{
Document doc = PintaCore.Workspace.ActiveDocument;
painting = false;
using (Cairo.Context g = new Cairo.Context (doc.CurrentLayer.Surface)) {
g.SetSource (doc.ToolLayer.Surface);
g.Paint ();
}
base.OnMouseUp (canvas, args, point);
offset = new Point (int.MinValue, int.MinValue);
last_point = new Point (int.MinValue, int.MinValue);
doc.ToolLayer.Clear ();
doc.ToolLayer.Hidden = true;
doc.Workspace.Invalidate ();
}
示例2: OnMouseMove
protected override void OnMouseMove(object o, Gtk.MotionNotifyEventArgs args, Cairo.PointD point)
{
if (!painting || offset.IsNotSet ())
return;
int x = (int)point.X;
int y = (int)point.Y;
if (last_point.IsNotSet ()) {
last_point = new Point (x, y);
return;
}
using (Cairo.Context g = new Cairo.Context (PintaCore.Layers.ToolLayer.Surface)) {
g.AppendPath (PintaCore.Layers.SelectionPath);
g.FillRule = Cairo.FillRule.EvenOdd;
g.Clip ();
g.Antialias = Cairo.Antialias.Subpixel;
g.MoveTo (last_point.X, last_point.Y);
g.LineTo (x, y);
g.SetSource (PintaCore.Workspace.ActiveDocument.CurrentLayer.Surface, offset.X, offset.Y);
g.LineWidth = BrushWidth;
g.LineCap = Cairo.LineCap.Round;
g.Stroke ();
}
var dirty_rect = GetRectangleFromPoints (last_point, new Point (x, y));
last_point = new Point (x, y);
surface_modified = true;
PintaCore.Workspace.Invalidate (dirty_rect);
}