# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401, F403, F405

import builtins
import typing
__all__ = [
    "WholeImageSource",
]

@typing.final
class WholeImageSource:
    r"""
    In-memory `ImageSource` wrapping a 2-D uint8 raster buffer.
    
    Constructed from a numpy array and read lazily by assemblers via
    the Rust-side `ImageSource` trait. May be attached to a
    `Part` via ``part.image_source = WholeImageSource(array)``; the
    ``part.image`` property is a convenience shim that constructs a
    `WholeImageSource` on assignment.
    """
    @property
    def dimensions(self) -> tuple[builtins.int, builtins.int]:
        r"""
        Pixel dimensions as ``(width, height)``.
        """
    @property
    def width(self) -> builtins.int:
        r"""
        Pixel width.
        """
    @property
    def height(self) -> builtins.int:
        r"""
        Pixel height.
        """
    def __new__(cls, image: typing.Any) -> WholeImageSource:
        r"""
        Build a `WholeImageSource` from a 2-D uint8 numpy array.
        
        :param image: 2-D uint8 numpy array of shape ``(height, width)``.
        """
    def read_slab(self, y_start: builtins.int, y_end: builtins.int) -> builtins.list[builtins.int]:
        r"""
        Pull a horizontal slab ``[y_start, y_end)`` and return it as
        a flat ``bytes`` object of length ``rows * width``.
        
        :param y_start: First row to read (inclusive).
        :param y_end:   Last row to read (exclusive); clipped to
            image height.
        :returns: ``bytes`` of length
            ``(y_end_clamped - y_start) * width``. Returns ``b""`` when
            ``y_start >= height`` or ``y_end <= y_start``.
        """
    def read_all(self) -> typing.Optional[builtins.list[builtins.int]]:
        r"""
        Return the full image as flat row-major ``bytes``, or ``None``
        when the source cannot materialise a full buffer.
        
        `WholeImageSource` always returns ``Some``.
        """
    def is_cancelled(self) -> builtins.bool:
        r"""
        Cancellation probe. `WholeImageSource` is never cancelled.
        """
    def __repr__(self) -> builtins.str: ...

