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

Method draw_line

src_classic/utils.py:3137–3149  ·  view source on GitHub ↗

Draw a line between two points.

(self, p1: point_like, p2: point_like)

Source from the content-addressed store, hash-verified

3135 self.rect.y1 = max(self.rect.y1, x.y1)
3136
3137 def draw_line(self, p1: point_like, p2: point_like) -> Point:
3138 """Draw a line between two points."""
3139 p1 = Point(p1)
3140 p2 = Point(p2)
3141 if not (self.lastPoint == p1):
3142 self.draw_cont += "%g %g m\n" % JM_TUPLE(p1 * self.ipctm)
3143 self.lastPoint = p1
3144 self.updateRect(p1)
3145
3146 self.draw_cont += "%g %g l\n" % JM_TUPLE(p2 * self.ipctm)
3147 self.updateRect(p2)
3148 self.lastPoint = p2
3149 return self.lastPoint
3150
3151 def draw_polyline(self, points: list) -> Point:
3152 """Draw several connected line segments."""

Callers 2

draw_rectMethod · 0.95
draw_lineFunction · 0.45

Calls 3

updateRectMethod · 0.95
PointClass · 0.85
JM_TUPLEFunction · 0.85

Tested by

no test coverage detected