added intRect() function. Turn any rect into a rect using ints only.

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@66 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
Just 2000-01-22 00:26:07 +00:00
parent b852a417cf
commit b3026bad35

View File

@ -50,4 +50,9 @@ def sectRect((l1, t1, r1, b1), (l2, t2, r2, b2)):
return 0, (0, 0, 0, 0)
return 1, (l, t, r, b)
def intRect(rect):
rect = Numeric.array(rect)
l, t = Numeric.floor(rect[:2])
r, b = Numeric.ceil(rect[2:])
return tuple(Numeric.array((l, t, r, b)).astype(Numeric.Int))