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