AtlatestRepositorysigil-cairo
sigil-cairo / treeREADME.md
1
# sigil-cairo3
Cairo 2D graphics FFI bindings for [Sigil](https://codeberg.org/sigil/sigil).5
## Features7
- Image surface creation and management8
- Drawing context lifecycle (create, save, restore, destroy)9
- Path operations (rectangle, arc, curve-to, line-to)10
- Fill and stroke rendering11
- Source color (RGB/RGBA) and pattern support12
- Linear and radial gradients13
- Text rendering and extents14
- Transforms (translate, scale, rotate)15
- PNG output16
- Compositing operators17
- Matrix operations18
- Dash patterns19
- Convenience macros (`with-cairo-context`)21
## Usage23
```scheme24
(import (sigil ffi)25
(cairo))27
(let ((surface (cairo-image-surface-create CAIRO_FORMAT_ARGB32 200 200)))28
(with-cairo-context surface29
(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
## Dependencies39
- sigil-stdlib40
- sigil-ffi42
Requires Cairo system library (`libcairo`).44
## System Prerequisites46
- [Cairo](https://www.cairographics.org/) (`libcairo`)48
## Development50
```bash51
sigil deps install52
sigil build53
sigil test54
```56
## License58
BSD-3-Clause