A pycairo-compatible 2D vector-graphics backend that renders on the Apple GPU via Metal. Independent project — not affiliated with the cairo project or pycairo.
Project description
cairometal
A pycairo-compatible 2D vector-graphics backend that renders on the Apple GPU via Metal.
Independent project — not affiliated with the cairo graphics library or the official
pycairobinding. It reimplements a compatible surface/context API on top of Metal.
Requirements
- macOS (Apple Silicon). Metal is an Apple framework; there are no Linux/Windows builds.
- Python 3.10+.
Install
pip install cairometal
Wheels are published per-CPython-version for macOS arm64. There is no on-the-fly compilation at install time — you get a prebuilt binary.
Usage
The API mirrors pycairo, so existing pycairo code largely works by changing the import:
import cairometal as cairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
ctx = cairo.Context(surface)
ctx.set_source_rgb(0.13, 0.42, 0.96)
ctx.rectangle(32, 32, 192, 192)
ctx.fill()
ctx.set_source_rgb(1, 1, 1)
ctx.move_to(60, 140)
ctx.set_font_size(40)
ctx.show_text("Metal")
surface.write_to_png("out.png") # rasterized on the GPU
What it is
cairometal implements cairo's drawing model — paths, fills, strokes, clips,
groups, gradients, text, image surfaces, PNG output — with the rasterization
running on the GPU through Metal. It's useful where you have GPU-bound 2D vector
work; for light/typical cairo workloads the CPU pycairo is perfectly fine.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cairometal-0.1.0.tar.gz.
File metadata
- Download URL: cairometal-0.1.0.tar.gz
- Upload date:
- Size: 324.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c339ff7d8dcf3eb06458bb57e77e81bf0dd3458707bebe838797fb38f3522438
|
|
| MD5 |
f1a72613b488c8c779645068b5d11cac
|
|
| BLAKE2b-256 |
53a8318aa6388bb91db9e08f9977ea64e37e59b783ed8f8bbce87139c8af5296
|
File details
Details for the file cairometal-0.1.0-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: cairometal-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 171.6 kB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd16cfb531c31d278b96ea67b0a7abc78e363ba83a7484657d4c122d7887e247
|
|
| MD5 |
7143501e071bca8b6f8d0e920bbe6ca4
|
|
| BLAKE2b-256 |
e565c679d4ea9de4c0a2b37ca4bf40af20ca6b60701d0e15187d8c2367f1f92e
|