MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / IRect

Class IRect

src/__init__.py:17207–17387  ·  view source on GitHub ↗

IRect() - all zeros IRect(x0, y0, x1, y1) - 4 coordinates IRect(top-left, x1, y1) - point and 2 coordinates IRect(x0, y0, bottom-right) - 2 coordinates and point IRect(top-left, bottom-right) - 2 points IRect(sequ) - new from sequence or rect-like

Source from the content-addressed store, hash-verified

17205
17206
17207class IRect:
17208 """
17209 IRect() - all zeros
17210 IRect(x0, y0, x1, y1) - 4 coordinates
17211 IRect(top-left, x1, y1) - point and 2 coordinates
17212 IRect(x0, y0, bottom-right) - 2 coordinates and point
17213 IRect(top-left, bottom-right) - 2 points
17214 IRect(sequ) - new from sequence or rect-like
17215 """
17216
17217 def __add__(self, p):
17218 return Rect.__add__(self, p).round()
17219
17220 def __and__(self, x):
17221 return Rect.__and__(self, x).round()
17222
17223 def __contains__(self, x):
17224 return Rect.__contains__(self, x)
17225
17226 def __eq__(self, r):
17227 if not hasattr(r, "__len__"):
17228 return False
17229 return len(r) == 4 and self.x0 == r[0] and self.y0 == r[1] and self.x1 == r[2] and self.y1 == r[3]
17230
17231 def __getitem__(self, i):
17232 return (self.x0, self.y0, self.x1, self.y1)[i]
17233
17234 def __hash__(self):
17235 return hash(tuple(self))
17236
17237 def __init__(self, *args, p0=None, p1=None, x0=None, y0=None, x1=None, y1=None):
17238 self.x0, self.y0, self.x1, self.y1 = util_make_irect( *args, p0=p0, p1=p1, x0=x0, y0=y0, x1=x1, y1=y1)
17239
17240 def __len__(self):
17241 return 4
17242
17243 def __mul__(self, m):
17244 return Rect.__mul__(self, m).round()
17245
17246 def __neg__(self):
17247 return IRect(-self.x0, -self.y0, -self.x1, -self.y1)
17248
17249 def __or__(self, x):
17250 return Rect.__or__(self, x).round()
17251
17252 def __pos__(self):
17253 return IRect(self)
17254
17255 def __repr__(self):
17256 return "IRect" + str(tuple(self))
17257
17258 def __setitem__(self, i, v):
17259 v = int(v)
17260 if i == 0: self.x0 = v
17261 elif i == 1: self.y0 = v
17262 elif i == 2: self.x1 = v
17263 elif i == 3: self.y1 = v
17264 else:

Callers 6

roundMethod · 0.85
__neg__Method · 0.85
__pos__Method · 0.85
EMPTY_IRECTFunction · 0.85
INFINITE_IRECTFunction · 0.85
test_2173Function · 0.85

Calls

no outgoing calls

Tested by 1

test_2173Function · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…