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

Method _le_diamond

src/__init__.py:24982–25001  ·  view source on GitHub ↗

Make stream commands for diamond line end symbol. "lr" denotes left (False) or right point.

(annot, p1, p2, lr, fill_color)

Source from the content-addressed store, hash-verified

24980
24981 @staticmethod
24982 def _le_diamond(annot, p1, p2, lr, fill_color):
24983 """Make stream commands for diamond line end symbol. "lr" denotes left (False) or right point.
24984 """
24985 m, im, L, R, w, scol, fcol, opacity = TOOLS._le_annot_parms(annot, p1, p2, fill_color)
24986 shift = 2.5 # 2*shift*width = length of square edge
24987 d = shift * max(1, w)
24988 M = R - (d/2., 0) if lr else L + (d/2., 0)
24989 r = Rect(M, M) + (-d, -d, d, d) # the square
24990 # the square makes line longer by (2*shift - 1)*width
24991 p = (r.tl + (r.bl - r.tl) * 0.5) * im
24992 ap = f"q\n{opacity}{p.x:f} {p.y:f} m\n"
24993 p = (r.tl + (r.tr - r.tl) * 0.5) * im
24994 ap += f"{p.x:f} {p.y:f} l\n"
24995 p = (r.tr + (r.br - r.tr) * 0.5) * im
24996 ap += f"{p.x:f} {p.y:f} l\n"
24997 p = (r.br + (r.bl - r.br) * 0.5) * im
24998 ap += f"{p.x:f} {p.y:f} l\n"
24999 ap += _format_g(w) + " w\n"
25000 ap += scol + fcol + "b\nQ\n"
25001 return ap
25002
25003 @staticmethod
25004 def _le_openarrow(annot, p1, p2, lr, fill_color):

Callers

nothing calls this directly

Calls 3

RectClass · 0.85
_format_gFunction · 0.85
_le_annot_parmsMethod · 0.80

Tested by

no test coverage detected