IScreenCapture interface
Captures the rendered screen to an image file. Call from the main thread.
public interface IScreenCaptureMembers
Section titled “Members”| name | description |
|---|---|
| IsCapturing { get; } | True while a capture is in flight (a second request fails fast). |
| MaxTextureSize { get; } | The GPU’s largest texture side in pixels (SystemInfo.maxTextureSize; MaxLongSide when it cannot be read) — the limit PlanSize and the capture apply. Pass it to EffectiveScale so a scale shown to the player agrees with PlanSize. |
| CaptureAsync(…) | Captures one frame; never throws — failures come back in the result. The returned task completes on the main thread. |
| PlanSize(…) | The size CaptureAsync will write for request on the current window — scale caps, the photo shape (Aspect) and the GPU’s texture limit included — so a plugin can show the REAL output size before the shot. Empty when the scale or the shape is invalid. Only the out-of-memory retry at 2× (after a failed 4× grab) can still make the written image smaller. Call from the main thread. |
Remarks
Section titled “Remarks”PNG is compressed and streamed to the file on a thread-pool thread. JPG is encoded on the MAIN thread (ImageConversion.EncodeToJPG on the captured texture), which costs one frame of encode time: the thread-safe EncodeArrayToJPG would need a second full-frame IL2CPP pixel array, and it may only be called from a thread attached to the IL2CPP runtime (il2cpp_thread_attach) — neither BepInEx nor Il2CppInterop attaches managed pool threads, and the framework makes no IL2CPP call off the main thread anywhere.
See Also
Section titled “See Also”- namespace Stellar.Abstractions.Services