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

Method draw_oval

src/__init__.py:14947–14969  ·  view source on GitHub ↗

Draw an ellipse inside a tetrapod.

(self, tetra: typing.Union[quad_like, rect_like])

Source from the content-addressed store, hash-verified

14945 return self.last_point
14946
14947 def draw_oval(self, tetra: typing.Union[quad_like, rect_like]) -> Point:
14948 """Draw an ellipse inside a tetrapod."""
14949 if len(tetra) != 4:
14950 raise ValueError("invalid arg length")
14951 if hasattr(tetra[0], "__float__"):
14952 q = Rect(tetra).quad
14953 else:
14954 q = Quad(tetra)
14955
14956 mt = q.ul + (q.ur - q.ul) * 0.5
14957 mr = q.ur + (q.lr - q.ur) * 0.5
14958 mb = q.ll + (q.lr - q.ll) * 0.5
14959 ml = q.ul + (q.ll - q.ul) * 0.5
14960 if not (self.last_point == ml):
14961 self.draw_cont += _format_g(JM_TUPLE(ml * self.ipctm)) + " m\n"
14962 self.last_point = ml
14963 self.draw_curve(ml, q.ll, mb)
14964 self.draw_curve(mb, q.lr, mr)
14965 self.draw_curve(mr, q.ur, mt)
14966 self.draw_curve(mt, q.ul, ml)
14967 self.updateRect(q.rect)
14968 self.last_point = ml
14969 return self.last_point
14970
14971 def draw_circle(self, center: point_like, radius: float) -> Point:
14972 """Draw a circle given its center and radius."""

Callers

nothing calls this directly

Calls 6

draw_curveMethod · 0.95
updateRectMethod · 0.95
RectClass · 0.85
QuadClass · 0.85
_format_gFunction · 0.85
JM_TUPLEFunction · 0.85

Tested by

no test coverage detected