本文整理汇总了C#中Shape.intersects方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.intersects方法的具体用法?C# Shape.intersects怎么用?C# Shape.intersects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shape
的用法示例。
在下文中一共展示了Shape.intersects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: hit
/**
* Checks whether or not the specified <code>Shape</code> intersects
* the specified {@link Rectangle}, which is in device
* space. If <code>onStroke</code> is false, this method Checks
* whether or not the interior of the specified <code>Shape</code>
* intersects the specified <code>Rectangle</code>. If
* <code>onStroke</code> is <code>true</code>, this method Checks
* whether or not the <code>Stroke</code> of the specified
* <code>Shape</code> outline intersects the specified
* <code>Rectangle</code>.
* The rendering attributes taken into account include the
* <code>Clip</code>, <code>Transform</code>, and <code>Stroke</code>
* attributes.
* @param rect the area in device space to check for a hit
* @param s the <code>Shape</code> to check for a hit
* @param onStroke flag used to choose between Testing the
* stroked or the Filled shape. If the flag is <code>true</code>, the
* <code>Stroke</code> oultine is Tested. If the flag is
* <code>false</code>, the Filled <code>Shape</code> is Tested.
* @return <code>true</code> if there is a hit; <code>false</code>
* otherwise.
* @see #setStroke
* @see #Fill(Shape)
* @see #draw(Shape)
* @see #_transform
* @see #setTransform
* @see #clip
* @see #setClip(Shape)
*/
public bool hit(Rectangle rect,
Shape s,
bool onStroke){
if (onStroke) {
s = GetStroke().CreateStrokedShape(s);
}
s = GetTransform().CreateTransformedShape(s);
return s.intersects(rect);
}