45 lines
5.0 KiB
HTML
45 lines
5.0 KiB
HTML
|
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: module fontTools.misc.arrayTools</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.misc.html"><font color="#ffffff">misc</font></a>.arrayTools</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/misc/arrayTools.py">/code/fontTools/Lib/fontTools/misc/arrayTools.py</a></font></td></tr></table>
|
|
<p><tt># Various array and rectangle tools, but mostly rectangles, hence the<br>
|
|
# name of this module (not).<br>
|
|
#</tt></p>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#eeaa77">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl><dt><a name="-asInt16"><strong>asInt16</strong></a>(array)</dt><dd><tt>Round and cast to 16 bit integer.</tt></dd></dl>
|
|
<dl><dt><a name="-calcBounds"><strong>calcBounds</strong></a>(array)</dt><dd><tt>Return the bounding rectangle of a 2D points array as a tuple:<br>
|
|
(xMin, yMin, xMax, yMax)</tt></dd></dl>
|
|
<dl><dt><a name="-insetRect"><strong>insetRect</strong></a>((xMin, yMin, xMax, yMax), dx, dy)</dt><dd><tt>Inset the rectangle by dx, dy on all sides.</tt></dd></dl>
|
|
<dl><dt><a name="-intRect"><strong>intRect</strong></a>((xMin, yMin, xMax, yMax))</dt><dd><tt>Return the rectangle, rounded off to integer values, but guaranteeing that<br>
|
|
the resulting rectangle is NOT smaller than the original.</tt></dd></dl>
|
|
<dl><dt><a name="-normRect"><strong>normRect</strong></a>((xMin, yMin, xMax, yMax))</dt><dd><tt>Normalize the rectangle so that the following holds:<br>
|
|
xMin <= xMax and yMin <= yMax</tt></dd></dl>
|
|
<dl><dt><a name="-offsetRect"><strong>offsetRect</strong></a>((xMin, yMin, xMax, yMax), dx, dy)</dt><dd><tt>Offset the rectangle by dx, dy.</tt></dd></dl>
|
|
<dl><dt><a name="-pointInRect"><strong>pointInRect</strong></a>((x, y), rect)</dt><dd><tt>Return True when point (x, y) is inside rect.</tt></dd></dl>
|
|
<dl><dt><a name="-pointsInRect"><strong>pointsInRect</strong></a>(array, rect)</dt><dd><tt>Find out which points or array are inside rect. <br>
|
|
Returns an array with a boolean for each point.</tt></dd></dl>
|
|
<dl><dt><a name="-rectCenter"><strong>rectCenter</strong></a>((xMin, yMin, xMax, yMax))</dt><dd><tt>Return the center of the rectangle as an (x, y) coordinate.</tt></dd></dl>
|
|
<dl><dt><a name="-scaleRect"><strong>scaleRect</strong></a>((xMin, yMin, xMax, yMax), x, y)</dt><dd><tt>Scale the rectangle by x, y.</tt></dd></dl>
|
|
<dl><dt><a name="-sectRect"><strong>sectRect</strong></a>((xMin1, yMin1, xMax1, yMax1), (xMin2, yMin2, xMax2, yMax2))</dt><dd><tt>Return a boolean and a rectangle. If the input rectangles intersect, return<br>
|
|
True and the intersecting rectangle. Return False and (0, 0, 0, 0) if the input<br>
|
|
rectangles don't intersect.</tt></dd></dl>
|
|
<dl><dt><a name="-unionRect"><strong>unionRect</strong></a>((xMin1, yMin1, xMax1, yMax1), (xMin2, yMin2, xMax2, yMax2))</dt><dd><tt>Return the smallest rectangle in which both input rectangles are fully<br>
|
|
enclosed. In other words, return the total bounding rectangle of both input<br>
|
|
rectangles.</tt></dd></dl>
|
|
<dl><dt><a name="-updateBounds"><strong>updateBounds</strong></a>(bounds, (x, y), min<font color="#909090">=<built-in function min></font>, max<font color="#909090">=<built-in function max></font>)</dt><dd><tt>Return the bounding recangle of rectangle bounds and point (x, y).</tt></dd></dl>
|
|
<dl><dt><a name="-vectorLength"><strong>vectorLength</strong></a>(vector)</dt><dd><tt>Return the length of the given vector.</tt></dd></dl>
|
|
</td></tr></table>
|
|
</body></html> |