本文整理汇总了C#中Cairo.AppendPath方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.AppendPath方法的具体用法?C# Cairo.AppendPath怎么用?C# Cairo.AppendPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.AppendPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderLivePreviewLayer
// Used by the workspace drawing area expose render loop.
// Takes care of the clipping.
public void RenderLivePreviewLayer (Cairo.Context ctx, double opacity)
{
if (!IsEnabled)
throw new InvalidOperationException ("Tried to render a live preview after live preview has ended.");
// TODO remove seam around selection during live preview.
ctx.Save ();
if (selection_path != null) {
// Paint area outsize of the selection path, with the pre-effect image.
var imageSize = PintaCore.Workspace.ImageSize;
ctx.Rectangle (0, 0, imageSize.Width, imageSize.Height);
ctx.AppendPath (selection_path);
ctx.Clip ();
layer.Draw(ctx, layer.Surface, opacity);
ctx.ResetClip ();
// Paint area inside the selection path, with the post-effect image.
ctx.AppendPath (selection_path);
ctx.Clip ();
layer.Draw(ctx, live_preview_surface, opacity);
ctx.PaintWithAlpha (opacity);
ctx.AppendPath (selection_path);
ctx.FillRule = Cairo.FillRule.EvenOdd;
ctx.Clip ();
} else {
layer.Draw(ctx, live_preview_surface, opacity);
}
ctx.Restore ();
}
示例2: Draw
public void Draw(Cairo.Context g, double scale, bool fillSelection)
{
g.Save ();
g.Translate (0.5, 0.5);
g.Scale (scale, scale);
g.AppendPath (selection_path);
if (fillSelection)
{
g.Color = new Cairo.Color (0.7, 0.8, 0.9, 0.2);
g.FillRule = Cairo.FillRule.EvenOdd;
g.FillPreserve ();
}
g.LineWidth = 1 / scale;
// Draw a white line first so it shows up on dark backgrounds
g.Color = new Cairo.Color (1, 1, 1);
g.StrokePreserve ();
// Draw a black dashed line over the white line
g.SetDash (new double[] { 2 / scale, 4 / scale }, 0);
g.Color = new Cairo.Color (0, 0, 0);
g.Stroke ();
g.Restore ();
}