AtlatestRepositorysigil-cairo
1# sigil-cairo
2
3Cairo 2D graphics FFI bindings for [Sigil](https://codeberg.org/sigil/sigil).
4
5## Features
6
7- Image surface creation and management
8- Drawing context lifecycle (create, save, restore, destroy)
9- Path operations (rectangle, arc, curve-to, line-to)
10- Fill and stroke rendering
11- Source color (RGB/RGBA) and pattern support
12- Linear and radial gradients
13- Text rendering and extents
14- Transforms (translate, scale, rotate)
15- PNG output
16- Compositing operators
17- Matrix operations
18- Dash patterns
19- Convenience macros (`with-cairo-context`)
21## Usage
23```scheme
24(import (sigil ffi)
25 (cairo))
27(let ((surface (cairo-image-surface-create CAIRO_FORMAT_ARGB32 200 200)))
28 (with-cairo-context surface
29 (lambda (cr)
30 (cairo-set-source-rgb cr 0.2 0.3 0.8)
31 (cairo-rectangle cr 10.0 10.0 180.0 180.0)
32 (cairo-fill cr)))
33 (cairo-surface-write-to-png surface "output.png")
34 (cairo-surface-destroy surface))
35```
37## Dependencies
39- sigil-stdlib
40- sigil-ffi
42Requires Cairo system library (`libcairo`).
44## System Prerequisites
46- [Cairo](https://www.cairographics.org/) (`libcairo`)
48## Development
50```bash
51sigil deps install
52sigil build
53sigil test
54```
56## License
58BSD-3-Clause