Skip to content

drawing_target

drawing_target

Target for Draw commands to draw into.

DrawingTarget

Target for Draw commands to draw into.

Source code in src/pygerber/backend/abstract/drawing_target.py
class DrawingTarget:
    """Target for Draw commands to draw into."""

    coordinate_origin: Vector2D
    bounding_box: BoundingBox

    def __init__(self, coordinate_origin: Vector2D, bounding_box: BoundingBox) -> None:
        """Initialize drawing target."""
        self.coordinate_origin = coordinate_origin
        self.bounding_box = bounding_box

    def __enter__(self) -> None:
        pass

    def __exit__(
        self,
        exc_type: Optional[type[BaseException]],
        exc_value: Optional[BaseException],
        traceback: Optional[TracebackType],
    ) -> None:
        if exc_type is None:
            self._finalize()

    def _finalize(self) -> None:
        """Call at the end of image modification.

        After this call no modifications to image are allowed.
        """

__init__

__init__(
    coordinate_origin: Vector2D, bounding_box: BoundingBox
) -> None

Initialize drawing target.

Source code in src/pygerber/backend/abstract/drawing_target.py
def __init__(self, coordinate_origin: Vector2D, bounding_box: BoundingBox) -> None:
    """Initialize drawing target."""
    self.coordinate_origin = coordinate_origin
    self.bounding_box = bounding_box