fltk.copysurface

Copy surface for clipboard graphics operations.

This module provides D bindings for FLTK's Fl_Copy_Surface class, which allows drawing graphics that are then copied to the system clipboard. This is useful for implementing copy/paste functionality for graphical content.

Example:

// Create a copy surface the same size as a widget
auto surface = new CopySurface(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);

// Delete the surface to load clipboard
destroy(surface);

// Restore normal display drawing
// (handled automatically by FLTK)

Types 1

Surface for copying graphics to the system clipboard.

CopySurface allows recording graphics operations that are then copied to the system clipboard when the surface is destroyed. This enables copying widget contents or custom drawings to the clipboard for pasting into other applications.

Platform notes:

  • Windows: Graphics are copied as an enhanced metafile
  • macOS: Graphics are copied as both PDF and TIFF
  • X11: Graphics are copied as a BMP image

Fields
private CopySurfacePtr handle_
Methods
CopySurfacePtr handle() nothrow @nogcReturns the underlying copy surface handle.
bool isValid() const nothrow @nogcChecks if the copy surface handle is valid.
void setCurrent()Makes this surface the current drawing target.
void draw(Widget widget, int deltaX = 0, int deltaY = 0)Draws a widget to the copy surface.
void drawDecoratedWindow(Window win, int deltaX = 0, int deltaY = 0)Draws a decorated window to the copy surface.
int w()Gets the width of the copy surface.
int h()Gets the height of the copy surface.
Constructors
this(int w, int h)Creates a new copy surface with the given dimensions.
Destructors