46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
|
|
from typing import Any
|
||
|
|
from collections.abc import Iterable, Sequence
|
||
|
|
import numpy
|
||
|
|
from numpy.typing import NDArray
|
||
|
|
|
||
|
|
|
||
|
|
# Basic types for Clipper integer coordinates
|
||
|
|
Path = Sequence[tuple[int, int]]
|
||
|
|
Paths = Sequence[Path]
|
||
|
|
|
||
|
|
# Types for input/output floating point coordinates
|
||
|
|
FloatPoint = tuple[float, float] | NDArray[numpy.floating]
|
||
|
|
FloatPath = Sequence[FloatPoint] | NDArray[numpy.floating]
|
||
|
|
FloatPaths = Iterable[FloatPath]
|
||
|
|
|
||
|
|
# Constants
|
||
|
|
PT_SUBJECT: int
|
||
|
|
PT_CLIP: int
|
||
|
|
|
||
|
|
PT_UNION: int
|
||
|
|
PT_INTERSECTION: int
|
||
|
|
PT_DIFFERENCE: int
|
||
|
|
PT_XOR: int
|
||
|
|
|
||
|
|
PFT_EVENODD: int
|
||
|
|
PFT_NONZERO: int
|
||
|
|
PFT_POSITIVE: int
|
||
|
|
PFT_NEGATIVE: int
|
||
|
|
|
||
|
|
# Scaling functions
|
||
|
|
def scale_to_clipper(paths: FloatPaths, scale: float = ...) -> Paths: ...
|
||
|
|
def scale_from_clipper(paths: Path | Paths, scale: float = ...) -> Any: ...
|
||
|
|
|
||
|
|
class PolyNode:
|
||
|
|
Contour: Path
|
||
|
|
Childs: list[PolyNode]
|
||
|
|
Parent: PolyNode
|
||
|
|
IsHole: bool
|
||
|
|
|
||
|
|
class Pyclipper:
|
||
|
|
def __init__(self) -> None: ...
|
||
|
|
def AddPath(self, path: Path, poly_type: int, closed: bool) -> None: ...
|
||
|
|
def AddPaths(self, paths: Paths, poly_type: int, closed: bool) -> None: ...
|
||
|
|
def Execute(self, clip_type: int, subj_fill_type: int = ..., clip_fill_type: int = ...) -> Paths: ...
|
||
|
|
def Execute2(self, clip_type: int, subj_fill_type: int = ..., clip_fill_type: int = ...) -> PolyNode: ...
|
||
|
|
def Clear(self) -> None: ...
|