Interface IEnvViewer
- Namespace
- Gym.Environments
- Assembly
- Gym.dll
A window that shows an env's human-mode frames, synchronously (DR-85): the path the envs' human mode uses inside
Step and Reset, which every viewer has. The env owns the viewer its factory made and closes it when
the env closes.
public interface IEnvViewer : IDisposable
- Inherited Members
- Extension Methods
Remarks
A frame is an (H, W, 3) uint8 array, rows top to bottom, what an env's rgb_array mode returns: the
contract carries no imaging library (ImageSharp left it with DR-85). A viewer that can also render without blocking
implements IAsyncEnvViewer, which an inherently asynchronous env awaits.
Footgun for implementers deriving from a UI framework's window: Close() usually exists on the window
already (WinForms' Form.Close, Avalonia's Window.Close) and would implement this interface's
Close() silently; implement it explicitly (void IEnvViewer.Close()) to keep control of what
closing means.
Methods
Close()
Closes the window; what rendering afterwards does is the viewer's (the built-in ones ignore it or reopen nothing).
void Close()
CloseEnvironment()
0.2's name for Close(), kept so 0.2 code compiles until 2.0 (DR-58, DR-85).
[Obsolete("0.2's name: write Close(). Removed in 2.0.")]
void CloseEnvironment()
Render(NDArray)
Shows frame, replacing the previous frame, and returns once the viewer has its own copy: the
caller may dispose or reuse the frame right after.
void Render(NDArray frame)
Parameters
frameNDArrayThe frame,
(H, W, 3)uint8; it stays the caller's.
Exceptions
- ArgumentNullException
Thrown when
frameis null (the built-in viewers).- ArgumentException
Thrown for a frame that is not
(H, W, 3)(the built-in viewers).