{"id":15392639,"url":"https://github.com/jackdbd/zig-cairo","last_synced_at":"2025-07-06T14:36:37.353Z","repository":{"id":42485974,"uuid":"329142223","full_name":"jackdbd/zig-cairo","owner":"jackdbd","description":"🪲 zig-idiomatic wrapper for cairo","archived":false,"fork":false,"pushed_at":"2022-04-07T20:33:21.000Z","size":926,"stargazers_count":20,"open_issues_count":17,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-23T17:37:25.481Z","etag":null,"topics":["cairo","graphics","wrapper","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackdbd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-12T23:44:55.000Z","updated_at":"2025-01-12T02:59:45.000Z","dependencies_parsed_at":"2022-09-03T08:24:00.502Z","dependency_job_id":null,"html_url":"https://github.com/jackdbd/zig-cairo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-cairo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-cairo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-cairo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzig-cairo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackdbd","download_url":"https://codeload.github.com/jackdbd/zig-cairo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241212185,"owners_count":19927897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cairo","graphics","wrapper","zig"],"created_at":"2024-10-01T15:15:26.801Z","updated_at":"2025-02-28T19:30:44.477Z","avatar_url":"https://github.com/jackdbd.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zig-cairo\n\n[![CI](https://github.com/jackdbd/zig-cairo/actions/workflows/ci.yaml/badge.svg)](https://github.com/jackdbd/zig-cairo/actions/workflows/ci.yaml)\n\nThin wrapper for the [cairo](https://github.com/freedesktop/cairo) 2D graphics library.\n\nTested on Zig version **0.9.1**.\n\n🚧 Very much a work in progress... 🚧\n\n## Naming convention\n\nAs suggested in the [cairo Appendix](https://www.cairographics.org/manual/language-bindings.html), the type names and method names of the original C library were changed to follow the [Zig Style Guide](https://ziglang.org/documentation/0.7.1/#Names). For example, a method like `cairo_set_source(cr, source)` in cairo becomes `cr.setSource(source)` in zig-cairo.\n\n## Installation\n\nClone the repo and jump into it:\n\n```sh\ngit clone git@github.com:jackdbd/zig-cairo.git\ncd zig-cairo\n```\n\nIn order to use this library and run the examples you will need zig version **0.9.1**. You can get it using [zigup](https://github.com/marler8997/zigup):\n\n```sh\nzigup fetch 0.9.1\nzigup 0.9.1\n```\n\nYou will also need [cairo](https://www.cairographics.org/), [pango](https://gitlab.gnome.org/GNOME/pango), [pangocairo](https://docs.gtk.org/PangoCairo/), [xcb](https://xcb.freedesktop.org/), and [xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) if you want to run some tests/examples in a virtual framebuffer. See [this script](./scripts/install-dependencies.sh).\n\n## Examples\n\nYou can find many examples in the [examples directory](./examples/README.md).\n\n![arc.zig](./examples/generated/arc.png)\n![arc_negative.zig](./examples/generated/arc_negative.png)\n![curve_to.zig](./examples/generated/curve_to.png)\n![fill_style.zig](./examples/generated/fill_style.png)\n![gradient.zig](./examples/generated/gradient.png)\n![image.zig](./examples/generated/image.png)\n![spiral.zig](./examples/generated/spiral.png)\n![spirograph.zig](./examples/generated/spirograph.png)\n\n![compositing.zig](./examples/generated/compositing.png)\n![pango_simple.zig](./examples/generated/pango_simple.png)\n\n\nRun `zig build --help` to see all the compilation targets.\n\nMost examples generate a PNG. Here I use [feh](https://feh.finalrewind.org/) to view the generated file:\n\n```sh\nzig build rounded_rectangle \u0026\u0026 feh examples/generated/rounded_rectangle.png\nzig build spirograph \u0026\u0026 feh examples/generated/spirograph.png\nzig build text_extents \u0026\u0026 feh examples/generated/text_extents.png\n```\n\nA few examples generate a SVG:\n\n```sh\nzig build surface_svg \u0026\u0026 inkscape examples/generated/test-image.svg\n```\n\nSome other examples don't generate any image file. This one opens a window and renders cairo graphics inside of it (using a cairo [XCB](https://xcb.freedesktop.org/) surface):\n\n```sh\nzig build surface_xcb\n```\n\nIf you installed [XVFB](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) you can also run this example in a virtual framebuffer:\n\n```sh\nxvfb-run --server-args=\"-screen 0 1024x768x24\" zig build surface_xcb\n```\n\n## Tests\n\n```sh\n# run all tests, in all modes (debug, release-fast, release-safe, release-small)\nzig build test\n\n# run all tests, only in debug mode\nzig build test-debug\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdbd%2Fzig-cairo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackdbd%2Fzig-cairo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdbd%2Fzig-cairo/lists"}