本文整理汇总了C#中Cairo.Rectangle.ToGdkRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.ToGdkRectangle方法的具体用法?C# Rectangle.ToGdkRectangle怎么用?C# Rectangle.ToGdkRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo.Rectangle
的用法示例。
在下文中一共展示了Rectangle.ToGdkRectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawHoverPoint
/// <summary>
/// Draws the hover point, if any.
/// </summary>
/// <param name="g"></param>
protected void DrawHoverPoint(Context g)
{
ShapeEngine activeEngine = ActiveShapeEngine;
if (activeEngine != null)
{
last_control_pt_size = Math.Min(activeEngine.BrushWidth + 1, 5);
}
else
{
last_control_pt_size = Math.Min(BrushWidth + 1, 5);
}
double controlPointOffset = (double)last_control_pt_size / 2d;
//Verify that the user isn't changing the tension of a control point and that there is a hover point to draw.
if (!changing_tension && hover_point.X > -1d)
{
Rectangle hoverOuterEllipseRect = new Rectangle(
hover_point.X - controlPointOffset * 3d, hover_point.Y - controlPointOffset * 3d,
controlPointOffset * 6d, controlPointOffset * 6d);
g.FillStrokedEllipse(hoverOuterEllipseRect, hover_color, hover_color, 1);
g.FillStrokedEllipse(new Rectangle(
hover_point.X - controlPointOffset, hover_point.Y - controlPointOffset,
last_control_pt_size, last_control_pt_size), hover_color, hover_color, (int)last_control_pt_size);
hoverOuterEllipseRect = hoverOuterEllipseRect.Inflate(1, 1);
//Since the hover point can be outside of the active shape's bounds (hovering over a different shape), a special
//invalidation call needs to be made for the hover point in order to ensure its visibility at all times.
PintaCore.Workspace.Invalidate(hoverOuterEllipseRect.ToGdkRectangle());
last_hover = hoverOuterEllipseRect;
last_hover = last_hover.Value.Clamp();
}
}
示例2: InvalidateAfterDraw
private void InvalidateAfterDraw(Rectangle dirty)
{
Document doc = PintaCore.Workspace.ActiveDocument;
//Inflate to accomodate for previously drawn control points, if any.
int inflate = (int)(last_control_pt_size * 8d);
dirty = dirty.Inflate(inflate, inflate);
// Increase the size of the dirty rect to account for antialiasing.
if (owner.UseAntialiasing)
{
dirty = dirty.Inflate(1, 1);
}
//Combine, clamp, and invalidate the dirty Rectangle.
dirty = ((Rectangle?)dirty).UnionRectangles(last_dirty).Value;
dirty = dirty.Clamp();
doc.Workspace.Invalidate(dirty.ToGdkRectangle());
last_dirty = dirty;
}