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

Method get_lineart

src/__init__.py:11651–11695  ·  view source on GitHub ↗

Get page drawings paths. Note: For greater comfort, this method converts point-like, rect-like, quad-like tuples of the C version to respective Point / Rect / Quad objects. Also adds default items that are missing in original path types. I

(self)

Source from the content-addressed store, hash-verified

11649 return ngroups
11650
11651 def get_lineart(self) -> object:
11652 """Get page drawings paths.
11653
11654 Note:
11655 For greater comfort, this method converts point-like, rect-like, quad-like
11656 tuples of the C version to respective Point / Rect / Quad objects.
11657 Also adds default items that are missing in original path types.
11658 In contrast to get_drawings(), this output is an object.
11659 """
11660
11661 val = self.get_cdrawings(extended=True)
11662 paths = self.Drawpathlist()
11663 for path in val:
11664 npath = self.Drawpath(**path)
11665 if npath.type != "clip":
11666 npath.rect = Rect(path["rect"])
11667 else:
11668 npath.scissor = Rect(path["scissor"])
11669 if npath.type != "group":
11670 items = path["items"]
11671 newitems = []
11672 for item in items:
11673 cmd = item[0]
11674 rest = item[1:]
11675 if cmd == "re":
11676 item = ("re", Rect(rest[0]).normalize(), rest[1])
11677 elif cmd == "qu":
11678 item = ("qu", Quad(rest[0]))
11679 else:
11680 item = tuple([cmd] + [Point(i) for i in rest])
11681 newitems.append(item)
11682 npath.items = newitems
11683
11684 if npath.type == "f":
11685 npath.stroke_opacity = None
11686 npath.dashes = None
11687 npath.line_join = None
11688 npath.line_cap = None
11689 npath.color = None
11690 npath.width = None
11691
11692 paths.append(npath)
11693
11694 val = None
11695 return paths
11696
11697 def get_image_info(
11698 page: 'Page',

Callers

nothing calls this directly

Calls 7

get_cdrawingsMethod · 0.95
appendMethod · 0.95
RectClass · 0.85
QuadClass · 0.85
PointClass · 0.85
normalizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected