Gather bounding boxes of vector drawings on the page.
(page)
| 397 | |
| 398 | |
| 399 | def _collect_drawing_rects(page) -> list[tuple[float, float, float, float]]: |
| 400 | """Gather bounding boxes of vector drawings on the page.""" |
| 401 | rects: list[tuple[float, float, float, float]] = [] |
| 402 | try: |
| 403 | for drawing in page.get_drawings(): |
| 404 | r = drawing.get("rect") |
| 405 | if r is None: |
| 406 | continue |
| 407 | rect = fitz.Rect(r) |
| 408 | if rect.is_empty or rect.is_infinite: |
| 409 | continue |
| 410 | if rect.width < 10 or rect.height < 10: |
| 411 | continue |
| 412 | rects.append((rect.x0, rect.y0, rect.x1, rect.y1)) |
| 413 | except Exception: |
| 414 | pass |
| 415 | return rects |
| 416 | |
| 417 | |
| 418 | def _visual_signal_for_bbox(page, bbox: tuple[float, float, float, float]) -> tuple[int, float]: |
no outgoing calls
no test coverage detected