License
BSL-1.0
Image surface for drawing to in-memory images.
This module provides D bindings for FLTK's Fl_Image_Surface class, which allows drawing graphics to an in-memory image. This is useful for creating images programmatically, capturing widget content, or rendering graphics to images for later use.
Example:
// Create an image surface the same size as a widget
auto surface = new ImageSurface(widget.w, widget.h);
// Make it the current drawing target
surface.setCurrent();
// Draw a white background
import fltk.draw;
setColor(Color.WHITE);
rectf(0, 0, widget.w, widget.h);
// Draw the widget
surface.draw(widget);
// Get the resulting image
auto image = surface.image();
// Clean up
destroy(surface);Surface for drawing graphics to an in-memory image.
ImageSurface allows recording graphics operations that can then be retrieved as an RGB image. This enables programmatic image creation, widget rendering to images, and offscreen drawing.
The surface supports high-resolution mode for Retina/HiDPI displays, which creates images at double resolution.
private ImageSurfacePtr handle_void setCurrent()Makes this surface the current drawing target.void drawDecoratedWindow(Window win, int deltaX = 0, int deltaY = 0)Draws a decorated window to the image surface.ImagePtr highresImage()Gets a high-resolution shared image from the surface.this(int w, int h, bool highres = false)Creates a new image surface with the given dimensions.