本文整理汇总了C#中Cairo.Context.StrokeExtents方法的典型用法代码示例。如果您正苦于以下问题:C# Context.StrokeExtents方法的具体用法?C# Context.StrokeExtents怎么用?C# Context.StrokeExtents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Context
的用法示例。
在下文中一共展示了Context.StrokeExtents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBounds
public static Gdk.Rectangle GetBounds(this Path path)
{
Rectangle rect;
using (Context g = new Context (PintaCore.Layers.CurrentLayer.Surface)) {
g.AppendPath (PintaCore.Layers.SelectionPath);
// We don't want the bounding box to include a stroke width
// of 1, but setting it to 0 returns an empty rectangle. Set
// it to a sufficiently small width and rounding takes care of it
g.LineWidth = .01;
rect = g.StrokeExtents ();
}
int x = (int)Math.Round (rect.X);
int y = (int)Math.Round (rect.Y);
int w = (int)Math.Round (rect.Width);
int h = (int)Math.Round (rect.Height);
return new Gdk.Rectangle (x, y, w - x, h - y);
}
示例2: GetBounds
public static Rectangle GetBounds(this Path path)
{
Rectangle rect;
using (Context g = new Context (PintaCore.Layers.CurrentLayer.Surface)) {
g.AppendPath (PintaCore.Layers.SelectionPath);
rect = g.StrokeExtents ();
}
return new Rectangle (rect.X, rect.Y, rect.Width - rect.X, rect.Height - rect.Y);
}