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

Method _le_annot_parms

src/__init__.py:24894–24929  ·  view source on GitHub ↗

Get common parameters for making annot line end symbols. Returns: m: matrix that maps p1, p2 to points L, P on the x-axis im: its inverse L, P: transformed p1, p2 w: line width scol: stroke color string fcol: fill color

(annot, p1, p2, fill_color)

Source from the content-addressed store, hash-verified

24892
24893 @staticmethod
24894 def _le_annot_parms(annot, p1, p2, fill_color):
24895 """Get common parameters for making annot line end symbols.
24896
24897 Returns:
24898 m: matrix that maps p1, p2 to points L, P on the x-axis
24899 im: its inverse
24900 L, P: transformed p1, p2
24901 w: line width
24902 scol: stroke color string
24903 fcol: fill color store_shrink
24904 opacity: opacity string (gs command)
24905 """
24906 w = annot.border["width"] # line width
24907 sc = annot.colors["stroke"] # stroke color
24908 if not sc: # black if missing
24909 sc = (0,0,0)
24910 scol = " ".join(map(str, sc)) + " RG\n"
24911 if fill_color:
24912 fc = fill_color
24913 else:
24914 fc = annot.colors["fill"] # fill color
24915 if not fc:
24916 fc = (1,1,1) # white if missing
24917 fcol = " ".join(map(str, fc)) + " rg\n"
24918 # nr = annot.rect
24919 np1 = p1 # point coord relative to annot rect
24920 np2 = p2 # point coord relative to annot rect
24921 m = Matrix(util_hor_matrix(np1, np2)) # matrix makes the line horizontal
24922 im = ~m # inverted matrix
24923 L = np1 * m # converted start (left) point
24924 R = np2 * m # converted end (right) point
24925 if 0 <= annot.opacity < 1:
24926 opacity = "/H gs\n"
24927 else:
24928 opacity = ""
24929 return m, im, L, R, w, scol, fcol, opacity
24930
24931 @staticmethod
24932 def _le_butt(annot, p1, p2, lr, fill_color):

Callers 9

_le_buttMethod · 0.80
_le_circleMethod · 0.80
_le_closedarrowMethod · 0.80
_le_diamondMethod · 0.80
_le_openarrowMethod · 0.80
_le_rclosedarrowMethod · 0.80
_le_ropenarrowMethod · 0.80
_le_slashMethod · 0.80
_le_squareMethod · 0.80

Calls 2

MatrixClass · 0.85
util_hor_matrixFunction · 0.85

Tested by

no test coverage detected