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

Function draw_line

src_classic/utils.py:1893–1925  ·  view source on GitHub ↗

Draw a line from point p1 to point p2.

(
    page: Page,
    p1: point_like,
    p2: point_like,
    color: OptSeq = (0,),
    dashes: OptStr = None,
    width: float = 1,
    lineCap: int = 0,
    lineJoin: int = 0,
    overlay: bool = True,
    morph: OptSeq = None,
    stroke_opacity: float = 1,
    fill_opacity: float = 1,
    oc=0,
)

Source from the content-addressed store, hash-verified

1891
1892
1893def draw_line(
1894 page: Page,
1895 p1: point_like,
1896 p2: point_like,
1897 color: OptSeq = (0,),
1898 dashes: OptStr = None,
1899 width: float = 1,
1900 lineCap: int = 0,
1901 lineJoin: int = 0,
1902 overlay: bool = True,
1903 morph: OptSeq = None,
1904 stroke_opacity: float = 1,
1905 fill_opacity: float = 1,
1906 oc=0,
1907) -> Point:
1908 """Draw a line from point p1 to point p2."""
1909 img = page.new_shape()
1910 p = img.draw_line(Point(p1), Point(p2))
1911 img.finish(
1912 color=color,
1913 dashes=dashes,
1914 width=width,
1915 closePath=False,
1916 lineCap=lineCap,
1917 lineJoin=lineJoin,
1918 morph=morph,
1919 stroke_opacity=stroke_opacity,
1920 fill_opacity=fill_opacity,
1921 oc=oc,
1922 )
1923 img.commit(overlay)
1924
1925 return p
1926
1927
1928def draw_squiggle(

Callers

nothing calls this directly

Calls 5

PointClass · 0.85
new_shapeMethod · 0.80
draw_lineMethod · 0.45
finishMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…