Skip to main content

Blend2D Python Bindings (nanobind version)

Project description

Blend2D Python Bindings (nanobind version)

Python bindings for the Blend2D rendering engine using nanobind.

Overview

This project has been converted from the original Cython-based implementation to use nanobind, which offers:

  • Improved performance
  • Better compatibility with modern C++
  • Simplified binding code
  • Cleaner implementation

Requirements

  • C++17 compatible compiler
  • CMake 3.15 or newer
  • Python 3.8 or newer
  • NumPy

Installation

From PyPI

Pre-built wheels are available for:

  • Windows (x86_64)
  • macOS (x86_64, arm64/Apple Silicon)
  • Linux (x86_64, aarch64/ARM64)
  • WebAssembly (via Emscripten)
pip install blend2d-python

From Source

pip install .

Or for development:

pip install -e .

Usage

import numpy as np
from blend2d import Context, Image, Gradient, Path, Format

# Create an image
img = Image(480, 480, Format.PRGB32)

# Attach a rendering context to it
ctx = Context(img)

# Clear the image with white color
ctx.fill_all((1.0, 1.0, 1.0, 1.0))

# Create a linear gradient
gradient = Gradient.create_linear(0, 0, 480, 480)
gradient.add_stop(0.0, (1.0, 0.0, 0.0, 1.0))
gradient.add_stop(0.5, (0.0, 1.0, 0.0, 1.0))
gradient.add_stop(1.0, (0.0, 0.0, 1.0, 1.0))

# Create a path (a star, for example)
path = Path()
path.move_to(240, 80)
for i in range(5):
    angle = (i * 2.0 * np.pi / 5.0) + np.pi / 2.0
    path.line_to(240 + 160 * np.cos(angle), 240 + 160 * np.sin(angle))

# Fill the path with the gradient
ctx.set_fill_style(gradient)
ctx.fill_path(path)

# Save the image to a file
img.write_to_file("star.png")

Building Wheels

This project uses cibuildwheel to build wheels for multiple platforms:

  • Windows (x86_64)
  • macOS (x86_64, arm64/Apple Silicon)
  • Linux (x86_64, aarch64/ARM64)
  • WebAssembly (via Emscripten)

To build wheels locally:

pip install cibuildwheel
python -m cibuildwheel --platform auto

License

MIT License

Acknowledgements

