mini_arcade_core.runtime.capture.screenshot_capturer ==================================================== .. py:module:: mini_arcade_core.runtime.capture.screenshot_capturer .. autoapi-nested-parse:: Module providing runtime adapters for window and scene management. Classes ------- .. autoapisummary:: mini_arcade_core.runtime.capture.screenshot_capturer.CapturePathBuilder mini_arcade_core.runtime.capture.screenshot_capturer.ScreenshotCapturer Module Contents --------------- .. py:class:: CapturePathBuilder Helper to build file paths for captured screenshots. :ivar directory (str): Directory to save screenshots in. :ivar prefix (str): Prefix for screenshot filenames. :ivar ext (str): File extension/format for screenshots. .. py:attribute:: directory :type: str :value: 'screenshots' .. py:attribute:: prefix :type: str :value: '' .. py:attribute:: ext :type: str :value: 'png' .. py:method:: build(label: str) -> pathlib.Path Build a file path for a screenshot with the given label. :param label: Label to include in the filename. :type label: str :return: Full path for the screenshot file. :rtype: Path .. py:method:: build_sim(run_id: str, frame_index: int, label: str) -> pathlib.Path Build a file path for a simulation frame screenshot. :param run_id: Unique identifier for the simulation run. :type run_id: str :param frame_index: Index of the frame in the simulation. :type frame_index: int :param label: Label to include in the filename. :type label: str :return: Full path for the screenshot file. :rtype: Path .. py:class:: ScreenshotCapturer(backend: mini_arcade_core.backend.Backend, path_builder: Optional[CapturePathBuilder] = None, worker: Optional[mini_arcade_core.runtime.capture.capture_worker.CaptureWorker] = None) Bases: :py:obj:`mini_arcade_core.runtime.capture.capture_port.CapturePort` Adapter for capturing frames. :param backend: Backend instance to use for capturing frames. :type backend: Backend :param path_builder: Optional CapturePathBuilder for building file paths. :type path_builder: CapturePathBuilder | None .. py:attribute:: backend .. py:attribute:: path_builder .. py:attribute:: worker .. py:method:: screenshot(label: str | None = None) -> str Capture the current frame. :param label: Optional label for the screenshot file. :type label: str | None :return: Screenshot file path. :rtype: str .. py:method:: screenshot_bytes() -> bytes Capture the current frame and return it as bytes. :return: Screenshot data as bytes. :rtype: bytes | None .. py:method:: screenshot_sim(run_id: str, frame_index: int, label: str = 'frame') -> str Capture the current frame in a simulation context. :param run_id: Unique identifier for the simulation run. :type run_id: str :param frame_index: Index of the frame in the simulation. :type frame_index: int :param label: Optional label for the screenshot file. :type label: str :return: Screenshot file path. :rtype: str