cairometal 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cairometal-0.1.0/LICENSE +21 -0
- cairometal-0.1.0/MANIFEST.in +6 -0
- cairometal-0.1.0/PKG-INFO +81 -0
- cairometal-0.1.0/README.md +53 -0
- cairometal-0.1.0/cairometal/__init__.py +33 -0
- cairometal-0.1.0/cairometal.egg-info/PKG-INFO +81 -0
- cairometal-0.1.0/cairometal.egg-info/SOURCES.txt +39 -0
- cairometal-0.1.0/cairometal.egg-info/dependency_links.txt +1 -0
- cairometal-0.1.0/cairometal.egg-info/top_level.txt +1 -0
- cairometal-0.1.0/include/cairo_metal.h +1090 -0
- cairometal-0.1.0/prebuilt/default.metallib +0 -0
- cairometal-0.1.0/pyproject.toml +46 -0
- cairometal-0.1.0/python/cairo_metal_ext.c +2817 -0
- cairometal-0.1.0/setup.cfg +4 -0
- cairometal-0.1.0/setup.py +96 -0
- cairometal-0.1.0/shaders/fill.metal +1066 -0
- cairometal-0.1.0/src/cairo_metal.m +816 -0
- cairometal-0.1.0/src/cm_clip.m +889 -0
- cairometal-0.1.0/src/cm_compose.m +613 -0
- cairometal-0.1.0/src/cm_device.m +1764 -0
- cairometal-0.1.0/src/cm_fill.m +590 -0
- cairometal-0.1.0/src/cm_font.c +781 -0
- cairometal-0.1.0/src/cm_ft.c +342 -0
- cairometal-0.1.0/src/cm_group.m +328 -0
- cairometal-0.1.0/src/cm_internal.h +762 -0
- cairometal-0.1.0/src/cm_matrix.c +272 -0
- cairometal-0.1.0/src/cm_mesh.c +681 -0
- cairometal-0.1.0/src/cm_paint.m +709 -0
- cairometal-0.1.0/src/cm_path.m +1354 -0
- cairometal-0.1.0/src/cm_pattern.c +525 -0
- cairometal-0.1.0/src/cm_query.c +362 -0
- cairometal-0.1.0/src/cm_raster.c +215 -0
- cairometal-0.1.0/src/cm_recording.m +526 -0
- cairometal-0.1.0/src/cm_region.c +849 -0
- cairometal-0.1.0/src/cm_state.c +399 -0
- cairometal-0.1.0/src/cm_stroke.m +900 -0
- cairometal-0.1.0/src/cm_surface.m +758 -0
- cairometal-0.1.0/src/cm_surface_format.c +287 -0
- cairometal-0.1.0/src/cm_surface_png.m +450 -0
- cairometal-0.1.0/src/cm_surface_similar.c +228 -0
- cairometal-0.1.0/src/cm_text.m +921 -0
cairometal-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yu Yao-Hsing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cairometal
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 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.
|
|
5
|
+
Author-email: Yu Yao-Hsing <euler.yu@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yu314-coder/cairometal
|
|
8
|
+
Project-URL: Source, https://github.com/yu314-coder/cairometal
|
|
9
|
+
Project-URL: Issues, https://github.com/yu314-coder/cairometal/issues
|
|
10
|
+
Keywords: cairo,pycairo,metal,gpu,graphics,2d,vector,apple,macos
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
15
|
+
Classifier: Environment :: GPU
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# cairometal
|
|
30
|
+
|
|
31
|
+
**A [pycairo](https://pycairo.readthedocs.io/)-compatible 2D vector-graphics backend that renders on the Apple GPU via Metal.**
|
|
32
|
+
|
|
33
|
+
> **Independent project — not affiliated with the [cairo](https://cairographics.org) graphics library or the official `pycairo` binding.** It reimplements a compatible surface/context API on top of Metal.
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- **macOS** (Apple Silicon). Metal is an Apple framework; there are no Linux/Windows builds.
|
|
38
|
+
- Python **3.10+**.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install cairometal
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Wheels are published per-CPython-version for macOS arm64. There is no on-the-fly
|
|
47
|
+
compilation at install time — you get a prebuilt binary.
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
The API mirrors pycairo, so existing pycairo code largely works by changing the
|
|
52
|
+
import:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import cairometal as cairo
|
|
56
|
+
|
|
57
|
+
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
|
|
58
|
+
ctx = cairo.Context(surface)
|
|
59
|
+
|
|
60
|
+
ctx.set_source_rgb(0.13, 0.42, 0.96)
|
|
61
|
+
ctx.rectangle(32, 32, 192, 192)
|
|
62
|
+
ctx.fill()
|
|
63
|
+
|
|
64
|
+
ctx.set_source_rgb(1, 1, 1)
|
|
65
|
+
ctx.move_to(60, 140)
|
|
66
|
+
ctx.set_font_size(40)
|
|
67
|
+
ctx.show_text("Metal")
|
|
68
|
+
|
|
69
|
+
surface.write_to_png("out.png") # rasterized on the GPU
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## What it is
|
|
73
|
+
|
|
74
|
+
`cairometal` implements cairo's drawing model — paths, fills, strokes, clips,
|
|
75
|
+
groups, gradients, text, image surfaces, PNG output — with the rasterization
|
|
76
|
+
running on the GPU through Metal. It's useful where you have GPU-bound 2D vector
|
|
77
|
+
work; for light/typical cairo workloads the CPU `pycairo` is perfectly fine.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# cairometal
|
|
2
|
+
|
|
3
|
+
**A [pycairo](https://pycairo.readthedocs.io/)-compatible 2D vector-graphics backend that renders on the Apple GPU via Metal.**
|
|
4
|
+
|
|
5
|
+
> **Independent project — not affiliated with the [cairo](https://cairographics.org) graphics library or the official `pycairo` binding.** It reimplements a compatible surface/context API on top of Metal.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- **macOS** (Apple Silicon). Metal is an Apple framework; there are no Linux/Windows builds.
|
|
10
|
+
- Python **3.10+**.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install cairometal
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Wheels are published per-CPython-version for macOS arm64. There is no on-the-fly
|
|
19
|
+
compilation at install time — you get a prebuilt binary.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
The API mirrors pycairo, so existing pycairo code largely works by changing the
|
|
24
|
+
import:
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import cairometal as cairo
|
|
28
|
+
|
|
29
|
+
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
|
|
30
|
+
ctx = cairo.Context(surface)
|
|
31
|
+
|
|
32
|
+
ctx.set_source_rgb(0.13, 0.42, 0.96)
|
|
33
|
+
ctx.rectangle(32, 32, 192, 192)
|
|
34
|
+
ctx.fill()
|
|
35
|
+
|
|
36
|
+
ctx.set_source_rgb(1, 1, 1)
|
|
37
|
+
ctx.move_to(60, 140)
|
|
38
|
+
ctx.set_font_size(40)
|
|
39
|
+
ctx.show_text("Metal")
|
|
40
|
+
|
|
41
|
+
surface.write_to_png("out.png") # rasterized on the GPU
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## What it is
|
|
45
|
+
|
|
46
|
+
`cairometal` implements cairo's drawing model — paths, fills, strokes, clips,
|
|
47
|
+
groups, gradients, text, image surfaces, PNG output — with the rasterization
|
|
48
|
+
running on the GPU through Metal. It's useful where you have GPU-bound 2D vector
|
|
49
|
+
work; for light/typical cairo workloads the CPU `pycairo` is perfectly fine.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""cairometal — a pycairo-compatible 2D vector-graphics backend that renders on
|
|
2
|
+
the Apple GPU via Metal.
|
|
3
|
+
|
|
4
|
+
Independent project. NOT affiliated with the cairo graphics library
|
|
5
|
+
(cairographics.org) or the official `pycairo` binding — it reimplements a
|
|
6
|
+
compatible surface/context API on top of Metal.
|
|
7
|
+
|
|
8
|
+
macOS only (Metal is an Apple framework). Usage mirrors pycairo:
|
|
9
|
+
|
|
10
|
+
import cairometal as cairo
|
|
11
|
+
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
|
|
12
|
+
ctx = cairo.Context(surface)
|
|
13
|
+
ctx.set_source_rgb(0.2, 0.6, 1.0)
|
|
14
|
+
ctx.paint()
|
|
15
|
+
surface.write_to_png("out.png")
|
|
16
|
+
"""
|
|
17
|
+
import os as _os
|
|
18
|
+
|
|
19
|
+
# Point the native extension at the metallib we ship beside it, before it loads.
|
|
20
|
+
# (The extension's discovery order is: $CM_METALLIB -> main-bundle -> source.)
|
|
21
|
+
_os.environ.setdefault(
|
|
22
|
+
"CM_METALLIB",
|
|
23
|
+
_os.path.join(_os.path.dirname(__file__), "default.metallib"),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
from .cairo_metal import * # noqa: E402,F401,F403
|
|
27
|
+
|
|
28
|
+
try: # surface __all__/__doc__ if the ext defines them
|
|
29
|
+
from .cairo_metal import __all__, __doc__ # noqa: E402,F401
|
|
30
|
+
except ImportError:
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
del _os
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cairometal
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 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.
|
|
5
|
+
Author-email: Yu Yao-Hsing <euler.yu@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yu314-coder/cairometal
|
|
8
|
+
Project-URL: Source, https://github.com/yu314-coder/cairometal
|
|
9
|
+
Project-URL: Issues, https://github.com/yu314-coder/cairometal/issues
|
|
10
|
+
Keywords: cairo,pycairo,metal,gpu,graphics,2d,vector,apple,macos
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
15
|
+
Classifier: Environment :: GPU
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# cairometal
|
|
30
|
+
|
|
31
|
+
**A [pycairo](https://pycairo.readthedocs.io/)-compatible 2D vector-graphics backend that renders on the Apple GPU via Metal.**
|
|
32
|
+
|
|
33
|
+
> **Independent project — not affiliated with the [cairo](https://cairographics.org) graphics library or the official `pycairo` binding.** It reimplements a compatible surface/context API on top of Metal.
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- **macOS** (Apple Silicon). Metal is an Apple framework; there are no Linux/Windows builds.
|
|
38
|
+
- Python **3.10+**.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install cairometal
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Wheels are published per-CPython-version for macOS arm64. There is no on-the-fly
|
|
47
|
+
compilation at install time — you get a prebuilt binary.
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
The API mirrors pycairo, so existing pycairo code largely works by changing the
|
|
52
|
+
import:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import cairometal as cairo
|
|
56
|
+
|
|
57
|
+
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 256, 256)
|
|
58
|
+
ctx = cairo.Context(surface)
|
|
59
|
+
|
|
60
|
+
ctx.set_source_rgb(0.13, 0.42, 0.96)
|
|
61
|
+
ctx.rectangle(32, 32, 192, 192)
|
|
62
|
+
ctx.fill()
|
|
63
|
+
|
|
64
|
+
ctx.set_source_rgb(1, 1, 1)
|
|
65
|
+
ctx.move_to(60, 140)
|
|
66
|
+
ctx.set_font_size(40)
|
|
67
|
+
ctx.show_text("Metal")
|
|
68
|
+
|
|
69
|
+
surface.write_to_png("out.png") # rasterized on the GPU
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## What it is
|
|
73
|
+
|
|
74
|
+
`cairometal` implements cairo's drawing model — paths, fills, strokes, clips,
|
|
75
|
+
groups, gradients, text, image surfaces, PNG output — with the rasterization
|
|
76
|
+
running on the GPU through Metal. It's useful where you have GPU-bound 2D vector
|
|
77
|
+
work; for light/typical cairo workloads the CPU `pycairo` is perfectly fine.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.py
|
|
6
|
+
cairometal/__init__.py
|
|
7
|
+
cairometal.egg-info/PKG-INFO
|
|
8
|
+
cairometal.egg-info/SOURCES.txt
|
|
9
|
+
cairometal.egg-info/dependency_links.txt
|
|
10
|
+
cairometal.egg-info/top_level.txt
|
|
11
|
+
include/cairo_metal.h
|
|
12
|
+
prebuilt/default.metallib
|
|
13
|
+
python/cairo_metal_ext.c
|
|
14
|
+
shaders/fill.metal
|
|
15
|
+
src/cairo_metal.m
|
|
16
|
+
src/cm_clip.m
|
|
17
|
+
src/cm_compose.m
|
|
18
|
+
src/cm_device.m
|
|
19
|
+
src/cm_fill.m
|
|
20
|
+
src/cm_font.c
|
|
21
|
+
src/cm_ft.c
|
|
22
|
+
src/cm_group.m
|
|
23
|
+
src/cm_internal.h
|
|
24
|
+
src/cm_matrix.c
|
|
25
|
+
src/cm_mesh.c
|
|
26
|
+
src/cm_paint.m
|
|
27
|
+
src/cm_path.m
|
|
28
|
+
src/cm_pattern.c
|
|
29
|
+
src/cm_query.c
|
|
30
|
+
src/cm_raster.c
|
|
31
|
+
src/cm_recording.m
|
|
32
|
+
src/cm_region.c
|
|
33
|
+
src/cm_state.c
|
|
34
|
+
src/cm_stroke.m
|
|
35
|
+
src/cm_surface.m
|
|
36
|
+
src/cm_surface_format.c
|
|
37
|
+
src/cm_surface_png.m
|
|
38
|
+
src/cm_surface_similar.c
|
|
39
|
+
src/cm_text.m
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cairometal
|