Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uriid1/cairo-luajit-ffi
FFI bindings to Cairo graphics
https://github.com/uriid1/cairo-luajit-ffi
cairo cairographics lua luajit luajit-ffi luajit-ffi-bindings
Last synced: about 1 month ago
JSON representation
FFI bindings to Cairo graphics
- Host: GitHub
- URL: https://github.com/uriid1/cairo-luajit-ffi
- Owner: uriid1
- Created: 2024-08-26T17:16:14.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-02T17:03:20.000Z (2 months ago)
- Last Synced: 2024-10-01T16:00:05.670Z (about 1 month ago)
- Topics: cairo, cairographics, lua, luajit, luajit-ffi, luajit-ffi-bindings
- Language: Lua
- Homepage:
- Size: 169 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Screenshot](https://github.com/uriid1/cairo-luajit-ffi/blob/main/screenshot.png)
[Russian](README_RU.md) | English## Cairo LuaJit FFI
FFI bindings to Cairo graphics## Installation
## LuaRocks
```bash
sudo luarocks --lua-version 5.1 install cairo-luajit-ffi-0.0-1.rockspec
```## Dependencies
For Debian or Ubuntu
```bash
sudo apt-get install libcairo2-dev
```For Fedora
```bash
sudo yum install cairo-devel
```For openSUSE
```bash
zypper install cairo-devel
```# Documentation
https://www.cairographics.org/manual/
Methods have undergone minimal changes, but it's better to refer to cairo-ffi.lua, the examples, and test/all_test.lua.# Minimal Example
```lua
local cairo = require('cairo-luajit-ffi')local WIDTH = 512
local HEIGHT = 512local surface = cairo.image_surface_create(cairo.lib.CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT)
local cr = cairo.create(surface)cairo.set_source_rgb(cr, 1, 1, 1)
cairo.paint(cr)-- Fill circle
cairo.set_source_rgb(cr, 0, 0.7, 0.7)
cairo.arc(cr, WIDTH/2, HEIGHT/2, 128, 0, 2 * math.pi)
cairo.fill(cr)cairo.surface_write_to_png(surface, 'circle-test.png')
cairo.destroy(cr)
cairo.surface_destroy(surface)
```