AtlatestRenderedmarkdown
Readme

sigil-cairo

Cairo 2D graphics FFI bindings for Sigil.

Features

  • Image surface creation and management
  • Drawing context lifecycle (create, save, restore, destroy)
  • Path operations (rectangle, arc, curve-to, line-to)
  • Fill and stroke rendering
  • Source color (RGB/RGBA) and pattern support
  • Linear and radial gradients
  • Text rendering and extents
  • Transforms (translate, scale, rotate)
  • PNG output
  • Compositing operators
  • Matrix operations
  • Dash patterns
  • Convenience macros (with-cairo-context)

Usage

(import (sigil ffi)
        (cairo))

(let ((surface (cairo-image-surface-create CAIRO_FORMAT_ARGB32 200 200)))
  (with-cairo-context surface
    (lambda (cr)
      (cairo-set-source-rgb cr 0.2 0.3 0.8)
      (cairo-rectangle cr 10.0 10.0 180.0 180.0)
      (cairo-fill cr)))
  (cairo-surface-write-to-png surface "output.png")
  (cairo-surface-destroy surface))

Dependencies

  • sigil-stdlib
  • sigil-ffi

Requires Cairo system library (libcairo).

System Prerequisites

Development

sigil deps install
sigil build
sigil test

License

BSD-3-Clause