Skip to main content

A Python wrapper for the Windows Direct2D and DirectWrite APIs

Project description

pyD2D - A Python wrapper for the Windows Direct2D API

pyD2D is a Python wrapper for the Windows Direct2D and DirectWrite APIs.

Not all of the Direct2D and DirectWrite APIs are wrapped, but the most commonly used ones are. If you need a specific API that is not wrapped, feel free to open an issue or submit a pull request.

Installation

pip install pyd2d

Usage

import pyd2d

# Initialize COM
pyd2d.InitializeCOM()

# Create a Direct2D factory
factory = pyd2d.GetD2DFactory()

# Create a render target
render_target = factory.CreateHwndRenderTarget(
    my_hwnd, width=800, height=600,
)

# Draw a rectangle
render_target.BeginDraw()
render_target.Clear(1.0, 1.0, 1.0, 1.0)
render_target.FillRectangle(100, 100, 200, 200, render_target.CreateSolidColorBrush(0.0, 0.0, 0.0, 1.0))
render_target.EndDraw()

License

pyD2D is licensed under the MIT License.

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

pyd2d-0.1.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

pyd2d-0.1.0-cp313-cp313-win32.whl (105.2 kB view details)

Uploaded CPython 3.13Windows x86

File details

Details for the file pyd2d-0.1.0.tar.gz.

File metadata

  • Download URL: pyd2d-0.1.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyd2d-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ae460a5a847ef33f3dbfe88899e60bdb65f25c8f7204fc42068bb5894df9cc0
MD5 7a35dd037aed94f05cf5ef030e2103c4
BLAKE2b-256 e8be356394ce1b3c22fe3cfa2d813bdf8a23850a246d1ae2bb595c0c465a1dbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.0.tar.gz:

Publisher: publish.yml on merlinz01/pyd2d

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

File details

Details for the file pyd2d-0.1.0-cp313-cp313-win32.whl.

File metadata

  • Download URL: pyd2d-0.1.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 105.2 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyd2d-0.1.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 ae2288ae9c9e079284b8306f73a970aff9396a5ca5e01745d5f504e1c18aac55
MD5 c5219d1a9d47f4c4e8ad933fd2eacaa2
BLAKE2b-256 520dafa15f46308ee68f6dacb394f95c4a9dbe2dbcb6257358d012b10c89385e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.0-cp313-cp313-win32.whl:

Publisher: publish.yml on merlinz01/pyd2d

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