This project was originally created by John Wiggins using Cython, and has been converted to use nanobind.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blend2d_python-1.0.0.tar.gz (3.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

blend2d_python-1.0.0-cp312-cp312-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.12Windows x86-64

blend2d_python-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

blend2d_python-1.0.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

blend2d_python-1.0.0-cp311-cp311-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.11Windows x86-64

blend2d_python-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

blend2d_python-1.0.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

blend2d_python-1.0.0-cp310-cp310-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.10Windows x86-64

blend2d_python-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

blend2d_python-1.0.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

blend2d_python-1.0.0-cp39-cp39-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.9Windows x86-64

blend2d_python-1.0.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

blend2d_python-1.0.0-cp39-cp39-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

blend2d_python-1.0.0-cp38-cp38-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.8Windows x86-64

blend2d_python-1.0.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

blend2d_python-1.0.0-cp38-cp38-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (2.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file blend2d_python-1.0.0.tar.gz.

File metadata

  • Download URL: blend2d_python-1.0.0.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for blend2d_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a88b1681568873266b39aefdc3b68023966c8ecbbbe6d8fe29d80a7dad28ee2b
MD5 34ebc03a7c4780408c92d63032cec5c5
BLAKE2b-256 685f61a3df420487aff791639d069f849919041bcb94e7bf1184d6e70ff6769f

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0.tar.gz:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e6ba6330e3d3bdb3fd0e507703c609c4a43e5f386aca5b216017fbfa6c276bbe
MD5 11b9c48571e31afbdc30a617dff2e7ac
BLAKE2b-256 8aae4341284fd9bfa445c1f19d2c8013a04f4fbdd15d3ba495a7a07e12784c69

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp312-cp312-win_amd64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 07259957415ab717fbe5d51afd774b0fa973ce7e2e5ff935862ec5fb607a8662
MD5 2a90284f429d5164ae712098eabdb1dd
BLAKE2b-256 acbe60fd1a4523d9c90c6d4768d9b057f6afbba95e24f4d5072370ff8e8f20e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 76d70f5ff6eada3a95c4e85bceaf0c8c51bdd2cc37c0876178d73dbafeaa85c4
MD5 3be50597c377920c56add40b1f2b2e9d
BLAKE2b-256 5b9ab21153958f5c707c401413075ed692ed609f25ebc04fb81af5bdbb78c395

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c507b38a88f9edf28545d72d190273eab5ed4dd4800d5a147ddcf35c15669eea
MD5 581c860187d40bc155fa22222bba5b08
BLAKE2b-256 9789e3d4116cfa42ed0e65572bce0cb2743a664338ca70fe672bebc54236ad65

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp311-cp311-win_amd64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b3f34b7b118234932377168032a5ed64dc5d785d2dcc406d42e74af36e8339ff
MD5 ca4018631b92a5e47407c561748ededd
BLAKE2b-256 b5e5ff4373918b98cffdaa670cd8fd3eae56490a0ad571f4473ab4bfc505fd85

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 df448af6aeafde03cb0bb431f1809797cfe9839dde46ed5ddbe05fed36bb3a29
MD5 dd737cd8a12a266359146d2ac3986e90
BLAKE2b-256 37a4300ad0eb6a8f510e0ed5fb15a60357e488ff39da1c2a26d90e37dc493ea7

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f8bde34b1728f017297aa23461c5a8a89b08c0705fbf7f3912128eabea52ffb7
MD5 02d65c1bc453bda6ccf6f9bbd26c85e1
BLAKE2b-256 f4a1be249591b95a089e7f9b14e39016c0cc6f2677cbd20876e3ca5d6b7cc153

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp310-cp310-win_amd64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 56822d6d5e244024d3f50b552d8bfdd1402c7d7db93e072cda4c751c78924f38
MD5 f7880f5788170a090fe1ecf19d128c7e
BLAKE2b-256 0eebd7a155c3d97b9ca9d5c8e587894be7cb9ad3a9265da24a3f426c4e3a1f60

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c6b4f0c7466f8a32c6c81c57387f423ddac95afdcecca17294f91e038ca5a8cc
MD5 7822555e5dcbda60d2b28c676ea89f42
BLAKE2b-256 ce1b6591af550057112480216f3c8390035640fd74729192491caf36080ba942

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9ed4f213f750e534b78952240112dd44e72d14d5b98842ddcb2c85f915762fa8
MD5 b0d0b5b66dad95d92cdaea368ba6b513
BLAKE2b-256 5e213962d9f3ff5543b678af11fd61bf8c039b7e2366e8ae3fa37224da61fd31

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp39-cp39-win_amd64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c11ae24d4cdd2a1ff8792f809ecaf9a808b70e5194d01fda462c2583e3a75e4c
MD5 659b7ec1bc9c381e3ed955a8d2835882
BLAKE2b-256 5612cba682736d1552fad373c0fae8b62b314e89b2fe7bb34745611e9f556243

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp39-cp39-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp39-cp39-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 10da925f249fdc7749c888450263b2c47d075bfb58f6e7880f965163b67c2a54
MD5 1ea064dd5326aabc980bec73c8a979b3
BLAKE2b-256 01d8ef06534a023b9a4db973fe32701cd602080bb29fdbc4490c086482273711

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp39-cp39-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 019ee7544a4aded8504192ca697f2e9cc14a0287cbd8bb37f8bb61d41f3b41a9
MD5 1f76d43334cfbe5b994d8fee6186b651
BLAKE2b-256 44a54ca4d5d5ab3bfb0f1c72158ee56e16b21676d71d4f757c36b7e49f727785

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp38-cp38-win_amd64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 55d3da53a62b7744ec9c0f30900b0618863b8af9197bde82cd946e0efa7e4daa
MD5 70d22c85be34939e5f5fd8a230171ec0
BLAKE2b-256 b493159d5b85fd64350ca463417dbcffab6656db053d5627c0aafd5b1bdacbd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blend2d_python-1.0.0-cp38-cp38-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for blend2d_python-1.0.0-cp38-cp38-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a58bf2ef4673bdeb78abc63a9e1b5bd32a8cbfc64b5555fb9206a8dd6fd6f4e0
MD5 26973330d8c2750588d7ddca44558c08
BLAKE2b-256 33f47efad1d03ebbb77c8f2294ae9d5cc6b0ebc59e790525f22b426e2a352d2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for blend2d_python-1.0.0-cp38-cp38-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build-wheels.yml on perara/blend2d-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page