Interface GpuRenderer
Canvas that widgets draw through; implementations own every GL call.
Nothing above the backend module may touch OpenGL.-
Method Summary
Modifier and TypeMethodDescriptioncanvas()default voidcaptureFramebuffer(Path pngFile) Schedules a capture of this frame to a PNG file, creating the parent directories if they are missing.voidcaptureFramebuffer(Consumer<Image> sink) Schedules a capture of this frame: after the frame callback returns and all batched geometry is flushed to the framebuffer (and before the buffer swap), the pixels are read back and handed tosink.voidclear(float red, float green, float blue, float alpha) Clears the framebuffer to the given non-premultiplied RGBA color (0–1).default void
-
Method Details
-
canvas
Canvas canvas()- Returns:
- the canvas for the current frame, only valid while inside a
FrameCallback
-
clear
void clear(float red, float green, float blue, float alpha) Clears the framebuffer to the given non-premultiplied RGBA color (0–1). -
clear
-
captureFramebuffer
Schedules a capture of this frame: after the frame callback returns and all batched geometry is flushed to the framebuffer (and before the buffer swap), the pixels are read back and handed tosink. This is the basis of the--screenshotverification mode, and the way an application gets what a window is showing without writing a file. Must be called from inside aFrameCallback;sinkruns on the UI thread, still inside that frame, before the swap.The image is display-referred already: a window's framebuffer holds what the composite produced, sRGB-encoded, tonemapped if anything in the frame needed it. The wrong edit this prevents is applying a display transform to it, which would tonemap the frame a second time; that transform belongs to
ReadableSurface, whose subject is an offscreen target that has not been through the composite.Alpha is straight and the rows are top-down, as
Imagerequires, whatever the underlying graphics API's own conventions are. The read is a synchronous GPU stall by construction; it is the point where the CPU waits for the frame it just submitted. -
captureFramebuffer
Schedules a capture of this frame to a PNG file, creating the parent directories if they are missing.Deliberately a thin default over
captureFramebuffer(Consumer)plusImages.save(limn.graphics.Image, limn.graphics.ImageEncodeOptions, java.nio.file.Path): the toolkit has exactly one PNG writer, and a renderer that grew its own would be a second one that drifts.
-