klyn.gui.windows.Painter.exportImage
method
public exportImage(filename as String) as Void throws IOException:
Description

Exports the recorded drawing to a BMP, PNG or PDF file.

The destination format is selected from the filename extension. The operation requires a positive painter size and an active GUI backend.

Parameters
ParameterDescription
filenamedestination ending in .bmp, .png or .pdf.
Throws
  • IOException if the destination cannot be written or its format is unsupported.
Example
painter = Painter(320, 200)
painter.fillStyle = Color.white()
painter.fillRect(0, 0, painter.width, painter.height)
painter.exportImage("drawing.png")