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

Function JM_rect_from_py

src/__init__.py:21302–21322  ·  view source on GitHub ↗
(r)

Source from the content-addressed store, hash-verified

21300
21301
21302def JM_rect_from_py(r):
21303 if isinstance(r, mupdf.FzRect):
21304 return r
21305 if isinstance(r, mupdf.FzIrect):
21306 return mupdf.FzRect(r)
21307 if isinstance(r, Rect):
21308 return mupdf.fz_make_rect(r.x0, r.y0, r.x1, r.y1)
21309 if isinstance(r, IRect):
21310 return mupdf.fz_make_rect(r.x0, r.y0, r.x1, r.y1)
21311 if not r or not PySequence_Check(r) or PySequence_Size(r) != 4:
21312 return mupdf.FzRect(mupdf.FzRect.Fixed_INFINITE)
21313 f = [0, 0, 0, 0]
21314 for i in range(4):
21315 f[i] = JM_FLOAT_ITEM(r, i)
21316 if f[i] is None:
21317 return mupdf.FzRect(mupdf.FzRect.Fixed_INFINITE)
21318 if f[i] < FZ_MIN_INF_RECT:
21319 f[i] = FZ_MIN_INF_RECT
21320 if f[i] > FZ_MAX_INF_RECT:
21321 f[i] = FZ_MAX_INF_RECT
21322 return mupdf.fz_make_rect(f[0], f[1], f[2], f[3])
21323
21324
21325def JM_rects_overlap(a, b):

Callers 15

get_textpageMethod · 0.85
set_apn_bboxMethod · 0.85
set_popupMethod · 0.85
set_rectMethod · 0.85
runMethod · 0.85
__init__Method · 0.85
layoutMethod · 0.85
begin_pageMethod · 0.85
_add_freetext_annotMethod · 0.85
_add_square_or_circleMethod · 0.85
_add_stamp_annotMethod · 0.85
_get_textpageMethod · 0.85

Calls 3

PySequence_CheckFunction · 0.85
PySequence_SizeFunction · 0.85
JM_FLOAT_ITEMFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…