path.pyi 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. from .bezier import BezierSegment
  2. from .transforms import Affine2D, Transform, Bbox
  3. from collections.abc import Generator, Iterable, Sequence
  4. import numpy as np
  5. from numpy.typing import ArrayLike
  6. from typing import Any, overload
  7. class Path:
  8. code_type: type[np.uint8]
  9. STOP: np.uint8
  10. MOVETO: np.uint8
  11. LINETO: np.uint8
  12. CURVE3: np.uint8
  13. CURVE4: np.uint8
  14. CLOSEPOLY: np.uint8
  15. NUM_VERTICES_FOR_CODE: dict[np.uint8, int]
  16. def __init__(
  17. self,
  18. vertices: ArrayLike,
  19. codes: ArrayLike | None = ...,
  20. _interpolation_steps: int = ...,
  21. closed: bool = ...,
  22. readonly: bool = ...,
  23. ) -> None: ...
  24. @property
  25. def vertices(self) -> ArrayLike: ...
  26. @vertices.setter
  27. def vertices(self, vertices: ArrayLike) -> None: ...
  28. @property
  29. def codes(self) -> ArrayLike | None: ...
  30. @codes.setter
  31. def codes(self, codes: ArrayLike) -> None: ...
  32. @property
  33. def simplify_threshold(self) -> float: ...
  34. @simplify_threshold.setter
  35. def simplify_threshold(self, threshold: float) -> None: ...
  36. @property
  37. def should_simplify(self) -> bool: ...
  38. @should_simplify.setter
  39. def should_simplify(self, should_simplify: bool) -> None: ...
  40. @property
  41. def readonly(self) -> bool: ...
  42. def copy(self) -> Path: ...
  43. def __deepcopy__(self, memo: dict[int, Any] | None = ...) -> Path: ...
  44. deepcopy = __deepcopy__
  45. @classmethod
  46. def make_compound_path_from_polys(cls, XY: ArrayLike) -> Path: ...
  47. @classmethod
  48. def make_compound_path(cls, *args: Path) -> Path: ...
  49. def __len__(self) -> int: ...
  50. def iter_segments(
  51. self,
  52. transform: Transform | None = ...,
  53. remove_nans: bool = ...,
  54. clip: tuple[float, float, float, float] | None = ...,
  55. snap: bool | None = ...,
  56. stroke_width: float = ...,
  57. simplify: bool | None = ...,
  58. curves: bool = ...,
  59. sketch: tuple[float, float, float] | None = ...,
  60. ) -> Generator[tuple[np.ndarray, np.uint8], None, None]: ...
  61. def iter_bezier(self, **kwargs) -> Generator[BezierSegment, None, None]: ...
  62. def cleaned(
  63. self,
  64. transform: Transform | None = ...,
  65. remove_nans: bool = ...,
  66. clip: tuple[float, float, float, float] | None = ...,
  67. *,
  68. simplify: bool | None = ...,
  69. curves: bool = ...,
  70. stroke_width: float = ...,
  71. snap: bool | None = ...,
  72. sketch: tuple[float, float, float] | None = ...
  73. ) -> Path: ...
  74. def transformed(self, transform: Transform) -> Path: ...
  75. def contains_point(
  76. self,
  77. point: tuple[float, float],
  78. transform: Transform | None = ...,
  79. radius: float = ...,
  80. ) -> bool: ...
  81. def contains_points(
  82. self, points: ArrayLike, transform: Transform | None = ..., radius: float = ...
  83. ) -> np.ndarray: ...
  84. def contains_path(self, path: Path, transform: Transform | None = ...) -> bool: ...
  85. def get_extents(self, transform: Transform | None = ..., **kwargs) -> Bbox: ...
  86. def intersects_path(self, other: Path, filled: bool = ...) -> bool: ...
  87. def intersects_bbox(self, bbox: Bbox, filled: bool = ...) -> bool: ...
  88. def interpolated(self, steps: int) -> Path: ...
  89. def to_polygons(
  90. self,
  91. transform: Transform | None = ...,
  92. width: float = ...,
  93. height: float = ...,
  94. closed_only: bool = ...,
  95. ) -> list[ArrayLike]: ...
  96. @classmethod
  97. def unit_rectangle(cls) -> Path: ...
  98. @classmethod
  99. def unit_regular_polygon(cls, numVertices: int) -> Path: ...
  100. @classmethod
  101. def unit_regular_star(cls, numVertices: int, innerCircle: float = ...) -> Path: ...
  102. @classmethod
  103. def unit_regular_asterisk(cls, numVertices: int) -> Path: ...
  104. @classmethod
  105. def unit_circle(cls) -> Path: ...
  106. @classmethod
  107. def circle(
  108. cls,
  109. center: tuple[float, float] = ...,
  110. radius: float = ...,
  111. readonly: bool = ...,
  112. ) -> Path: ...
  113. @classmethod
  114. def unit_circle_righthalf(cls) -> Path: ...
  115. @classmethod
  116. def arc(
  117. cls, theta1: float, theta2: float, n: int | None = ..., is_wedge: bool = ...
  118. ) -> Path: ...
  119. @classmethod
  120. def wedge(cls, theta1: float, theta2: float, n: int | None = ...) -> Path: ...
  121. @overload
  122. @staticmethod
  123. def hatch(hatchpattern: str, density: float = ...) -> Path: ...
  124. @overload
  125. @staticmethod
  126. def hatch(hatchpattern: None, density: float = ...) -> None: ...
  127. def clip_to_bbox(self, bbox: Bbox, inside: bool = ...) -> Path: ...
  128. def get_path_collection_extents(
  129. master_transform: Transform,
  130. paths: Sequence[Path],
  131. transforms: Iterable[Affine2D],
  132. offsets: ArrayLike,
  133. offset_transform: Affine2D,
  134. ) -> Bbox: ...