| 1 | package io.github.humbleui.jwm; |
| 2 | |
| 3 | public interface Layer extends AutoCloseable { |
| 4 | /** |
| 5 | * <p>Attach window to the graphics layer for rendering.</p> |
| 6 | * <p>Must be called once for single window right after layer is created.</p> |
| 7 | * <p>If layer fails to attach window, this method throws LayerNotSupportedException.</p> |
| 8 | * |
| 9 | * @param window window to attach |
| 10 | */ |
| 11 | default void attach(Window window) {} |
| 12 | |
| 13 | /** |
| 14 | * <p>Reconfigure layer for attached window.</p> |
| 15 | * <p>Must be called to recreate internal layer platform specific context if window/environment/screen settings changed.</p> |
| 16 | */ |
| 17 | default void reconfigure() {} |
| 18 | |
| 19 | /** |
| 20 | * <p>Resize layer framebuffer/area for rendering.</p> |
| 21 | * <p>Must be called for proper rendering if window content area is resized.</p> |
| 22 | * |
| 23 | * @param width new framebuffer width in pixels |
| 24 | * @param height new framebuffer height in pixels |
| 25 | */ |
| 26 | default void resize(int width, int height) {} |
| 27 | |
| 28 | default void frame() {} |
| 29 | |
| 30 | /** |
| 31 | * <p>Get current layer framebuffer width in pixels.</p> |
| 32 | * @return width in pixels |
| 33 | */ |
| 34 | int getWidth(); |
| 35 | |
| 36 | /** |
| 37 | * <p>Get current layer framebuffer height in pixels.</p> |
| 38 | * @return height in pixels |
| 39 | */ |
| 40 | int getHeight(); |
| 41 | |
| 42 | /** |
| 43 | * <p>Request back-buffer swap for presentation on this layer.</p> |
| 44 | * <p>Must be called after each accepted frame event for correct presentation.</p> |
| 45 | */ |
| 46 | default void swapBuffers() {} |
| 47 | |
| 48 | @Override |
| 49 | default void close() {} |
| 50 | } |
no outgoing calls
no test coverage detected