94 lines
6.0 KiB
HTML
94 lines
6.0 KiB
HTML
|
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: module fontTools.pens.pointInsidePen</title>
|
|
</head><body bgcolor="#f0f0f8">
|
|
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
<tr bgcolor="#7799ee">
|
|
<td valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="fontTools.html"><font color="#ffffff">fontTools</font></a>.<a href="fontTools.pens.html"><font color="#ffffff">pens</font></a>.pointInsidePen</strong></big></big></font></td
|
|
><td align=right valign=bottom
|
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/code/fontTools/Lib/fontTools/pens/pointInsidePen.py">/code/fontTools/Lib/fontTools/pens/pointInsidePen.py</a></font></td></tr></table>
|
|
<p><tt>fontTools.pens.pointInsidePen -- Pen implementing "point inside" testing<br>
|
|
for shapes.</tt></p>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ee77aa">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl>
|
|
<dt><font face="helvetica, arial"><a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a>(<a href="fontTools.pens.basePen.html#AbstractPen">fontTools.pens.basePen.AbstractPen</a>)
|
|
</font></dt><dd>
|
|
<dl>
|
|
<dt><font face="helvetica, arial"><a href="fontTools.pens.pointInsidePen.html#PointInsidePen">PointInsidePen</a>
|
|
</font></dt></dl>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="PointInsidePen">class <strong>PointInsidePen</strong></a>(<a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>This pen implements "point inside" testing: to test whether<br>
|
|
a given point lies inside the shape (black) or outside (white).<br>
|
|
Instances of this class can be recycled, as long as the<br>
|
|
<a href="#PointInsidePen-setTestPoint">setTestPoint</a>() method is used to set the new point to test.<br>
|
|
<br>
|
|
Typical usage:<br>
|
|
<br>
|
|
pen = <a href="#PointInsidePen">PointInsidePen</a>(glyphSet, (100, 200))<br>
|
|
outline.draw(pen)<br>
|
|
isInside = pen.<a href="#PointInsidePen-getResult">getResult</a>()<br>
|
|
<br>
|
|
Both the even-odd algorithm and the non-zero-winding-rule<br>
|
|
algorithm are implemented. The latter is the default, specify<br>
|
|
True for the evenOdd argument of __init__ or setTestPoint<br>
|
|
to use the even-odd algorithm.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%"><dl><dt>Method resolution order:</dt>
|
|
<dd><a href="fontTools.pens.pointInsidePen.html#PointInsidePen">PointInsidePen</a></dd>
|
|
<dd><a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a></dd>
|
|
<dd><a href="fontTools.pens.basePen.html#AbstractPen">fontTools.pens.basePen.AbstractPen</a></dd>
|
|
</dl>
|
|
<hr>
|
|
Methods defined here:<br>
|
|
<dl><dt><a name="PointInsidePen-__init__"><strong>__init__</strong></a>(self, glyphSet, testPoint, evenOdd<font color="#909090">=0</font>)</dt></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-getResult"><strong>getResult</strong></a>(self)</dt><dd><tt>After the shape has been drawn, <a href="#PointInsidePen-getResult">getResult</a>() returns True if the test<br>
|
|
point lies within the (black) shape, and False if it doesn't.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-setTestPoint"><strong>setTestPoint</strong></a>(self, testPoint, evenOdd<font color="#909090">=0</font>)</dt><dd><tt>Set the point to test. Call this _before_ the outline gets drawn.</tt></dd></dl>
|
|
|
|
<hr>
|
|
Methods inherited from <a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a>:<br>
|
|
<dl><dt><a name="PointInsidePen-addComponent"><strong>addComponent</strong></a>(self, glyphName, transformation)</dt><dd><tt>This default implementation simply transforms the points<br>
|
|
of the base glyph and draws it onto self.</tt></dd></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-closePath"><strong>closePath</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-curveTo"><strong>curveTo</strong></a>(self, *points)</dt></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-endPath"><strong>endPath</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-lineTo"><strong>lineTo</strong></a>(self, pt)</dt></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-moveTo"><strong>moveTo</strong></a>(self, pt)</dt></dl>
|
|
|
|
<dl><dt><a name="PointInsidePen-qCurveTo"><strong>qCurveTo</strong></a>(self, *points)</dt></dl>
|
|
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#55aa55">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
|
<td width="100%"><strong>EPSILON</strong> = 1e-10<br>
|
|
<strong>ONE_PLUS_EPSILON</strong> = 1.0000000001<br>
|
|
<strong>ZERO_MINUS_EPSILON</strong> = -1e-10<br>
|
|
<strong>__all__</strong> = ['PointInsidePen']</td></tr></table>
|
|
</body></html> |